def test_deconvolve_mmclean_no_taylor(self): self.comp, self.residual = deconvolve_cube(self.dirty, self.psf, niter=self.niter, gain=0.1, algorithm='mmclean', scales=[0, 3, 10], threshold=0.01, nmoment=1, findpeak='RASCIL', fractional_threshold=0.01, window=self.innerquarter) if self.persist: export_image_to_fits( self.comp, "%s/test_deconvolve_mmclean_notaylor-comp.fits" % self.dir) if self.persist: export_image_to_fits( self.residual, "%s/test_deconvolve_mmclean_notaylor-residual.fits" % self.dir) self.cmodel = restore_cube(self.comp, self.psf, self.residual) if self.persist: export_image_to_fits( self.cmodel, "%s/test_deconvolve_mmclean_notaylor-clean.fits" % self.dir) assert numpy.max(self.residual.data) < 3.0
def test_deconvolve_msclean_subpsf(self): self.comp, self.residual = deconvolve_cube(self.dirty, psf=self.psf, psf_support=200, window_shape='quarter', niter=1000, gain=0.7, algorithm='msclean', scales=[0, 3, 10, 30], threshold=0.01) if self.persist: export_image_to_fits( self.comp, "%s/test_deconvolve_msclean_subpsf-comp.fits" % (self.dir)) if self.persist: export_image_to_fits( self.residual, "%s/test_deconvolve_msclean_subpsf-residual.fits" % (self.dir)) self.cmodel = restore_cube(self.comp, self.psf, self.residual) if self.persist: export_image_to_fits( self.cmodel, "%s/test_deconvolve_msclean_subpsf-clean.fits" % (self.dir)) assert numpy.max(self.residual.data[..., 56:456, 56:456]) < 1.0
def test_deconvolve_hogbom(self): self.comp, self.residual = deconvolve_cube(self.dirty, self.psf, niter=10000, gain=0.1, algorithm='hogbom', threshold=0.01) export_image_to_fits( self.residual, "%s/test_deconvolve_hogbom-residual.fits" % (self.dir)) self.cmodel = restore_cube(self.comp, self.psf, self.residual) export_image_to_fits( self.cmodel, "%s/test_deconvolve_hogbom-clean.fits" % (self.dir)) assert numpy.max(self.residual.data) < 1.2
def test_deconvolve_msclean(self): self.comp, self.residual = deconvolve_cube(self.dirty, self.psf, niter=1000, gain=0.7, algorithm='msclean', scales=[0, 3, 10, 30], threshold=0.01) export_image_to_fits( self.comp, "%s/test_deconvolve_msclean-comp.fits" % (self.dir)) export_image_to_fits( self.residual, "%s/test_deconvolve_msclean-residual.fits" % (self.dir)) self.cmodel = restore_cube(self.comp, self.psf, self.residual) export_image_to_fits( self.cmodel, "%s/test_deconvolve_msclean-clean.fits" % (self.dir)) assert numpy.max(self.residual.data) < 1.2
def test_deconvolve_hogbom_subpsf(self): self.comp, self.residual = deconvolve_cube(self.dirty, psf=self.psf, psf_support=200, window_shape='quarter', niter=10000, gain=0.1, algorithm='hogbom', threshold=0.01) export_image_to_fits( self.residual, "%s/test_deconvolve_hogbom_subpsf-residual.fits" % (self.dir)) self.cmodel = restore_cube(self.comp, self.psf, self.residual) export_image_to_fits( self.cmodel, "%s/test_deconvolve_hogbom_subpsf-clean.fits" % (self.dir)) assert numpy.max(self.residual.data[..., 56:456, 56:456]) < 1.2
def test_deconvolve_hogbom_no_edge(self): self.comp, self.residual = deconvolve_cube(self.dirty, self.psf, window_shape='no_edge', niter=10000, gain=0.1, algorithm='hogbom', threshold=0.01) if self.persist: export_image_to_fits( self.residual, "%s/test_deconvolve_hogbom_noedge-residual.fits" % (self.dir)) self.cmodel = restore_cube(self.comp, self.psf, self.residual) if self.persist: export_image_to_fits( self.cmodel, "%s/test_deconvolve_hogbom_no_edge-clean.fits" % (self.dir)) assert numpy.max(self.residual.data) < 1.2
def test_restore(self): self.cmodel = restore_cube(self.model, self.psf)
export_image_to_fits( dirty, '%s/compare_imaging_sim2_dirty.fits' % (results_dir)) export_image_to_fits( psf, '%s/compare_imaging_sim2_psf.fits' % (results_dir)) # Deconvolve using clean comp, residual = deconvolve_cube(dirty, psf, niter=10000, threshold=0.001, fractional_threshold=0.001, window_shape='quarter', gain=0.7, scales=[0, 3, 10, 30]) restored = restore_cube(comp, psf, residual) export_image_to_fits( restored, '%s/compare_imaging_sim2_restored.fits' % (results_dir)) export_image_to_fits( residual, '%s/compare_imaging_sim2_residual.fits' % (results_dir)) qa = qa_image(restored) assert numpy.abs(qa.data['max'] - 1.006140596404203) < 1e-7, qa assert numpy.abs(qa.data['maxabs'] - 1.006140596404203) < 1e-7, qa assert numpy.abs(qa.data['min'] + 0.23890808520954754) < 1e-7, qa assert numpy.abs(qa.data['rms'] - 0.007366519782047875) < 1e-7, qa assert numpy.abs(qa.data['medianabs'] - 0.0005590537883509844) < 1e-7, qa except ModuleNotFoundError as error: print(error.__class__.__name__ + ": " + error.msg)