Commits

Takahiro Tsutsumi authored 17af34fa0a2
Modified the unit tests and added two more. Added a new value check

parameter (firstcyclethresh) to checkall in imagetestheper
No tags

casatasks/tests/tasks/test_tclean.py

Modified
900 900 ret=self.th.mergeParaCubeResults(retpar, ['iterdone', 'nmajordone', 'stopcode'])
901 901 else:
902 902 ret=retpar
903 903
904 904 report=self.th.checkall(ret=ret,iterdone=407,nmajordone=11,stopcode=8,imgexist=[self.img+'.psf', self.img+'.residual'])
905 905
906 906 self.assertTrue(self.check_final(report))
907 907
908 908
909 909 def test_iterbot_mfs_restart_updatedmask(self):
910 - """ [iterbot] Test_mfs_restart_updatedmask : restart mfs with an updated mask (CAS-13508 fix) """
910 + """ [iterbot] Test_mfs_restart_updatedmask : restart mfs with an updated mask (CAS-13508 fix verification) """
911 911 self.prepData('refim_twopoints_twochan.ms')
912 912 tclean(vis=self.msfile,imagename=self.img,imsize=512,cell='8.0arcsec',specmode='mfs',deconvolver='hogbom',niter=2,parallel=self.parallel)
913 913 os.system('rm -rf '+self.img+'.mask')
914 914
915 915 # Create a new mask around the 1Jy source only.
916 916 mask_around_dim_source='circle[[256pix,256pix],30pix]'
917 917 makemask(inpimage=self.img+'.residual', inpmask=mask_around_dim_source, output=self.img+'.mask.dim.source',overwrite=True,mode='copy')
918 918 mask_around_dim_source=self.img+'.mask.dim.source'
919 919
920 920 # 2nd clean with the updated mask
921 921 retpar=tclean(vis=self.msfile, imagename=self.img,imsize=512,cell='8.0arcsec',specmode='mfs',niter=1,calcres=False, calcpsf=False, restart=True, mask=mask_around_dim_source, interactive=0,parallel=self.parallel)
922 922
923 923 ret={}
924 924 if self.parallel:
925 925 ret=self.th.mergeParaCubeResults(retpar, ['iterdone', 'nmajordone', 'stopcode'])
926 926 else:
927 927 ret=retpar
928 928
929 929 # check initial cyclethreshold
930 930 # true value: 0.14600408
931 - report=self.th.checkall(ret=ret,imgexist=[self.img+'.psf', self.img+'.residual'], firstcyclethresh=0.14600408)
931 + report=self.th.checkall(ret=ret,imgexist=[self.img+'.psf', self.img+'.residual'], imgval=[(self.img+'.model',0.200,[256,256,0,0])], firstcyclethresh=0.14600408)
932 + #report=self.th.checkall(ret=ret,imgexist=[self.img+'.psf', self.img+'.residual'], imgval=[(self.img+'.model',0.200,[256,256,0,0])], firstcyclethresh=0.55600408)
933 + self.assertTrue(self.check_final(report))
934 +
935 + def test_iterbot_cube_restart_updatedmask(self):
936 + """ [iterbot] Test_cube_restart_updatedmask : restart cube with an updated mask (CAS-13508 fix verification) """
937 + self.prepData('refim_twopoints_twochan.ms')
938 + tclean(vis=self.msfile,imagename=self.img,imsize=512,cell='8.0arcsec',specmode='cube',deconvolver='hogbom',niter=4,parallel=self.parallel)
939 + os.system('rm -rf '+self.img+'.mask')
940 +
941 + # Create a new mask around the 1Jy source only.
942 + mask_around_dim_source='circle[[256pix,256pix],30pix]'
943 + makemask(inpimage=self.img+'.residual', inpmask=mask_around_dim_source, output=self.img+'.mask.dim.source',overwrite=True,mode='copy')
944 + mask_around_dim_source=self.img+'.mask.dim.source'
945 +
946 + # 2nd clean with the updated mask
947 + retpar=tclean(vis=self.msfile, imagename=self.img,imsize=512,cell='8.0arcsec',specmode='cube',niter=10,calcres=False, calcpsf=False, restart=True, mask=mask_around_dim_source, interactive=0,parallel=self.parallel)
948 +
949 + ret={}
950 + if self.parallel:
951 + ret=self.th.mergeParaCubeResults(retpar, ['iterdone', 'nmajordone', 'stopcode'])
952 + else:
953 + ret=retpar
954 +
955 + # check initial cyclethreshold
956 + # true value:
957 + # 0.68944335
958 + report=self.th.checkall(ret=ret,imgexist=[self.img+'.psf', self.img+'.residual'], imgval=[(self.img+'.model',0.83,[256,256,0,0]),(self.img+'.model', 0.27, [256,256,0,1])], firstcyclethresh=0.68944335)
932 959
933 960 self.assertTrue(self.check_final(report))
934 961
962 +
935 963 def test_iterbot_mfs_restart_pbmask(self):
936 - """ [iterbot] Test_mfs_restart_updatedmask : restart mfs with pbmask (CAS-13508 fix) """
964 + """ [iterbot] Test_mfs_restart_updatedmask : restart mfs with pbmask (CAS-13508 fix verification) """
937 965 self.prepData('refim_twopoints_twochan.ms')
938 966 tclean(vis=self.msfile,imagename=self.img,imsize=512,cell='8.0arcsec',specmode='mfs',deconvolver='hogbom',niter=2,parallel=self.parallel)
939 967 os.system('rm -rf '+self.img+'.mask')
940 968
941 969 # 2nd clean with pbmask
942 - retpar=tclean(vis=self.msfile, imagename=self.img,imsize=512,cell='8.0arcsec',specmode='mfs',niter=1,calcres=False, calcpsf=False, restart=True, usemask='pb', pbmask=0.7, interactive=0,parallel=self.parallel)
970 + retpar=tclean(vis=self.msfile, imagename=self.img,imsize=512,cell='8.0arcsec',specmode='mfs',niter=1,calcres=False, calcpsf=False, restart=True, usemask='pb', pbmask=0.8, interactive=0,parallel=self.parallel)
943 971
944 972 ret={}
945 973 if self.parallel:
946 974 ret=self.th.mergeParaCubeResults(retpar, ['iterdone', 'nmajordone', 'stopcode'])
947 975 else:
948 976 ret=retpar
949 977
950 978 # check initial cyclethreshold
951 979 # true value: 0.14600408
952 - report=self.th.checkall(ret=ret,imgexist=[self.img+'.psf', self.img+'.residual'], firstcyclethresh=0.1460498)
980 + report=self.th.checkall(ret=ret,imgexist=[self.img+'.psf', self.img+'.residual'], imgval=[(self.img+'.model',0.20,[256,256,0,0])], firstcyclethresh=0.1460498)
981 +
982 + self.assertTrue(self.check_final(report))
983 +
984 + def test_iterbot_cube_restart_pbmask(self):
985 + """ [iterbot] Test_cube_restart_updatedmask : restart cube with pbmask (CAS-13508 fix verification) """
986 + self.prepData('refim_twopoints_twochan.ms')
987 + tclean(vis=self.msfile,imagename=self.img,imsize=512,cell='8.0arcsec',specmode='cube',deconvolver='hogbom',niter=4,parallel=self.parallel)
988 + os.system('rm -rf '+self.img+'.mask')
989 +
990 + # 2nd clean with pbmask
991 + retpar=tclean(vis=self.msfile, imagename=self.img,imsize=512,cell='8.0arcsec',specmode='cube',niter=10,calcres=False, calcpsf=False, restart=True, usemask='pb', pbmask=0.8, interactive=0,parallel=self.parallel)
992 +
993 + ret={}
994 + if self.parallel:
995 + ret=self.th.mergeParaCubeResults(retpar, ['iterdone', 'nmajordone', 'stopcode'])
996 + else:
997 + ret=retpar
998 +
999 + # check initial cyclethreshold
1000 + # true value:0.68944335
1001 + report=self.th.checkall(ret=ret,imgexist=[self.img+'.psf', self.img+'.residual'], imgval=[(self.img+'.model',0.37,[256,256,0,0]),(self.img+'.model', 0.15, [256,256,0,1])],firstcyclethresh=0.68944335)
953 1002
954 1003 self.assertTrue(self.check_final(report))
955 1004 ##############################################
956 1005 ##############################################
957 1006 ##############################################
958 1007
959 1008 ##Task level tests : multi-field, 2chan.
960 1009 ### For some of these tests, do the same with uvsub and compare ?
961 1010 class test_multifield(testref_base):
962 1011

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut