workflows/arlexecute/skymodel/skymodel_arlexecute.py
def convolve_skymodel_list_arlexecute_workflow(obsvis, skymodel_list, context, vis_slices=1, facets=1,
                                             gcfcf=None, **kwargs):
    """Form residual image from observed visibility and a set of skymodel without calibration

    This is similar to convolving the skymodel images with the PSF

    :param vis_list: List of Visibility data models
    :param skymodel_list: skymodel list
    :param vis_slices: Number of vis slices (w stack or timeslice)
    :param facets: Number of facets (per axis)
    :param context: Type of processing e.g. 2d, wstack, timeslice or facets
    :param gcfcg: tuple containing grid correction and convolution function
    :param docal: Apply calibration table in skymodel
    :param kwargs: Parameters for functions in components
    :return: List of (image, weight) tuples)
   """

    def ft_ift_sm(ov, sm, g):
        assert isinstance(ov, Visibility) or isinstance(ov, BlockVisibility), ov
        assert isinstance(sm, SkyModel), sm
        if g is not None:
            assert len(g) == 2, g
            assert isinstance(g[0], Image), g[0]
            assert isinstance(g[1], ConvolutionFunction), g[1]
            
        v = copy_visibility(ov)
    
        v.data['vis'][...] = 0.0 + 0.0j
    
        if len(sm.components) > 0:
        
            if isinstance(sm.mask, Image):
                comps = copy_skycomponent(sm.components)
                comps = apply_beam_to_skycomponent(comps, sm.mask)
                v = predict_skycomponent_visibility(v, comps)
            else:
                v = predict_skycomponent_visibility(v, sm.components)
    
        if isinstance(sm.image, Image):
            if numpy.max(numpy.abs(sm.image.data)) > 0.0:
                if isinstance(sm.mask, Image):
                    model = copy_image(sm.image)
                    model.data *= sm.mask.data
                else:
                    model = sm.image
                v = predict_list_serial_workflow([v], [model], context=context,
                                                 vis_slices=vis_slices, facets=facets, gcfcf=[g],
                                                 **kwargs)[0]
    
        assert isinstance(sm.image, Image), sm.image
        
        result = invert_list_serial_workflow([v], [sm.image], context=context,
                                             vis_slices=vis_slices, facets=facets, gcfcf=[g],
                                             **kwargs)[0]
        if isinstance(sm.mask, Image):
            result[0].data *= sm.mask.data
        return result
    
    if gcfcf is None:
        return [arlexecute.execute(ft_ift_sm, nout=len(skymodel_list))(obsvis, sm, None)
                for ism, sm in enumerate(skymodel_list)]
    else:
        return [arlexecute.execute(ft_ift_sm, nout=len(skymodel_list))(obsvis, sm, gcfcf[ism])
                for ism, sm in enumerate(skymodel_list)]
Form residual image from observed visibility and a set of skymodel without calibration

    This is similar to convolving the skymodel images with the PSF

    :param vis_list: List of Visibility data models
    :param skymodel_list: skymodel list
    :param vis_slices: Number of vis slices (w stack or timeslice)
    :param facets: Number of facets (per axis)
    :param context: Type of processing e.g. 2d, wstack, timeslice or facets
    :param gcfcg: tuple containing grid correction and convolution function
    :param docal: Apply calibration table in skymodel
    :param kwargs: Parameters for functions in components
    :return: List of (image, weight) tuples)
   
Form residual image from observed visibility and a set of skymodel without calibration
This is similar to convolving the skymodel images with the PSF
Form residual image from observed visibility and a set of skymodel without calibration This is similar to convolving the skymodel images with the PSF
def convolve_skymodel_list_arlexecute_workflow(obsvis, skymodel_list, context, vis_slices=1, facets=1,
                                             gcfcf=None, **kwargs):
    def ft_ift_sm(ov, sm, g):
        assert isinstance(ov, Visibility) or isinstance(ov, BlockVisibility), ov
        assert isinstance(sm, SkyModel), sm
        if g is not None:
            assert len(g) == 2, g
            assert isinstance(g[0], Image), g[0]
            assert isinstance(g[1], ConvolutionFunction), g[1]
        v = copy_visibility(ov)
        v.data['vis'][...] = 0.0 + 0.0j
        if len(sm.components) > 0:
            if isinstance(sm.mask, Image):
                comps = copy_skycomponent(sm.components)
                comps = apply_beam_to_skycomponent(comps, sm.mask)
                v = predict_skycomponent_visibility(v, comps)
            else:
                v = predict_skycomponent_visibility(v, sm.components)
        if isinstance(sm.image, Image):
            if numpy.max(numpy.abs(sm.image.data)) > 0.0:
                if isinstance(sm.mask, Image):
                    model = copy_image(sm.image)
                    model.data *= sm.mask.data
                else:
                    model = sm.image
                v = predict_list_serial_workflow([v], [model], context=context,
                                                 vis_slices=vis_slices, facets=facets, gcfcf=[g],
                                                 **kwargs)[0]
        assert isinstance(sm.image, Image), sm.image
        result = invert_list_serial_workflow([v], [sm.image], context=context,
                                             vis_slices=vis_slices, facets=facets, gcfcf=[g],
                                             **kwargs)[0]
        if isinstance(sm.mask, Image):
            result[0].data *= sm.mask.data
        return result
    if gcfcf is None:
        return [arlexecute.execute(ft_ift_sm, nout=len(skymodel_list))(obsvis, sm, None)
                for ism, sm in enumerate(skymodel_list)]
    else:
        return [arlexecute.execute(ft_ift_sm, nout=len(skymodel_list))(obsvis, sm, gcfcf[ism])
                for ism, sm in enumerate(skymodel_list)]
def convolve_skymodel_list_arlexecute_workflow ( obsvis , skymodel_list , context , vis_slices = 1 , facets = 1 , gcfcf = None , ** kwargs ) : def ft_ift_sm ( ov , sm , g ) : assert isinstance ( ov , Visibility ) or isinstance ( ov , BlockVisibility ) , ov assert isinstance ( sm , SkyModel ) , sm if g is not None : assert len ( g ) == 2 , g assert isinstance ( g [ 0 ] , Image ) , g [ 0 ] assert isinstance ( g [ 1 ] , ConvolutionFunction ) , g [ 1 ] v = copy_visibility ( ov ) v . data [ 'vis' ] [ ... ] = 0.0 + 0.0j if len ( sm . components ) > 0 : if isinstance ( sm . mask , Image ) : comps = copy_skycomponent ( sm . components ) comps = apply_beam_to_skycomponent ( comps , sm . mask ) v = predict_skycomponent_visibility ( v , comps ) else : v = predict_skycomponent_visibility ( v , sm . components ) if isinstance ( sm . image , Image ) : if numpy . max ( numpy . abs ( sm . image . data ) ) > 0.0 : if isinstance ( sm . mask , Image ) : model = copy_image ( sm . image ) model . data *= sm . mask . data else : model = sm . image v = predict_list_serial_workflow ( [ v ] , [ model ] , context = context , vis_slices = vis_slices , facets = facets , gcfcf = [ g ] , ** kwargs ) [ 0 ] assert isinstance ( sm . image , Image ) , sm . image result = invert_list_serial_workflow ( [ v ] , [ sm . image ] , context = context , vis_slices = vis_slices , facets = facets , gcfcf = [ g ] , ** kwargs ) [ 0 ] if isinstance ( sm . mask , Image ) : result [ 0 ] . data *= sm . mask . data return result if gcfcf is None : return [ arlexecute . execute ( ft_ift_sm , nout = len ( skymodel_list ) ) ( obsvis , sm , None ) for ism , sm in enumerate ( skymodel_list ) ] else : return [ arlexecute . execute ( ft_ift_sm , nout = len ( skymodel_list ) ) ( obsvis , sm , gcfcf [ ism ] ) for ism , sm in enumerate ( skymodel_list ) ]
Form residual image from observed visibility and a set of skymodel without calibration
This is similar to convolving the skymodel images with the PSF
Form residual image from observed visibility and a set of skymodel without calibration This is similar to convolving the skymodel images with the PSF
"""Form residual image from observed visibility and a set of skymodel without calibration

    This is similar to convolving the skymodel images with the PSF

    :param vis_list: List of Visibility data models
    :param skymodel_list: skymodel list
    :param vis_slices: Number of vis slices (w stack or timeslice)
    :param facets: Number of facets (per axis)
    :param context: Type of processing e.g. 2d, wstack, timeslice or facets
    :param gcfcg: tuple containing grid correction and convolution function
    :param docal: Apply calibration table in skymodel
    :param kwargs: Parameters for functions in components
    :return: List of (image, weight) tuples)
   """
List of (image, weight) tuples)
List of ( image weight ) tuples )
obsvis
skymodel_list
None
context
Type of processing e.g. 2d, wstack, timeslice or facets
Type of processing e . g . 2d wstack timeslice or facets
vis_slices
Number of vis slices (w stack or timeslice)
Number of vis slices ( w stack or timeslice )
facets
Number of facets (per axis)
Number of facets ( per axis )
gcfcf
vis_list
List of Visibility data models
List of Visibility data models
gcfcg
tuple containing grid correction and convolution function
tuple containing grid correction and convolution function
docal
Apply calibration table in skymodel
Apply calibration table in skymodel
kwargs
Parameters for functions in components
Parameters for functions in components