def test_griddata_predict_awterm(self): self.actualSetUp(zerow=False, image_pol=PolarisationFrame("stokesIQUV")) modelIQUV = convert_stokes_to_polimage(self.model, self.vis.polarisation_frame) make_pb = functools.partial(create_pb_generic, diameter=35.0, blockage=0.0, use_local=False) pb = make_pb(modelIQUV) if self.persist: export_image_to_fits(pb, "%s/test_gridding_awterm_pb.fits" % self.dir) gcf, cf = create_awterm_convolutionfunction(self.model, make_pb=make_pb, nw=100, wstep=8.0, oversampling=16, support=32, use_aaf=True) griddata = create_griddata_from_image(modelIQUV, self.vis, nw=100, wstep=8.0) griddata = fft_image_to_griddata(modelIQUV, griddata, gcf) newvis = degrid_visibility_from_griddata(self.vis, griddata=griddata, cf=cf) qa = qa_visibility(newvis) assert qa.data['rms'] < 160.0, str(qa) self.plot_vis(newvis, 'awterm')
def test_griddata_predict_box(self): self.actualSetUp(zerow=True, image_pol=PolarisationFrame("stokesIQUV")) gcf, cf = create_box_convolutionfunction(self.model) modelIQUV = convert_stokes_to_polimage(self.model, self.vis.polarisation_frame) griddata = create_griddata_from_image(modelIQUV, self.vis) griddata = fft_image_to_griddata(modelIQUV, griddata, gcf) newvis = degrid_visibility_from_griddata(self.vis, griddata=griddata, cf=cf) newvis.data['vis'][...] -= self.vis.data['vis'][...] qa = qa_visibility(newvis) assert qa.data['rms'] < 58.0, str(qa)
def test_stokes_conversion(self): assert self.m31image.polarisation_frame == PolarisationFrame("stokesI") stokes = create_test_image( cellsize=0.0001, polarisation_frame=PolarisationFrame("stokesIQUV")) assert stokes.polarisation_frame == PolarisationFrame("stokesIQUV") for pol_name in ['circular', 'linear']: polarisation_frame = PolarisationFrame(pol_name) polimage = convert_stokes_to_polimage( stokes, polarisation_frame=polarisation_frame) assert polimage.polarisation_frame == polarisation_frame polarisation_frame_from_wcs(polimage.wcs, polimage.shape) rstokes = convert_polimage_to_stokes(polimage) assert polimage.data.dtype == 'complex' assert rstokes.data.dtype == 'complex' numpy.testing.assert_array_almost_equal(stokes.data, rstokes.data.real, 12)
def test_griddata_predict_wterm(self): self.actualSetUp(zerow=False, image_pol=PolarisationFrame("stokesIQUV")) gcf, cf = create_awterm_convolutionfunction(self.model, nw=100, wstep=10.0, oversampling=16, support=32, use_aaf=True) modelIQUV = convert_stokes_to_polimage(self.model, self.vis.polarisation_frame) griddata = create_griddata_from_image(modelIQUV, self.vis) griddata = fft_image_to_griddata(modelIQUV, griddata, gcf) newvis = degrid_visibility_from_griddata(self.vis, griddata=griddata, cf=cf) newvis.data['vis'][...] -= self.vis.data['vis'][...] qa = qa_visibility(newvis) self.plot_vis(newvis, 'wterm') assert qa.data['rms'] < 11.0, str(qa)