def test_deconvolve_spectral(self): self.actualSetUp(add_errors=True) dirty_imagelist = invert_component(self.vis_list, self.model_imagelist, context='2d', dopsf=False, normalize=True) psf_imagelist = invert_component(self.vis_list, self.model_imagelist, context='2d', dopsf=True, normalize=True) deconvolved, _ = deconvolve_component(dirty_imagelist, psf_imagelist, self.model_imagelist, niter=1000, fractional_threshold=0.1, scales=[0, 3, 10], threshold=0.1, gain=0.7) deconvolved = arlexecute.compute(deconvolved, sync=True) export_image_to_fits(deconvolved[0], '%s/test_imaging_%s_deconvolve_spectral.fits' % (self.dir, arlexecute.type()))
def _invert_base(self, context, extra='', fluxthreshold=1.0, positionthreshold=1.0, check_components=True, facets=1, vis_slices=1, **kwargs): dirty = invert_component(self.vis_list, self.model_graph, context=context, dopsf=False, normalize=True, facets=facets, vis_slices=vis_slices, **kwargs)[0] dirty = arlexecute.compute(dirty, sync=True) export_image_to_fits( dirty[0], '%s/test_imaging_invert_%s%s_%s_dirty.fits' % (self.dir, context, extra, arlexecute.type())) assert numpy.max(numpy.abs(dirty[0].data)), "Image is empty" if check_components: self._checkcomponents(dirty[0], fluxthreshold, positionthreshold)
def _predict_base(self, context='2d', extra='', fluxthreshold=1.0, facets=1, vis_slices=1, **kwargs): vis_list = zero_vislist_component(self.vis_list) vis_list = predict_component(vis_list, self.model_graph, context=context, vis_slices=vis_slices, facets=facets, **kwargs) vis_list = subtract_vislist_component(self.vis_list, vis_list)[0] vis_list = arlexecute.compute(vis_list, sync=True) dirty = invert_component([vis_list], [self.model_graph[0]], context='2d', dopsf=False, normalize=True)[0] dirty = arlexecute.compute(dirty, sync=True) assert numpy.max(numpy.abs(dirty[0].data)), "Residual image is empty" export_image_to_fits( dirty[0], '%s/test_imaging_predict_%s%s_%s_dirty.fits' % (self.dir, context, extra, arlexecute.type())) maxabs = numpy.max(numpy.abs(dirty[0].data)) assert maxabs < fluxthreshold, "Error %.3f greater than fluxthreshold %.3f " % ( maxabs, fluxthreshold)
def test_deconvolve_and_restore_cube_mmclean(self): self.actualSetUp(add_errors=True) dirty_imagelist = invert_component(self.vis_list, self.model_imagelist, context='2d', dopsf=False, normalize=True) psf_imagelist = invert_component(self.vis_list, self.model_imagelist, context='2d', dopsf=True, normalize=True) dec_imagelist, _ = deconvolve_component(dirty_imagelist, psf_imagelist, self.model_imagelist, niter=1000, fractional_threshold=0.01, scales=[0, 3, 10], algorithm='mmclean', nmoments=3, nchan=self.freqwin, threshold=0.1, gain=0.7) residual_imagelist = residual_component(self.vis_list, model_imagelist=dec_imagelist, context='wstack', vis_slices=51) restored = restore_component(model_imagelist=dec_imagelist, psf_imagelist=psf_imagelist, residual_imagelist=residual_imagelist, empty=self.model_imagelist)[0] restored = arlexecute.compute(restored, sync=True) export_image_to_fits(restored, '%s/test_imaging_%s_mmclean_restored.fits' % (self.dir, arlexecute.type()))
def test_weighting(self): self.actualSetUp() context = 'wstack' vis_slices = 41 facets = 1 dirty_graph = invert_component(self.vis_list, self.model_graph, context=context, dopsf=False, normalize=True, facets=facets, vis_slices=vis_slices) dirty = arlexecute.compute(dirty_graph[0], sync=True) export_image_to_fits( dirty[0], '%s/test_imaging_noweighting_%s_dirty.fits' % (self.dir, arlexecute.type()))