FastFourierTransform

class hcipy.fourier.FastFourierTransform(input_grid, q=1, fov=1, shift=0, emulate_fftshifts=None)

Bases: FourierTransform

A Fast Fourier Transform (FFT) object.

This Fourier transform calculates FFTs with zeropadding and cropping. This Fourier transform requires the input grid to be regular in Cartesian coordinates. Every number of dimensions is allowed.

Parameters:
input_gridGrid

The grid that is expected for the input field.

qscalar or array_like

The amount of zeropadding to perform. A value of 1 denotes no zeropadding. A value of 2 indicates zeropadding to twice the dimensions of the input grid. Note: as zeropadding has to be done by an integer number of pixels, the q will be rounded to the closest possible number to satisfy this constraint.

fovscalar or array_like

The amount of cropping to perform in the Fourier domain. A value of 1 indicates that no cropping will be performed.

shiftarray_like or scalar

The amount by which to shift the output grid. If this is a scalar, the same shift will be used for all dimensions.

emulate_fftshiftsboolean or None

Whether to emulate FFTshifts normally used in the FFT by multiplications in the opposite domain. Enabling this increases performance by 3x, but degrades accuracy of the FFT by 10x. If this is None, the choice will be determined by the configuration file.

Raises:
ValueError

If the input grid is not regular or Cartesian.

ValueError

If q < 1 or fov < 0 or fov > 1, both of which are impossible for an FFT to calculate.

Methods Summary

backward(field)

Returns the inverse Fourier transform of the Field field.

forward(field)

Returns the forward Fourier transform of the Field field.

Methods Documentation

backward(field)

Returns the inverse Fourier transform of the Field field.

Parameters:
fieldField

The field to inverse Fourier transform.

Returns:
Field

The inverse Fourier transform of the field.

forward(field)

Returns the forward Fourier transform of the Field field.

Parameters:
fieldField

The field to Fourier transform.

Returns:
Field

The Fourier transform of the field.