
I have sent this out before but here it is again. It is a beta of a missing-observation class. Please help me refine it and complete it. I intend to add it to the numpy distribution since this facility is much-requested. MAtest.py shows how to use it. The intention is that it is used the same way you use a Numeric, and in fact if there are no masked values that there isn't a lot of overhead. The basic concept is that each MA holds an array and a mask that indicates which values of the array are valid. Note the change in semantics for indexing shown below. Later I imagine creating a compiled extension class for bit masks to improve the space and time efficiency. Paul # Note copy semantics here differ from Numeric def __getitem__(self, i): m = self.__mask if m is None: return Numeric.array(self.__data[i]) else: return MA(Numeric.array(self.__data[i]), Numeric.array(m[i])) def __getslice__(self, i, j): m = self.__mask if m is None: return Numeric.array(self.__data[i:j]) else: return MA(Numeric.array(self.__data[i:j]), Numeric.array(m[i:j])) # --------