prtools.pixel_kernel#
- pixel_kernel(shape, oversample=1, fftshift=True)[source]#
2D pixel MTF filter kernel
This function returns a normalized 2D sinc function sized to represent the transfer function of an idealized square pixel.
- Parameters:
shape (int or tuple of int) – Shape of the kernel
oversample (float, optional) – Oversampling factor to represent in the kernel. Default is 1.
fftshift (bool, optional) – If True (default), the kernel is FFT-shifted before it is returned.
- Return type:
ndarray
See also
Examples
>>> pixel_mtf = prtools.pixel_kernel((256,256), 1) >>> plt.imshow(pixel_mtf, cmap='gray', vmin=0)
Note this is functionally equivalent to
>>> r = np.fft.fftfreq(256) >>> c = np.fft.fftfreq(256) >>> pixel_mtf = np.fft.fftshift(np.abs(prtools.sinc(r, c))) >>> plt.imshow(pixel_mtf, cmap='gray', vmin=0)