def test_read_all(self): ms_list = ["vis/3C277.1C.16channels.ms", "vis/ASKAP_example.ms", "vis/sim-1.ms", "vis/sim-2.ms", "vis/xcasa.ms"] for ms in ms_list: vis_list = create_blockvisibility_from_ms(rascil_data_path(ms)) assert isinstance(vis_list[0], BlockVisibility)
def test_copy_ms(self): if run_ms_tests == False: return msfile = rascil_path("data/vis/ASKAP_example.ms") msoutfile = rascil_path("test_results/test_export_ms_ASKAP_output.ms") v = create_blockvisibility_from_ms(msfile) export_blockvisibility_to_ms( msoutfile, v) # vis_by_channel.append(integrate_visibility_by_channel(v[0]))
def test_create_list(self): if not self.casacore_available: return msfile = rascil_path("data/vis/xcasa.ms") self.vis = create_blockvisibility_from_ms(msfile) for v in self.vis: assert v.vis.data.shape[-1] == 4 assert v.polarisation_frame.type == "circular"
def test_create_list_slice(self): if not self.casacore_available: return msfile = rascil_path("data/vis/ASKAP_example.ms") vis_by_channel = list() nchan_ave = 16 nchan = 192 for schan in range(0, nchan, nchan_ave): max_chan = min(nchan, schan + nchan_ave) v = create_blockvisibility_from_ms(msfile, start_chan=schan, end_chan=max_chan - 1) assert v[0].vis.shape[-2] == nchan_ave vis_by_channel.append(v[0]) assert len(vis_by_channel) == 12 for v in vis_by_channel: assert v.vis.data.shape[-1] == 4 assert v.polarisation_frame.type == "linear"
def test_create_list_spectral_average(self): if not self.casacore_available: return msfile = rascil_path("data/vis/ASKAP_example.ms") vis_by_channel = list() nchan_ave = 16 nchan = 192 for schan in range(0, nchan, nchan_ave): max_chan = min(nchan, schan + nchan_ave) v = create_blockvisibility_from_ms(msfile, range(schan, max_chan), average_channels=True) vis_by_channel.append(v[0]) assert len(vis_by_channel) == 12 for v in vis_by_channel: assert v.vis.data.shape[-1] == 4 assert v.vis.data.shape[-2] == 1 assert v.polarisation_frame.type == "linear" assert numpy.max(numpy.abs(v.vis)) > 0.0 assert numpy.max(numpy.abs(v.flagged_vis)) > 0.0
lat=42.211833333 * u.deg, height=1365.0 * u.m) # conf_dir = muser_path('configurations') # antfile = os.path.join(conf_dir, 'muser-1.csv') # lowcore = create_configuration_from_file(antfile=antfile, # mount='altaz', names='MUSER_%d', # diameter=2.0, name='MUSER', location=location) msfile = muser_output_path("ms_flag_test.ms") # msfile = muser_output_path("CSRH_20151122-125000_100457483.ms") # msfile = muser_output_path("selfmodel.ms") ch = numpy.arange(1) vis = create_blockvisibility_from_ms(msfile) #, start_chan=52,end_chan=52) bvis = vis[0] from rascil.processing_components.flagging.operations import flagging_blockvisibility, flagging_blockvisibility_with_bl # bvis = flagging_blockvisibility(vis[0], antenna=[8,9,10,11,27]) # baseline = [ [4,0],[4,1],[5,4],[21,4],[24,4],[25,4],[26,4],[27,4],[28,4],[29,4],[30,4],[31,4],[32,4],[36,4],[38,4],[39,4]] # baseline.append([[17,4],[17,13],[19,17],[26,17],[27,17],[28,17],[29,17],[30,17],[31,17],[39,17]]) # bvis = flagging_blockvisibility_with_bl(vis[0],baseline) # # vis_list = [] # vis_list.append(bvis) # # Output results # export_file_name = muser_output_path('ms_flag_test') + '.ms' # # export_blockvisibility_to_ms(export_file_name, vis_list, source_name='SUN')
def test_read_not_ms(self): with self.assertRaises(RuntimeError): ms = "vis/ASKAP_example.fits" vis_list = create_blockvisibility_from_ms(rascil_data_path(ms)) assert isinstance(vis_list[0], BlockVisibility)
import logging log = logging.getLogger('logger') log.setLevel(logging.DEBUG) log.addHandler(logging.StreamHandler(sys.stdout)) log.addHandler(logging.StreamHandler(sys.stderr)) if __name__ == '__main__': results_dir = rascil_path('test_results') # Test requires that casa be installed try: bvt = create_blockvisibility_from_ms(rascil_data_path('vis/sim-2.ms'), channum=[35, 36, 37, 38, 39])[0] bvt.configuration.diameter[...] = 35.0 vt = convert_blockvisibility_to_visibility(bvt) vt = convert_visibility_to_stokes(vt) cellsize = 20.0 * numpy.pi / (180.0 * 3600.0) npixel = 512 model = create_image_from_visibility( vt, cellsize=cellsize, npixel=npixel, polarisation_frame=PolarisationFrame('stokesIQUV')) dirty, sumwt = invert_list_serial_workflow([vt], [model], context='2d')[0] psf, sumwt = invert_list_serial_workflow([vt], [model],