def test_get(self): "Tests fields retrieval" [d, m, mrec] = self.data assert_equal(mrec.f0, MA.array(d,mask=m)) assert_equal(mrec.f1, MA.array(d[::-1],mask=m[::-1])) assert((mrec._fieldmask == N.core.records.fromarrays([m, m[::-1]])).all()) assert_equal(mrec._mask, N.r_[[m,m[::-1]]].all(0)) assert_equal(mrec.f0, mrec['f0'])
def test_get(self): "Tests fields retrieval" [d, m, mrec] = self.data mrec = mrec.copy() assert_equal(mrec.a, MA.array(d,mask=m)) assert_equal(mrec.b, MA.array(d[::-1],mask=m[::-1])) assert((mrec._fieldmask == N.core.records.fromarrays([m, m[::-1]], dtype=mrec._fieldmask.dtype)).all()) assert_equal(mrec._mask, N.r_[[m,m[::-1]]].all(0)) assert_equal(mrec.a[1], mrec[1].a) # assert(isinstance(mrec[:2], MaskedRecords)) assert_equal(mrec[:2]['a'], d[:2])
def setup(self): "Generic setup" d = N.arange(5) m = MA.make_mask([1,0,0,1,1]) base_d = N.r_[d,d[::-1]].reshape(2,-1).T base_m = N.r_[[m, m[::-1]]].T base = MA.array(base_d, mask=base_m) mrecord = fromarrays(base.T, dtype=[('a',N.float_),('b',N.float_)]) self.data = [d, m, mrecord]
def setup(self): "Generic setup" d = N.arange(5) m = MA.make_mask([1,0,0,1,1]) base_d = N.r_[d,d[::-1]].reshape(2,-1).T base_m = N.r_[[m, m[::-1]]].T base = MA.array(base_d, mask=base_m) mrec = fromarrays(base.T,) self.data = [d, m, mrec]
def setup(self): "Generic setup" d = N.arange(5) m = MA.make_mask([1,0,0,1,1]) base_d = N.r_[d,d[::-1]].reshape(2,-1).T base_m = N.r_[[m, m[::-1]]].T base = MA.array(base_d, mask=base_m) mrec = MR.fromarrays(base.T,) dlist = ['2007-%02i' % (i+1) for i in d] dates = date_array(dlist) ts = time_series(mrec,dates) mts = MultiTimeSeries(mrec,dates) self.data = [d, m, mrec, dlist, dates, ts, mts]