Re: [Numpy-discussion] "Slicing" recarrays

2006-11-09 Thread Christopher Barker
Travis Oliphant wrote: > How about > > newdtype = N.dtype([('both','2i4'),('','b1')]) > res = data.view(newdtype)['both'] That works great! thanks, -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voic

Re: [Numpy-discussion] "Slicing" recarrays

2006-11-07 Thread Travis Oliphant
Christopher Barker wrote: >Hi all, > >I'm using a recarray to read a bunch of binary data out of a file. It's >working great, but it seems there should be a more efficient way to >"slice" the data. Here's what I've got: > >The binary data is essentially a dump of a 2-d array of structs. So I >r

[Numpy-discussion] "Slicing" recarrays

2006-11-07 Thread Christopher Barker
Hi all, I'm using a recarray to read a bunch of binary data out of a file. It's working great, but it seems there should be a more efficient way to "slice" the data. Here's what I've got: The binary data is essentially a dump of a 2-d array of structs. So I read it like this: DataType = N.dty