[Numpy-discussion] bug?

Todd Miller jmiller at stsci.edu
Mon Aug 18 05:28:09 EDT 2003


Hi Peter,

What you're demonstrating below looks like a bug in numarray which was
just recently solved:

https://sourceforge.net/tracker/index.php?func=detail&aid=784866&group_id=1369&atid=450446


As you've shown, numarray's astype() fails for some slices, notably
those which are offset from the base of the array and therefore have a
non-zero _byteoffset.   This is fixed in CVS now and will be "officially
released" soon.


On Mon, 2003-08-18 at 08:01, Peter Verveer wrote:
> Consider conversion of a slice using the astype() method:
> 
> >>> a = array([[1,2],[3,4]])
> >>> b = a[1, ...]
> >>> print b
> [3 4]
> 
> Conversion using the astype() method goes wrong:
> 
> >>> print b.astype(Float32)
> [ 1.  2.]
> 
> This fixes it:
> 
> >>> print b.copy().astype(Float32)
> [ 3.  4.]
> 
> A bug?
> 
> Cheers, Peter
-- 
Todd Miller <jmiller at stsci.edu>





More information about the NumPy-Discussion mailing list