def test_deconvolve_and_restore_cube_hogbom(self):
     self.bigmodel.data *= 0.0
     visres, model, residual = solve_image(self.vis,
                                           self.bigmodel,
                                           niter=1000,
                                           nmajor=5,
                                           threshold=0.01,
                                           psf_support=200,
                                           window='quarter',
                                           fractional_threshold=0.1,
                                           gain=0.1,
                                           algorithm='hogbom')
     export_image_to_fits(
         model,
         '%s/test_solve_skycomponent_hogbom_solution.fits' % (self.dir))
     export_image_to_fits(
         residual,
         '%s/test_solve_skycomponent_hogbom_residual.fits' % (self.dir))
     psf, sumwt = invert_2d(self.vis, model, dopsf=True)
     export_image_to_fits(
         psf, '%s/test_solve_skycomponent_hogbom_psf.fits' % (self.dir))
     restored = restore_cube(model=model, psf=psf, residual=residual)
     export_image_to_fits(
         restored,
         '%s/test_solve_skycomponent_hogbom_restored.fits' % (self.dir))
     assert numpy.max(numpy.abs(residual.data)) < 0.5
Пример #2
0
def spectral_line_imaging(vis: Visibility,
                          model: Image,
                          continuum_model: Image = None,
                          continuum_components=None,
                          predict=predict_2d,
                          invert=invert_2d,
                          deconvolve_spectral=False,
                          **kwargs) -> (Image, Image, Image):
    """Spectral line imaging from calibrated (DIE) data
    
    A continuum model can be subtracted, and deconvolution is optional.
    
    If deconvolve_spectral is True then the solve_image is used to deconvolve.
    If deconvolve_spectral is False then the residual image after continuum subtraction is calculated
    
    :param vis: Visibility
    :param continuum_model: model continuum image to be subtracted
    :param continuum_components: mode components to be subtracted
    :param spectral_model: model spectral image
    :param predict: Predict fumction e.g. predict_2d
    :param invert: Invert function e.g. invert_wprojection
    :return: Residual visibility, spectral model image, spectral residual image
    """

    vis_no_continuum = copy_visibility(vis)
    if continuum_model is not None:
        vis_no_continuum = predict(vis_no_continuum, continuum_model, **kwargs)
    if continuum_components is not None:
        vis_no_continuum = predict_skycomponent_visibility(
            vis_no_continuum, continuum_components)
    vis_no_continuum.data[
        'vis'] = vis.data['vis'] - vis_no_continuum.data['vis']

    if deconvolve_spectral:
        log.info(
            "spectral_line_imaging: Deconvolving continuum subtracted visibility"
        )
        vis_no_continuum, spectral_model, spectral_residual = solve_image(
            vis_no_continuum, model, **kwargs)
    else:
        log.info(
            "spectral_line_imaging: Making dirty image from continuum subtracted visibility"
        )
        spectral_model, spectral_residual = \
            invert(vis_no_continuum, model, **kwargs)

    return vis_no_continuum, spectral_model, spectral_residual
Пример #3
0
def continuum_imaging(vis: Visibility,
                      model: Image,
                      components=None,
                      **kwargs) -> (Image, Image, Image):
    """Continuum imaging from calibrated (DDE and DIE) and coalesced data

    The model image is used as the starting point, and also to determine the imagesize and sampling. Components
    are subtracted before deconvolution.
    
    Uses :py:func:`arl.image.solvers.solve_image`
    
    :param vis: Visibility
    :param model: model image
    :param components: Component-based sky model
    :param kwargs: Parameters
    :return:
    """
    return solve_image(vis, model, components, **kwargs)
Пример #4
0
 def test_deconvolve_and_restore_cube_mmclean(self):
     self.bigmodel.data *= 0.0
     visres, model, residual = solve_image(self.vis,
                                           self.bigmodel,
                                           nmajor=3,
                                           niter=1000,
                                           threshold=0.01,
                                           gain=0.7,
                                           window='quarter',
                                           scales=[0, 3, 10, 30],
                                           fractional_threshold=0.1,
                                           algorithm='mfsmsclean',
                                           nmoments=3)
     export_image_to_fits(
         model, '%s/test_solve_image_mmclean_solution.fits' % (self.dir))
     export_image_to_fits(
         residual, '%s/test_solve_image_mmclean_residual.fits' % (self.dir))
     psf, sumwt = invert_2d(self.vis, model, dopsf=True)
     export_image_to_fits(
         psf, '%s/test_solve_image_mmclean_psf.fits' % (self.dir))
     restored = restore_cube(model=model, psf=psf, residual=residual)
     export_image_to_fits(
         restored, '%s/test_solve_image_mmclean_restored.fits' % (self.dir))
     assert numpy.max(numpy.abs(residual.data)) < 1.2