Re: [Numpy-discussion] record array with array elements

2009-01-06 Thread Robert Kern
On Tue, Jan 6, 2009 at 22:04, Igor Sylvester wrote: > If array fields should be of the form (name,subdtype, shape), how do I > specify field offsets? My datatype is word-aligned. With dtype(some_list), you need to explicitly include the padding. E.g. ('', '|V4') to add 4 bytes of padding. Alterna

Re: [Numpy-discussion] record array with array elements

2009-01-06 Thread Igor Sylvester
If array fields should be of the form (name,subdtype, shape), how do I specify field offsets? My datatype is word-aligned. Thanks. On Tue, Jan 6, 2009 at 3:41 PM, Robert Kern wrote: > On Tue, Jan 6, 2009 at 14:07, Igor Sylvester wrote: > > Everyone, > > > > Shouldn't the itemsize below be 2? >

Re: [Numpy-discussion] record array with array elements

2009-01-06 Thread Robert Kern
On Tue, Jan 6, 2009 at 14:07, Igor Sylvester wrote: > Everyone, > > Shouldn't the itemsize below be 2? > import numpy as np dtype = np.dtype( [ (((2,), 'top'), [('nested', 'i1')]) ] ) dtype.itemsize > 1 np.__version__ > '1.0.4' > > The elements of the dtype are of type array of

Re: [Numpy-discussion] record array with array elements

2009-01-06 Thread Igor Sylvester
A simpler example returns 1 as well: np.dtype( [ (((2,), 'a'), 'i1') ] ).itemsize On Tue, Jan 6, 2009 at 2:07 PM, Igor Sylvester wrote: > Everyone, > > Shouldn't the itemsize below be 2? > > >>> import numpy as np > >>> dtype = np.dtype( [ (((2,), 'top'), [('nested', 'i1')]) ] ) > >>> dtype.ite

[Numpy-discussion] record array with array elements

2009-01-06 Thread Igor Sylvester
Everyone, Shouldn't the itemsize below be 2? >>> import numpy as np >>> dtype = np.dtype( [ (((2,), 'top'), [('nested', 'i1')]) ] ) >>> dtype.itemsize 1 >>> np.__version__ '1.0.4' The elements of the dtype are of type array of size 2. Each element is a (nested) record array of size 2 with one f