workflows/serial/skymodel/skymodel_serial.py
def predict_skymodel_list_serial_workflow(obsvis, skymodel_list, context, vis_slices=1, facets=1,
                                          gcfcf=None, docal=False, **kwargs):
    """Predict from a list of skymodels, producing one visibility per skymodel

    :param obsvis: "Observed Visibility"
    :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 vis_lists
   """
    
    def ft_cal_sm(ov, sm, g):
        assert isinstance(ov, Visibility), 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]
        
        if docal and isinstance(sm.gaintable, GainTable):
            bv = convert_visibility_to_blockvisibility(v)
            bv = apply_gaintable(bv, sm.gaintable, inverse=True)
            v = convert_blockvisibility_to_visibility(bv)
        
        return v
    
    if gcfcf is None:
       return [ft_cal_sm(obsvis, sm, None)
                for ism, sm in enumerate(skymodel_list)]
    else:
        return [ft_cal_sm(obsvis, sm, gcfcf[ism])
                for ism, sm in enumerate(skymodel_list)]
Predict from a list of skymodels, producing one visibility per skymodel

    :param obsvis: "Observed Visibility"
    :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 vis_lists
   
Predict from a list of skymodels, producing one visibility per skymodel
Predict from a list of skymodels producing one visibility per skymodel
def predict_skymodel_list_serial_workflow(obsvis, skymodel_list, context, vis_slices=1, facets=1,
                                          gcfcf=None, docal=False, **kwargs):
    def ft_cal_sm(ov, sm, g):
        assert isinstance(ov, Visibility), 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]
        if docal and isinstance(sm.gaintable, GainTable):
            bv = convert_visibility_to_blockvisibility(v)
            bv = apply_gaintable(bv, sm.gaintable, inverse=True)
            v = convert_blockvisibility_to_visibility(bv)
        return v
    if gcfcf is None:
       return [ft_cal_sm(obsvis, sm, None)
                for ism, sm in enumerate(skymodel_list)]
    else:
        return [ft_cal_sm(obsvis, sm, gcfcf[ism])
                for ism, sm in enumerate(skymodel_list)]
def predict_skymodel_list_serial_workflow ( obsvis , skymodel_list , context , vis_slices = 1 , facets = 1 , gcfcf = None , docal = False , ** kwargs ) : def ft_cal_sm ( ov , sm , g ) : assert isinstance ( ov , Visibility ) , 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 ] if docal and isinstance ( sm . gaintable , GainTable ) : bv = convert_visibility_to_blockvisibility ( v ) bv = apply_gaintable ( bv , sm . gaintable , inverse = True ) v = convert_blockvisibility_to_visibility ( bv ) return v if gcfcf is None : return [ ft_cal_sm ( obsvis , sm , None ) for ism , sm in enumerate ( skymodel_list ) ] else : return [ ft_cal_sm ( obsvis , sm , gcfcf [ ism ] ) for ism , sm in enumerate ( skymodel_list ) ]
Predict from a list of skymodels, producing one visibility per skymodel
Predict from a list of skymodels producing one visibility per skymodel
"""Predict from a list of skymodels, producing one visibility per skymodel

    :param obsvis: "Observed Visibility"
    :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 vis_lists
   """
List of vis_lists
List of vis_lists
obsvis
None
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
docal
Apply calibration table in skymodel
Apply calibration table in skymodel
gcfcg
tuple containing grid correction and convolution function
tuple containing grid correction and convolution function
kwargs
Parameters for functions in components
Parameters for functions in components