[Numpy-discussion] numarray.concatenate for character arrays

Todd Miller jmiller at stsci.edu
Tue Jun 22 06:05:11 EDT 2004


Hi Faheem,

This is a bug.  It'll be fixed in numarray-1.0 which should hopefully be
released this week.

Regards,
Todd

On Mon, 2004-06-21 at 20:17, Faheem Mitha wrote:
> Dear People,
> 
> Is the function numarray.concatenate supposed to work for character
> arrays? It doesn't for me. Do I need to write my own? Thanks in
> advance. Please cc me, I'm not subscribed.
> 
>                                                            Faheem.
> 
> In [17]: foo
> Out[17]:
> CharArray([['T', 'T'],
>            ['C', 'A']])
> 
> In [18]: bar
> Out[18]:
> CharArray([['G', 'G'],
>            ['G', 'G']])
> 
> In [23]: numarray.concatenate((foo,bar))
> ---------------------------------------------------------------------------
> error                                     Traceback (most recent call
> last)
> 
> /home/faheem/wc/corrmodel/trunk/<console>
> 
> /usr/lib/python2.3/site-packages/numarray/generic.py in
> concatenate(arrs, axis)
>    1018     arrs = map(_nc.asarray, arrs)
>    1019     if axis == 0:
> -> 1020         return _concat(arrs)
>    1021     else:
>    1022         return swapaxes(_concat([swapaxes(m,axis,0) for m in
>    arrs]), axis, 0)
> 
> /usr/lib/python2.3/site-packages/numarray/generic.py in _concat(arrs)
>    1000         convType = ufunc._maxPopType(arrs)
>    1001     except TypeError:
> -> 1002         dest = arrs[0]._clone(shape=destShape)
>    1003     else:
>    1004         dest  = arrs[0].__class__(shape=destShape,
>    type=convType)
> 
> /usr/lib/python2.3/site-packages/numarray/generic.py in _clone(self,
> shape)
>     783     def _clone(self, shape):
>     784         c = self.copy()
> --> 785         c.resize(shape)
>     786         return c
>     787
> 
> /usr/lib/python2.3/site-packages/numarray/generic.py in resize(self,
> shape, *args)
>     854                     self[offset:offset+olen] = self[0:olen]
>     855                     offset += olen
> --> 856                 self[offset:nlen] = self[0:nlen-offset]
>     857         else:   # zero fill resized zero-length numarray
>     858             self[:] = 0
> 
> /usr/lib/python2.3/site-packages/numarray/strings.py in
> _copyFrom(self, arr)
>     217         me = self._byteView()
>     218         if self._itemsize <= arr._itemsize:
> --> 219             me[:] = it[..., :self._itemsize]
>     220         else:
>     221             me[...,:it._shape[-1]] = it
> 
> error: copy1bytes: access beyond buffer. offset=8 buffersize=8
> 
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email sponsored by Black Hat Briefings & Training.
> Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
> digital self defense, top technical experts, no vendor pitches, 
> unmatched networking opportunities. Visit www.blackhat.com
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
-- 
Todd Miller <jmiller at stsci.edu>





More information about the NumPy-Discussion mailing list