NaiveFourierTransform

class hcipy.fourier.NaiveFourierTransform(input_grid, output_grid, precompute_matrices=None)

Bases: hcipy.fourier.fourier_transform.FourierTransform

The naive Fourier transform (NFT).

This Fourier transform can operate on any types of coordinates, and calculates the Fourier integral using brute force. This class is written as generally as possible to act as a “ground truth” for the other Fourier transforms. As such, it has terrible performance.

Note

In almost all cases, you should not use this class. The FastFourierTransform and MatrixFourierTransform classes, if applicable, are multiple orders of magnitudes faster and use multiple orders of magnitude less memory. This class should only be used in a last resort and if you know what you are doing.

Note

The transformation matrices can be very large, quickly overwhelming any computer even for relatively small input or output grids.

Parameters
input_gridGrid

The grid that is expected for the input field.

output_gridGrid

The grid that is produced by the Fourier transform.

precompute_matricesboolean or None

Whether to precompute the matrices used in the NFT. Turning this on will cache calculated matrices for future evaluations of the Fourier transform. This will use a large amount of memory. If this is None, the choice will be determined by the configuration file.

Raises
ValueError

If the output grid has a different dimension than the input grid.

Attributes Summary

T_backward

The cached backward propagation matrix.

T_forward

The cached forward propagation matrix.

Methods Summary

backward(field)

Returns the inverse Fourier transform of the Field field.

forward(field)

Returns the forward Fourier transform of the Field field.

Attributes Documentation

T_backward

The cached backward propagation matrix.

T_forward

The cached forward propagation matrix.

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.