def invert_2d_from_grid(uv_grid_vis,
                        sumwt,
                        im: Image,
                        normalize: bool = True,
                        **kwargs):
    """
    Perform the 2d fourier transform on the gridded uv visibility
    
    :param uv_grid_vis: the gridded uv visibility
    :param sumwt: the weight for the uv visibility
    :param im: image template (not changed)
    :param return: resulting image[nchan, npol, ny, nx], sum of weights[nchan, npol]
    """

    ### Calculate gcf -> grid correction function ###
    # 2D Prolate spheroidal angular function is separable
    npixel = get_parameter(kwargs, "npixel", 512)

    nx = npixel
    ny = npixel

    nu = numpy.abs(2.0 * (numpy.arange(nx) - nx // 2) / nx)
    gcf1d, _ = grdsf(nu)
    gcf = numpy.outer(gcf1d, gcf1d)
    gcf[gcf > 0.0] = gcf.max() / gcf[gcf > 0.0]

    result = numpy.real(ifft(uv_grid_vis)) * gcf
    #Create image array

    resultimage = create_image_from_array(result, im.wcs)
    if normalize:
        resultimage = normalize_sumwt(resultimage, sumwt)

    return resultimage, sumwt
示例#2
0
def insert_function_pswf(x, a=5):
    from arl.fourier_transforms.convolutional_gridding import grdsf
    return grdsf(abs(x) / a)[0]