processing_components/image/operations.py
def smooth_image(model: Image, width=1.0, normalise=True):
    """ Smooth an image with a kernel
    
    :param model: Image
    :param width: Kernel in pixels
    :param normalise: Normalise kernel peak to unity
    
    """
    assert isinstance(model, Image), model
    
    from astropy.convolution.kernels import Gaussian2DKernel
    from astropy.convolution import convolve_fft
    
    kernel = Gaussian2DKernel(width)
    
    cmodel = create_empty_image_like(model)
    nchan, npol, _, _ = model.shape
    for pol in range(npol):
        for chan in range(nchan):
            cmodel.data[chan, pol, :, :] = convolve_fft(model.data[chan, pol, :, :], kernel,
                                                                        normalize_kernel=False,
                                                        allow_huge=True)
    if normalise and isinstance(kernel, Gaussian2DKernel):
        cmodel.data *= 2 * numpy.pi * width ** 2
    
    return cmodel
 Smooth an image with a kernel
    
    :param model: Image
    :param width: Kernel in pixels
    :param normalise: Normalise kernel peak to unity
    
    
Smooth an image with a kernel
Smooth an image with a kernel
def smooth_image(model: Image, width=1.0, normalise=True):
    assert isinstance(model, Image), model
    from astropy.convolution.kernels import Gaussian2DKernel
    from astropy.convolution import convolve_fft
    kernel = Gaussian2DKernel(width)
    cmodel = create_empty_image_like(model)
    nchan, npol, _, _ = model.shape
    for pol in range(npol):
        for chan in range(nchan):
            cmodel.data[chan, pol, :, :] = convolve_fft(model.data[chan, pol, :, :], kernel,
                                                                        normalize_kernel=False,
                                                        allow_huge=True)
    if normalise and isinstance(kernel, Gaussian2DKernel):
        cmodel.data *= 2 * numpy.pi * width ** 2
    return cmodel
def smooth_image ( model : Image , width = 1.0 , normalise = True ) : assert isinstance ( model , Image ) , model from astropy . convolution . kernels import Gaussian2DKernel from astropy . convolution import convolve_fft kernel = Gaussian2DKernel ( width ) cmodel = create_empty_image_like ( model ) nchan , npol , _ , _ = model . shape for pol in range ( npol ) : for chan in range ( nchan ) : cmodel . data [ chan , pol , : , : ] = convolve_fft ( model . data [ chan , pol , : , : ] , kernel , normalize_kernel = False , allow_huge = True ) if normalise and isinstance ( kernel , Gaussian2DKernel ) : cmodel . data *= 2 * numpy . pi * width ** 2 return cmodel
Smooth an image with a kernel
Smooth an image with a kernel
""" Smooth an image with a kernel
    
    :param model: Image
    :param width: Kernel in pixels
    :param normalise: Normalise kernel peak to unity
    
    """
model
Image
None
width
Kernel in pixels
Kernel in pixels
normalise
Normalise kernel peak to unity
Normalise kernel peak to unity