[Numpy-discussion] masked record arrays

Thomas Robitaille thomas.robitaille at gmail.com
Sat Nov 7 14:26:54 EST 2009



Pierre GM-2 wrote:
> 
> Mmh. With a recent (1.3) version of numpy, you should already be able  
> to mask individual fields of a structured array without problems. If  
> you need fields to be accessed as attributes the np.recarray way, you  
> can give numpy.ma.mrecords.MaskedRecords a try. It's been a while I  
> haven't touched it, so you may run into the occasional bug. FYI, I'm  
> not a big fan of record arrays and tend to prefer structured ones...
> What two implementations were you talking about ?
> In any case, feel free to try and please, report any issue you run  
> into with MaskedRecords.
> Cheers
> 

Thanks for the advice! I'm somewhat confused by the difference between
structured and record arrays. My understanding is that record arrays allow
you to access fields by attribute (e.g. r.field_name), but I imagine that
there are much more fundamental differences for the two to be treated
separately in numpy. I find the numpy documentation somewhat confusing in
that respect - if you have a look at this page

http://docs.scipy.org/doc/numpy/user/basics.rec.html

I think the 'aka record arrays' is especially confusing as this would
suggest the two are the same. So is there good information anywhere about
what exactly are the differences between the two? This page is also
confusing:

http://docs.scipy.org/doc/numpy/reference/generated/numpy.recarray.html

as to me "Construct an ndarray that allows field access using attributes"
suggests that all a recarray is is an ndarray/structured array with
overloaded __getattr__/__setattr__ methods. Is that all recarrays are? If
so, why was a completely separate package developed for masked record arrays
- can one not just use masked structured arrays and overload
getattr/setattr?

Cheers,

Thomas

-- 
View this message in context: http://old.nabble.com/masked-record-arrays-tp26237612p26247808.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.




More information about the NumPy-Discussion mailing list