Source
xxxxxxxxxx
3306
3306
self.assertTrue(self.cache_validator.validate())
3307
3307
3308
3308
def __clear_up(self):
3309
3309
for data in self.data_list:
3310
3310
if os.path.exists(data):
3311
3311
shutil.rmtree(data)
3312
3312
outfile = self.outfile + image_suffix
3313
3313
if os.path.exists(outfile):
3314
3314
shutil.rmtree(outfile)
3315
3315
shutil.rmtree(self.outfile + '.weight')
3316
+
shutil.rmtree(self.outfile + '.sumwt')
3316
3317
#shutil.rmtree(self.outfile + '.psf') #CAS-10893: uncomment once true PSF image is available
3317
3318
outfile_ref = self.outfile_ref + image_suffix
3318
3319
if os.path.exists(outfile_ref):
3319
3320
shutil.rmtree(outfile_ref)
3320
3321
shutil.rmtree(self.outfile_ref + '.weight')
3322
+
shutil.rmtree(self.outfile_ref + '.sumwt')
3321
3323
#shutil.rmtree(self.outfile_ref + '.psf') #CAS-10893: uncomment once true PSF image is available
3322
3324
3323
3325
def _test_clipping(self, infiles, is_clip_effective=True):
3324
3326
if isinstance(infiles, str):
3325
3327
self._test_clipping([infiles], is_clip_effective)
3326
3328
return
3327
3329
3328
3330
for infile in infiles:
3329
3331
self.assertTrue(infile in self.data_list)
3330
3332
self.assertFalse(os.path.exists(infile))
3700
3702
'sum': numpy.array([ 33078.99737787]),
3701
3703
'sumsq': numpy.array([ 319751.35842591]),
3702
3704
'trc': numpy.array([74, 74, 0, 0], dtype=numpy.int32),
3703
3705
'trcf': '17:03:03.322, +61.19.09.669, I, 1.42087e+09Hz'
3704
3706
}
3705
3707
self.run_test_common(self.task_param, refstats, outshape,
3706
3708
compstats=self.keys, ignoremask=False,
3707
3709
projection=projection)
3708
3710
3709
3711
3710
-
class sdimaging_test_misc(sdimaging_unittest_base):
3712
+
class sdimaging_test_output(sdimaging_unittest_base):
3711
3713
"""
3712
-
Tests to check if only appropriate images are output from tsdimaging
3714
+
Tests to check if only appropriate images are output
3713
3715
"""
3714
-
#datapath = os.environ.get('CASAPATH').split()[0] + '/data/regression/unittest/sdimaging/'
3715
3716
params = dict(infiles = ['selection_misc.ms'],
3716
3717
outfile = "outmisc",
3717
3718
imsize = [80,80], # to suppress warning messages
3718
3719
intent = '')
3719
3720
outfile = params['outfile']
3720
3721
3721
3722
def __remove_table(self, f):
3722
3723
if os.path.exists(f):
3723
3724
shutil.rmtree(f)
3724
3725
3740
3741
3741
3742
self.assertTrue(self.cache_validator.validate())
3742
3743
3743
3744
def run_test(self, **kwargs):
3744
3745
self.params.update(**kwargs)
3745
3746
status = sdimaging(**self.params)
3746
3747
self.assertIsNone(status, msg = 'sdimaging failed to execute')
3747
3748
outfile = self.outfile + image_suffix
3748
3749
self.assertTrue(os.path.exists(outfile), msg='output image is not created.')
3749
3750
3750
-
# a test to verify CAS-10893 and CAS-10891
3751
-
def test_output_no_psf_no_sumwt(self):
3752
-
"""test_no_psf_no_sumwt: Check if only .image and .weight images are output."""
3751
+
# a test to verify CAS-10893
3752
+
def test_output_no_psf(self):
3753
+
"""test_no_psf: Check if .psf is no longer output."""
3753
3754
os.system('rm -rf %s*'%(self.outfile))
3754
3755
self.run_test()
3755
3756
3756
3757
# check data that must be output
3757
-
for suffix in ['.image', '.weight']:
3758
+
for suffix in ['.image', '.weight', '.sumwt']:
3758
3759
self.assertTrue(os.path.exists(self.outfile+suffix), msg=suffix+' not found.')
3759
3760
# check data that must not be output
3760
-
for suffix in ['.sumwt', '.psf']:
3761
+
for suffix in ['.psf']:
3761
3762
self.assertFalse(os.path.exists(self.outfile+suffix), msg=suffix+' exists though it should not.')
3762
3763
3763
3764
3764
3765
"""
3765
3766
# utility for sdimaging_test_mapextent
3766
3767
# commented out since sd tool is no longer available in CASA (CAS-10301)
3767
3768
def get_mapextent(infile, scan=None):
3768
3769
s = sd.scantable(infile, average=False)
3769
3770
outfile = infile.rstrip('/') + '.tmp'
3770
3771
try:
3850
3851
sdimaging_test_selection,
3851
3852
sdimaging_test_flag,
3852
3853
sdimaging_test_polflag,
3853
3854
sdimaging_test_mslist,
3854
3855
sdimaging_test_restfreq,
3855
3856
sdimaging_test_mapextent,
3856
3857
sdimaging_test_ephemeris,
3857
3858
sdimaging_test_interp,
3858
3859
sdimaging_test_clipping,
3859
3860
sdimaging_test_projection,
3860
-
sdimaging_test_misc
3861
+
sdimaging_test_output
3861
3862
]
3862
3863
3863
3864
if is_CASA6:
3864
3865
if __name__ == '__main__':
3865
3866
unittest.main()