def test_clean_map(self): script = [] expected_maps = commands.clean(script, vis_paths=self.testvis_single, out_dir=self.output_dir + '/clean_map', niter=500, threshold_in_jy=0.2 / 1000., mask='', other_clean_args=self.clean_args, overwrite=True) print expected_maps # Manually ensure target does not pre-exist for map in expected_maps: if os.path.isdir(map): shutil.rmtree(map) # Test in usual case, not-preexisting casa_out, errs = self.casa.run_script(script) print '\n'.join(casa_out) self.assertTrue(os.path.isdir(expected_maps.image))
def test_multivis_clean_map(self): script = [] expected_maps = commands.clean(script, vis_paths=self.testvis_multiple, out_dir=self.output_dir+'/mvclean_map', niter=500, threshold_in_jy=0.2 / 1000., mask='', other_clean_args=self.clean_args, overwrite=True) print expected_maps # Manually ensure target does not pre-exist for map in expected_maps: if os.path.isdir(map): shutil.rmtree(map) # Test in usual case, not-preexisting casa_out, errs = self.casa.run_script(script) print '\n'.join(casa_out) self.assertTrue(os.path.isdir(expected_maps.image))
import drivecasa import drivecasa.commands as commands from drivecasa.utils import ensure_dir output_dir = './simulation_output' ensure_dir(output_dir) commands_logfile = os.path.join(output_dir, "./casa-clean-commands.log") output_visibility = os.path.join(output_dir, './foovis.ms') # output_visibility = os.path.join(output_dir, './vla-sim.MS') output_image = os.path.join(output_dir, './foo') if os.path.isfile(commands_logfile): os.unlink(commands_logfile) casa = drivecasa.Casapy(commands_logfile=commands_logfile, echo_to_stdout=True, ) script = [] clean_args = { "imsize": [512, 512], "cell": ['3.5arcsec'], } outmaps = commands.clean(script, output_visibility, niter=100, threshold_in_jy=1e-5, out_path=output_image, other_clean_args=clean_args, overwrite=True) commands.export_fits(script, outmaps.image, overwrite=True) casa.run_script(script)
output_dir = './simulation_output' ensure_dir(output_dir) commands_logfile = os.path.join(output_dir, "./casa-clean-commands.log") output_visibility = os.path.join(output_dir, './foovis.ms') # output_visibility = os.path.join(output_dir, './vla-sim.MS') output_image = os.path.join(output_dir, './foo') if os.path.isfile(commands_logfile): os.unlink(commands_logfile) casa = drivecasa.Casapy( commands_logfile=commands_logfile, echo_to_stdout=True, ) script = [] clean_args = { "imsize": [512, 512], "cell": ['3.5arcsec'], } outmaps = commands.clean(script, output_visibility, niter=100, threshold_in_jy=1e-5, out_path=output_image, other_clean_args=clean_args, overwrite=True) commands.export_fits(script, outmaps.image, overwrite=True) casa.run_script(script)