workflows/arlexecute/imaging/imaging_arlexecute.py
def weight_list_arlexecute_workflow(vis_list, model_imagelist, gcfcf=None, weighting='uniform', **kwargs):
    """ Weight the visibility data
    
    This is done collectively so the weights are summed over all vis_lists and then
    corrected

    :param vis_list:
    :param model_imagelist: Model required to determine weighting parameters
    :param weighting: Type of weighting
    :param kwargs: Parameters for functions in graphs
    :return: List of vis_graphs
   """
    centre = len(model_imagelist) // 2
    
    if gcfcf is None:
        gcfcf = [arlexecute.execute(create_pswf_convolutionfunction)(model_imagelist[centre])]
        
    def to_vis(v):
        if isinstance(v, BlockVisibility):
            av = convert_blockvisibility_to_visibility(v)
            return av
        else:
            return v
    
    avis_list = [arlexecute.execute(to_vis, nout=1)(vis) for vis in vis_list]
    
    def grid_wt(vis, model, g):
        if vis is not None:
            if model is not None:
                griddata = create_griddata_from_image(model)
                griddata = grid_weight_to_griddata(vis, griddata, g[0][1])
                return griddata
            else:
                return None
        else:
            return None
    
    weight_list = [arlexecute.execute(grid_wt, pure=True, nout=1)(avis_list[i], model_imagelist[i],
                                                                  gcfcf)
                   for i in range(len(vis_list))]
    
    merged_weight_grid = arlexecute.execute(griddata_merge_weights, nout=1)(weight_list)
    merged_weight_grid = arlexecute.persist(merged_weight_grid, broadcast=True)
    
    def re_weight(vis, model, gd, g):
        if gd is not None:
            if vis is not None:
                # Ensure that the griddata has the right axes so that the convolution
                # function mapping works
                agd = create_griddata_from_image(model)
                agd.data = gd[0].data
                vis = griddata_reweight(vis, agd, g[0][1])
                return vis
            else:
                return None
        else:
            return vis
    
    avis_list = [arlexecute.execute(re_weight, nout=1)(v, model_imagelist[i], merged_weight_grid, gcfcf)
              for i, v in enumerate(avis_list)]

    def to_bvis(v, ov):
        if isinstance(ov, BlockVisibility):
            av = convert_visibility_to_blockvisibility(v)
            return av
        else:
            return v

    result = [arlexecute.execute(to_bvis, nout=1)(vis, ovis) for vis, ovis in zip(avis_list, vis_list)]

    return arlexecute.optimize(result)
 Weight the visibility data
    
    This is done collectively so the weights are summed over all vis_lists and then
    corrected

    :param vis_list:
    :param model_imagelist: Model required to determine weighting parameters
    :param weighting: Type of weighting
    :param kwargs: Parameters for functions in graphs
    :return: List of vis_graphs
   
Weight the visibility data
This is done collectively so the weights are summed over all vis_lists and then
corrected
Weight the visibility data This is done collectively so the weights are summed over all vis_lists and then corrected
def weight_list_arlexecute_workflow(vis_list, model_imagelist, gcfcf=None, weighting='uniform', **kwargs):
    centre = len(model_imagelist) // 2
    if gcfcf is None:
        gcfcf = [arlexecute.execute(create_pswf_convolutionfunction)(model_imagelist[centre])]
    def to_vis(v):
        if isinstance(v, BlockVisibility):
            av = convert_blockvisibility_to_visibility(v)
            return av
        else:
            return v
    avis_list = [arlexecute.execute(to_vis, nout=1)(vis) for vis in vis_list]
    def grid_wt(vis, model, g):
        if vis is not None:
            if model is not None:
                griddata = create_griddata_from_image(model)
                griddata = grid_weight_to_griddata(vis, griddata, g[0][1])
                return griddata
            else:
                return None
        else:
            return None
    weight_list = [arlexecute.execute(grid_wt, pure=True, nout=1)(avis_list[i], model_imagelist[i],
                                                                  gcfcf)
                   for i in range(len(vis_list))]
    merged_weight_grid = arlexecute.execute(griddata_merge_weights, nout=1)(weight_list)
    merged_weight_grid = arlexecute.persist(merged_weight_grid, broadcast=True)
    def re_weight(vis, model, gd, g):
        if gd is not None:
            if vis is not None:
                agd = create_griddata_from_image(model)
                agd.data = gd[0].data
                vis = griddata_reweight(vis, agd, g[0][1])
                return vis
            else:
                return None
        else:
            return vis
    avis_list = [arlexecute.execute(re_weight, nout=1)(v, model_imagelist[i], merged_weight_grid, gcfcf)
              for i, v in enumerate(avis_list)]
    def to_bvis(v, ov):
        if isinstance(ov, BlockVisibility):
            av = convert_visibility_to_blockvisibility(v)
            return av
        else:
            return v
    result = [arlexecute.execute(to_bvis, nout=1)(vis, ovis) for vis, ovis in zip(avis_list, vis_list)]
    return arlexecute.optimize(result)
def weight_list_arlexecute_workflow ( vis_list , model_imagelist , gcfcf = None , weighting = 'uniform' , ** kwargs ) : centre = len ( model_imagelist ) // 2 if gcfcf is None : gcfcf = [ arlexecute . execute ( create_pswf_convolutionfunction ) ( model_imagelist [ centre ] ) ] def to_vis ( v ) : if isinstance ( v , BlockVisibility ) : av = convert_blockvisibility_to_visibility ( v ) return av else : return v avis_list = [ arlexecute . execute ( to_vis , nout = 1 ) ( vis ) for vis in vis_list ] def grid_wt ( vis , model , g ) : if vis is not None : if model is not None : griddata = create_griddata_from_image ( model ) griddata = grid_weight_to_griddata ( vis , griddata , g [ 0 ] [ 1 ] ) return griddata else : return None else : return None weight_list = [ arlexecute . execute ( grid_wt , pure = True , nout = 1 ) ( avis_list [ i ] , model_imagelist [ i ] , gcfcf ) for i in range ( len ( vis_list ) ) ] merged_weight_grid = arlexecute . execute ( griddata_merge_weights , nout = 1 ) ( weight_list ) merged_weight_grid = arlexecute . persist ( merged_weight_grid , broadcast = True ) def re_weight ( vis , model , gd , g ) : if gd is not None : if vis is not None : agd = create_griddata_from_image ( model ) agd . data = gd [ 0 ] . data vis = griddata_reweight ( vis , agd , g [ 0 ] [ 1 ] ) return vis else : return None else : return vis avis_list = [ arlexecute . execute ( re_weight , nout = 1 ) ( v , model_imagelist [ i ] , merged_weight_grid , gcfcf ) for i , v in enumerate ( avis_list ) ] def to_bvis ( v , ov ) : if isinstance ( ov , BlockVisibility ) : av = convert_visibility_to_blockvisibility ( v ) return av else : return v result = [ arlexecute . execute ( to_bvis , nout = 1 ) ( vis , ovis ) for vis , ovis in zip ( avis_list , vis_list ) ] return arlexecute . optimize ( result )
Weight the visibility data
This is done collectively so the weights are summed over all vis_lists and then
corrected
Weight the visibility data This is done collectively so the weights are summed over all vis_lists and then corrected
""" Weight the visibility data
    
    This is done collectively so the weights are summed over all vis_lists and then
    corrected

    :param vis_list:
    :param model_imagelist: Model required to determine weighting parameters
    :param weighting: Type of weighting
    :param kwargs: Parameters for functions in graphs
    :return: List of vis_graphs
   """ # Ensure that the griddata has the right axes so that the convolution # function mapping works
List of vis_graphs
List of vis_graphs
vis_list
None
model_imagelist
Model required to determine weighting parameters
Model required to determine weighting parameters
gcfcf
weighting
Type of weighting
Type of weighting
kwargs
Parameters for functions in graphs
Parameters for functions in graphs