[Numpy-discussion] A reimplementation of MaskedArray + MaskedRecords

2006-10-22 Thread P GM
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 M

[Numpy-discussion] Stefan van der Walt <[EMAIL PROTECTED]>

2006-10-19 Thread P GM
> > >class InfoArray(N.ndarray):> > >    def __new__(info_arr_cls,arr,info={}):> > >    info_arr_cls.info = info> > >    return N.array(arr).view(info_arr_cls)> > One has to be careful of this approach.  It ads *the same* information> to all arrays, i.e.Indeed. That's basically why you have

[Numpy-discussion] putmask/take ?

2006-09-21 Thread P GM
Folks,I'm running into the following problem with putmask on take. >>> import numpy>>> x = N.arange(12.)>>> m = [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1]>>> i = N.nonzero (m)[0]>>> w = N.array([-1, -2, -3, -4.])>>> x.putmask(w,m)>>> x.take(i)>>> N.allclose(x.take(i),w)FalseI'm wondering ifit is intentio