A reimplementation of MaskedArray + MaskedRecords

Pierre GM pgmdevlist at mailcan.com
Mon Oct 23 00:21:56 EDT 2006


Folks,
I updated the alternative implementation of MaskedArray on the wiki, mainly to 
correct a couple of bugs. 
(http://projects.scipy.org/scipy/numpy/wiki/MaskedArray)

In addition, I attached another file, maskedrecordarray, which introduce a new 
class, MaskedRecord, as a subclass of recarray and MaskedArray. An instance 
of this class accepts a recarray as data, and uses two masks: the 
'recordmask' has as many entries as records in the array, each entry with the 
same fields as a record, but of boolean types, indicating whether a field is 
masked or not; an entry is flagged as masked in the 'mask' array if at least 
one field is masked. The 'mask' object is introduced mostly for compatibilty 
with MaskedArray, only 'recordmask' is really useful.

A few examples in the file should give you an idea of what can be done. In 
particular, you can define a new maskedrecord array as simply as ;
a = masked_record([('Alan',29,200.), ('Bill',31,260.0)], 
dtype=[('name','S30'),('age',int_),('weight',float_)], mask=[(1,0,0), 
(0,0,0)])

Note that maskedrecordarray is still quite experimental. As I'm not a regular 
user of records, I don't really know what should be implemented... The file 
can be accessed at
http://projects.scipy.org/scipy/numpy/attachment/wiki/MaskedArray/maskedrecordarray.py

Once again, I need your comments and suggestions !

Thanks.
Pierre

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642




More information about the NumPy-Discussion mailing list