def test_readwriteskymodel(self): im = create_test_image() sm = SkyModel(components=[self.comp], images=[im, im]) export_skymodel_to_hdf5(sm, '%s/test_skymodel.hdf' % self.dir) newsm = import_skymodel_from_hdf5('%s/test_skymodel.hdf' % self.dir) assert newsm.components[0].flux.shape == self.comp.flux.shape assert newsm.images[0].data.shape == im.data.shape assert numpy.max(numpy.abs(newsm.images[0].data - im.data)) < 1e-15
def test_readwriteskymodel(self): self.vis = create_blockvisibility(self.lowcore, self.times, self.frequency, channel_bandwidth=self.channel_bandwidth, phasecentre=self.phasecentre, polarisation_frame=PolarisationFrame("linear"), weight=1.0) im = create_test_image() gt = create_gaintable_from_blockvisibility(self.vis, timeslice='auto') sm = SkyModel(components=[self.comp], image=im, gaintable=gt) export_skymodel_to_hdf5(sm, '%s/test_data_model_helpers_skymodel.hdf' % self.dir) newsm = import_skymodel_from_hdf5('%s/test_data_model_helpers_skymodel.hdf' % self.dir) assert newsm.components[0].flux.shape == self.comp.flux.shape assert newsm.image.data.shape == im.data.shape assert numpy.max(numpy.abs(newsm.image.data - im.data)) < 1e-15
gleam_model = [arlexecute.execute(create_low_test_image_from_gleam)(npixel=npixel, frequency=[frequency[f]], channel_bandwidth=[channel_bandwidth[f]], cellsize=cellsize, phasecentre=phasecentre, polarisation_frame=PolarisationFrame("stokesI"), flux_limit=1.0, applybeam=True) for f, freq in enumerate(frequency)] print('About to make GLEAM model') gleam_model = arlexecute.persist(gleam_model) print('About to run predict to get predicted visibility') vis_list = arlexecute.scatter(vis_list) predicted_vislist = predict_list_arlexecute_workflow(vis_list, gleam_model, context='wstack', vis_slices=vis_slices) predicted_vislist = arlexecute.persist(predicted_vislist) corrupted_vislist = corrupt_list_arlexecute_workflow(predicted_vislist, phase_error=1.0) print('About to run corrupt to get corrupted visibility') corrupted_vislist = arlexecute.persist(corrupted_vislist) corrupted_vislist = arlexecute.compute(corrupted_vislist, sync=True) export_blockvisibility_to_hdf5(corrupted_vislist, 'gleam_simulation_vislist.hdf') gleam_model = arlexecute.compute(gleam_model, sync=True) gleam_skymodel = SkyModel(image=gleam_model) export_skymodel_to_hdf5(gleam_skymodel, 'gleam_simulation_skymodel.hdf') arlexecute.close()
phasecentre=phasecentre, polarisation_frame=PolarisationFrame("stokesI"), flux_limit=3.0, applybeam=True) for f, freq in enumerate(frequency) ] # Put the model on the cluster dprepb_model = arlexecute.persist(dprepb_model) print('About to make GLEAM model') zero_model = [ arlexecute.execute(create_empty_image_like)(im) for im in dprepb_model ] zero_model = arlexecute.compute(zero_model, sync=True) zero_skymodel = SkyModel(images=zero_model) export_skymodel_to_hdf5( zero_skymodel, arl_path('%s/ska-pipeline_simulation_skymodel.hdf' % results_dir)) # In[ ]: # vis_list = arlexecute.scatter(vis_list) wstack = True if wstack: print('Using w stack with %d slices' % vis_slices) predicted_vislist = predict_list_arlexecute_workflow( vis_list, dprepb_model, context='wstack', vis_slices=vis_slices) else: print('Using timeslicing with %d slices' % ntimes) predicted_vislist = predict_list_arlexecute_workflow( vis_list, dprepb_model, context='timeslice', vis_slices=ntimes)