def test_channels(self): self.Data.data[...] = 10 self.DataSub.data[...] = 10 + rand.rand(*self.Data.data.shape) self.DataSub.data[:,:,:,123] = 10 + 6*rand.rand( *self.Data.data.shape[:-1]) self.DataSub.data[:,:,:,54] += 10 reflag.flag(self.Data, self.DataSub, thres=2.0, max_noise_factor=3) self.assertTrue(sp.all(self.Data.data.mask[:,:,:,123])) self.assertFalse(sp.all(self.Data.data.mask[:,:,:,54]))
def test_channels(self): self.Data.data[...] = 10 self.DataSub.data[...] = 10 + rand.rand(*self.Data.data.shape) self.DataSub.data[:, :, :, 123] = 10 + 6 * rand.rand(*self.Data.data.shape[:-1]) self.DataSub.data[:, :, :, 54] += 10 reflag.flag(self.Data, self.DataSub, thres=2.0, max_noise_factor=3) self.assertTrue(sp.all(self.Data.data.mask[:, :, :, 123])) self.assertFalse(sp.all(self.Data.data.mask[:, :, :, 54]))
def test_flags(self) : self.Data.data[...] = 10 self.Data.data[4, 0, 0, 235] = 100 nf = self.Data.dims[-1] self.DataSub.data[0::2, :, :, :] = sp.arange(1, nf+1) self.DataSub.data[1::2, :, :, :] = 0 self.DataSub.data[3, 0, 0, 458] = 2*458 self.DataSub.data[3, 0, 0, 986] = 2*986 self.DataSub.data[8, 0, 1, 734] = 2*734 reflag.flag(self.Data, self.DataSub, thres=2.0) self.assertTrue(self.Data.data[3, 0, 0, 458] is ma.masked) self.assertTrue(self.Data.data[3, 0, 0, 986] is ma.masked) self.assertTrue(self.Data.data[8, 0, 1, 734] is ma.masked) self.assertEqual(ma.count_masked(self.Data.data), 3) self.assertEqual(ma.count_masked(self.DataSub.data), 3)
def test_flags(self): self.Data.data[...] = 10 self.Data.data[4, 0, 0, 235] = 100 nf = self.Data.dims[-1] self.DataSub.data[0::2, :, :, :] = sp.arange(1, nf + 1) self.DataSub.data[1::2, :, :, :] = 0 self.DataSub.data[3, 0, 0, 458] = 2 * 458 self.DataSub.data[3, 0, 0, 986] = 2 * 986 self.DataSub.data[8, 0, 1, 734] = 2 * 734 reflag.flag(self.Data, self.DataSub, thres=2.0) self.assertTrue(self.Data.data[3, 0, 0, 458] is ma.masked) self.assertTrue(self.Data.data[3, 0, 0, 986] is ma.masked) self.assertTrue(self.Data.data[8, 0, 1, 734] is ma.masked) self.assertEqual(ma.count_masked(self.Data.data), 3) self.assertEqual(ma.count_masked(self.DataSub.data), 3)
def test_runs(self) : reflag.flag(self.Data, self.DataSub, thres=3)
def test_runs(self): reflag.flag(self.Data, self.DataSub, thres=3)