def test_griddata_predict_box(self):
     self.actualSetUp(zerow=True)
     gcf, cf = create_box_convolutionfunction(self.model)
     griddata = create_griddata_from_image(self.model)
     griddata = fft_image_to_griddata(self.model, 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'] < 46.0, str(qa)
 def test_griddata_invert_fast(self):
     self.actualSetUp(zerow=True)
     gcf, cf = create_box_convolutionfunction(self.model)
     griddata = create_griddata_from_image(self.model)
     griddata, sumwt = grid_visibility_to_griddata(self.vis, griddata=griddata, cf=cf)
     im = fft_griddata_to_image(griddata, gcf)
     im = normalize_sumwt(im, sumwt)
     export_image_to_fits(im, '%s/test_gridding_dirty_fast.fits' % self.dir)
     self.check_peaks(im, 96.74492791536595, tol=1e-7)
Ejemplo n.º 3
0
 def test_griddata_invert_box(self):
     self.actualSetUp(zerow=True)
     gcf, cf = create_box_convolutionfunction(self.model)
     griddata = create_griddata_from_image(self.model)
     griddata, sumwt = grid_visibility_to_griddata(self.vis, griddata=griddata, cf=cf)
     im = fft_griddata_to_image(griddata, gcf)
     im = normalize_sumwt(im, sumwt)
     if self.persist:
         export_image_to_fits(im, '%s/test_gridding_dirty_box.fits' % self.dir)
     self.check_peaks(im, 97.11833094588997, tol=1e-7)
Ejemplo n.º 4
0
 def test_griddata_weight(self):
     self.actualSetUp(zerow=True)
     gcf, cf = create_box_convolutionfunction(self.model)
     gd = create_griddata_from_image(self.model)
     gd_list = [grid_weight_to_griddata(self.vis, gd, cf) for i in range(10)]
     gd, sumwt = griddata_merge_weights(gd_list, algorithm='uniform')
     self.vis = griddata_reweight(self.vis, gd, cf)
     gd, sumwt = grid_visibility_to_griddata(self.vis, griddata=gd, cf=cf)
     im = fft_griddata_to_image(gd, gcf)
     im = normalize_sumwt(im, sumwt)
     if self.persist:
         export_image_to_fits(im, '%s/test_gridding_dirty_2d_uniform.fits' % self.dir)
     self.check_peaks(im, 99.42031190701735)
    def test_fill_box_to_convolutionfunction(self):
        gcf, cf = create_box_convolutionfunction(self.image)
        assert numpy.max(numpy.abs(cf.data)) > 0.0
        export_image_to_fits(
            gcf, "%s/test_convolutionfunction_box_gcf.fits" % self.dir)

        cf_image = convert_convolutionfunction_to_image(cf)
        cf_image.data = numpy.real(cf_image.data)
        export_image_to_fits(
            cf_image, "%s/test_convolutionfunction_box_cf.fits" % self.dir)

        peak_location = numpy.unravel_index(numpy.argmax(numpy.abs(cf.data)),
                                            cf.shape)
        assert numpy.abs(cf.data[peak_location] -
                         1.0) < 1e-15, "Peak is incorrect %s" % str(
                             cf.data[peak_location] - 1.0)
        assert peak_location == (0, 0, 0, 0, 0, 2, 2), peak_location