Source
xxxxxxxxxx
3807
3807
self.add_mask()
3808
3808
self.run_apply_test()
3809
3809
3810
3810
def test052(self):
3811
3811
# blmode='apply', spw to flag channels 4500-6499
3812
3812
self.params['spw'] = self.spw
3813
3813
self.run_apply_test()
3814
3814
3815
3815
def run_clipping_test(self):
3816
3816
# set artificial spectra (flat+outlier) in input MS
3817
+
OUTLIER_CHANNEL = 4000
3818
+
OUTLIER_VALUE = 100000000.0
3817
3819
with table_manager(self.infile, nomodify=False) as tb:
3818
3820
spec = tb.getcell('FLOAT_DATA', 0) # row 0, shape = (npol, nchan)
3819
3821
# flat spectrum with (mean, sigma) = (0, 1)
3820
3822
spec[:, 0::2] = 1.0
3821
3823
spec[:, 1::2] = -1.0
3822
-
# an outlier
3823
-
spec[:, 4000] = 100000000.0
3824
+
spec[:, OUTLIER_CHANNEL] = OUTLIER_VALUE
3824
3825
tb.putcell('FLOAT_DATA', 0, spec)
3825
3826
3826
3827
flag = tb.getcell('FLAG', 0) # row 0
3827
3828
flag.fill(False)
3828
3829
tb.putcell('FLAG', 0, flag)
3829
3830
3830
3831
# compute the reference weight value
3831
-
flag[:, 4000] = True
3832
+
flag[:, OUTLIER_CHANNEL] = True
3832
3833
mdata = np.ma.masked_array(spec, mask=flag)
3833
3834
weight_ref = 1.0 / np.var(mdata, axis=1)
3834
3835
3835
3836
sdbaseline(**self.params)
3836
3837
3837
3838
# value checking
3838
3839
# the weight values in the output MS should be close to 1
3839
3840
# if the outlier channel is correctly eliminated by iterative clipping.
3840
3841
# if clipping result is not taken into account when computing weights,
3841
3842
# the weight should be a very small value (~ 8 * 10^-13)