[NumPy-Tickets] [NumPy] #1580: shape lost inside record arrays
NumPy Trac
numpy-tickets@scipy....
Thu Aug 12 00:24:54 CDT 2010
#1580: shape lost inside record arrays
------------------------+---------------------------------------------------
Reporter: batripler | Owner: somebody
Type: defect | Status: new
Priority: high | Milestone:
Component: numpy.core | Version: 1.4.0
Keywords: |
------------------------+---------------------------------------------------
The following code replicates the problem:
{{{
import numpy
def foo(dim):
sdt=numpy.dtype([('v',(float,(1,)))])
print numpy.empty(dim,sdt)['v'].shape
print
numpy.empty(dim,numpy.dtype([('d1',sdt),('d2',sdt)]))['d1']['v'].shape
def test():
foo((2,3))
foo((0,3))
}}}
Output:
{{{
(2, 3, 1)
(2, 3, 1)
(0, 3, 1)
(1, 0, 3)
}}}
The 1st line matches the 2nd line of output, since the array is of non-
zero size. The same should be true for the 3rd and 4th lines, when the
array happens to be zero-sized (i.e. zero along at least one dimension).
Indexing zero-sized record arrays with subarray fields doesn't return
arrays of the correct shape.
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1580>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list