processing_library/fourier_transforms/fft_support.py
def pad_mid(ff, npixel):
    """
    Pad a far field image with zeroes to make it the given size.

    Effectively as if we were multiplying with a box function of the
    original field's size, which is equivalent to a convolution with a
    sinc pattern in the uv-grid.

    .. note::
    
        Only the two innermost axes are transformed

        This function does not handle odd-sized dimensions properly

    :param ff: The input far field. Should be smaller than npixelxnpixel.

    :param npixel:  The desired far field size

    """
    ny, nx = ff.shape[-2:]
    cx = nx // 2
    cy = ny // 2
    if npixel == nx:
        return ff
    assert npixel > nx and npixel > ny
    pw = [(0, 0)] * (ff.ndim - 2) + [(npixel // 2 - cy, npixel // 2 - cy),
                                     (npixel // 2 - cx, npixel // 2 - cx)]
    return numpy.pad(ff,
                     pad_width=pw,
                     mode='constant',
                     constant_values=0.0)

    Pad a far field image with zeroes to make it the given size.

    Effectively as if we were multiplying with a box function of the
    original field's size, which is equivalent to a convolution with a
    sinc pattern in the uv-grid.

    .. note::
    
        Only the two innermost axes are transformed

        This function does not handle odd-sized dimensions properly

    :param ff: The input far field. Should be smaller than npixelxnpixel.

    :param npixel:  The desired far field size

    
Pad a far field image with zeroes to make it the given size.
Effectively as if we were multiplying with a box function of the
original field's size, which is equivalent to a convolution with a
sinc pattern in the uv-grid.



Only the two innermost axes are transformed

This function does not handle odd-sized dimensions properly
Pad a far field image with zeroes to make it the given size . Effectively as if we were multiplying with a box function of the original field ' s size which is equivalent to a convolution with a sinc pattern in the uv - grid . Only the two innermost axes are transformed This function does not handle odd - sized dimensions properly
def pad_mid(ff, npixel):
    ny, nx = ff.shape[-2:]
    cx = nx // 2
    cy = ny // 2
    if npixel == nx:
        return ff
    assert npixel > nx and npixel > ny
    pw = [(0, 0)] * (ff.ndim - 2) + [(npixel // 2 - cy, npixel // 2 - cy),
                                     (npixel // 2 - cx, npixel // 2 - cx)]
    return numpy.pad(ff,
                     pad_width=pw,
                     mode='constant',
                     constant_values=0.0)
def pad_mid ( ff , npixel ) : ny , nx = ff . shape [ - 2 : ] cx = nx // 2 cy = ny // 2 if npixel == nx : return ff assert npixel > nx and npixel > ny pw = [ ( 0 , 0 ) ] * ( ff . ndim - 2 ) + [ ( npixel // 2 - cy , npixel // 2 - cy ) , ( npixel // 2 - cx , npixel // 2 - cx ) ] return numpy . pad ( ff , pad_width = pw , mode = 'constant' , constant_values = 0.0 )
Pad a far field image with zeroes to make it the given size.
Pad a far field image with zeroes to make it the given size .
"""
    Pad a far field image with zeroes to make it the given size.

    Effectively as if we were multiplying with a box function of the
    original field's size, which is equivalent to a convolution with a
    sinc pattern in the uv-grid.

    .. note::
    
        Only the two innermost axes are transformed

        This function does not handle odd-sized dimensions properly

    :param ff: The input far field. Should be smaller than npixelxnpixel.

    :param npixel:  The desired far field size

    """
ff
The input far field. Should be smaller than npixelxnpixel.
The input far field . Should be smaller than npixelxnpixel .
npixel
The desired far field size
The desired far field size