Re: [Numpy-discussion] Nested recarrays with subarrays and loadtxt: a bug in loadtxt?

2009-05-28 Thread Pierre GM
On May 27, 2009, at 7:29 PM, Stéfan van der Walt wrote: > Hi Fernando > > 2009/5/28 Fernando Perez : >> Well, since dtypes allow for nesting full arrays in this fashion, >> where I can say that the 'block' field can have (2,3) shape, it seems >> like it would be nice to be able to express this ne

Re: [Numpy-discussion] Nested recarrays with subarrays and loadtxt: a bug in loadtxt?

2009-05-27 Thread Fernando Perez
2009/5/27 Stéfan van der Walt : > Hi Fernando > > 2009/5/28 Fernando Perez : >> Well, since dtypes allow for nesting full arrays in this fashion, >> where I can say that the 'block' field can have (2,3) shape, it seems >> like it would be nice to be able to express this nesting into loading >> of p

Re: [Numpy-discussion] Nested recarrays with subarrays and loadtxt: a bug in loadtxt?

2009-05-27 Thread Stéfan van der Walt
Hi Fernando 2009/5/28 Fernando Perez : > Well, since dtypes allow for nesting full arrays in this fashion, > where I can say that the 'block' field can have (2,3) shape, it seems > like it would be nice to be able to express this nesting into loading > of plain text files as well. I think that wo

Re: [Numpy-discussion] Nested recarrays with subarrays and loadtxt: a bug in loadtxt?

2009-05-27 Thread Pierre GM
On May 27, 2009, at 7:10 PM, Fernando Perez wrote: > Hi Pierre, > > On Wed, May 27, 2009 at 4:03 PM, Pierre GM > wrote: >> Oh yes indeed. Yet another case of "I-opened-my-mouth-too-soon'... >> >> OK, so there's a trick. Kinda: >> * Define a specific converter: >> > > Thanks, that's an alternat

Re: [Numpy-discussion] Nested recarrays with subarrays and loadtxt: a bug in loadtxt?

2009-05-27 Thread Fernando Perez
Hi Pierre, On Wed, May 27, 2009 at 4:03 PM, Pierre GM wrote: > Oh yes indeed. Yet another case of "I-opened-my-mouth-too-soon'... > > OK, so there's a trick. Kinda: > * Define a specific converter: > Thanks, that's an alternative, though I think I prefer my two-pass hack, though I can't quite re

Re: [Numpy-discussion] Nested recarrays with subarrays and loadtxt: a bug in loadtxt?

2009-05-27 Thread Fernando Perez
Hi Stefan, 2009/5/27 Stéfan van der Walt : > Hi Fernando > > 2009/5/27 Fernando Perez : >> I'm wondering if the code below illustrates a bug in loadtxt, or just >> a 'live with it' limitation. > > I'm not sure whether this is a bug or not. > > By specifying the dtype > >> dt = dtype(dict(names=['n

Re: [Numpy-discussion] Nested recarrays with subarrays and loadtxt: a bug in loadtxt?

2009-05-27 Thread Pierre GM
On May 27, 2009, at 6:15 PM, Fernando Perez wrote: > Hi Pierre, > > On Wed, May 27, 2009 at 3:01 PM, Pierre GM > wrote: >> Have you tried np.lib.io.genfromtxt ? >> > > I didn't know about it, but it has the same problem as loadtxt: Oh yes indeed. Yet another case of "I-opened-my-mouth-too-soo

Re: [Numpy-discussion] Nested recarrays with subarrays and loadtxt: a bug in loadtxt?

2009-05-27 Thread Stéfan van der Walt
Hi Fernando 2009/5/27 Fernando Perez : > I'm wondering if the code below illustrates a bug in loadtxt, or just > a 'live with it' limitation. I'm not sure whether this is a bug or not. By specifying the dtype > dt = dtype(dict(names=['name','x','y','block'], >formats=['S4',float

Re: [Numpy-discussion] Nested recarrays with subarrays and loadtxt: a bug in loadtxt?

2009-05-27 Thread Fernando Perez
Hi Pierre, On Wed, May 27, 2009 at 3:01 PM, Pierre GM wrote: > Have you tried np.lib.io.genfromtxt ? > I didn't know about it, but it has the same problem as loadtxt: In [5]: rdata.block[0,1] # incorrect Out[5]: array([1, 1, 1]) In [6]: alt_data.block[0,1] # same thing, still wrong Out[6]: a

Re: [Numpy-discussion] Nested recarrays with subarrays and loadtxt: a bug in loadtxt?

2009-05-27 Thread Pierre GM
On May 27, 2009, at 5:53 PM, Fernando Perez wrote: > Howdy, > > I'm wondering if the code below illustrates a bug in loadtxt, or just > a 'live with it' limitation. Have you tried np.lib.io.genfromtxt ? dt = dtype(dict(names=['name','x','y','block'], formats=['S4',float,float,(

[Numpy-discussion] Nested recarrays with subarrays and loadtxt: a bug in loadtxt?

2009-05-27 Thread Fernando Perez
Howdy, I'm wondering if the code below illustrates a bug in loadtxt, or just a 'live with it' limitation. I'm inlining it for ease of discussion, but the same code is attached to ensure that anyone willing to look at this can just download and run without pasting/whitespace issues. The code is,

Re: [Numpy-discussion] nested recarrays

2006-12-24 Thread Travis Oliphant
Matthew Koichi Grimes wrote: > (Newbie alert.) > > I'm having trouble making a nested record array. I'm trying to work from > the following example on the scipy.org examples page: > > >>> mydescriptor = dtype([('x', 'f4'),('y', 'f4'), # nested recarray > ... ('nested', [('i', 'i2'),('j','i2')]

[Numpy-discussion] nested recarrays

2006-12-24 Thread Matthew Koichi Grimes
(Newbie alert.) I'm having trouble making a nested record array. I'm trying to work from the following example on the scipy.org examples page: >>> mydescriptor = dtype([('x', 'f4'),('y', 'f4'), # nested recarray ... ('nested', [('i', 'i2'),('j','i2')])]) >>> myarr = array([(1.0, 2.0, (1,2)