fft

Contents

fft#

class saiunit.fft.fft(a, n=None, axis=-1, norm=None, **kwargs)#

Compute a one-dimensional discrete Fourier transform along a given axis.

Unit-aware implementation of numpy.fft.fft(). The output unit is input_unit * second because the DFT integrates over time.

Parameters:
  • a (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – Input signal.

  • n (int | None) – Length of the transformed axis in the output. If not given, defaults to the length of a along axis.

  • axis (int) – Axis along which the FFT is computed.

  • norm (str | None) – Normalization mode.

Returns:

The one-dimensional DFT of a. When a carries a unit, the result has unit a.unit * second.

Return type:

saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex

See also

saiunit.fft.ifft

One-dimensional inverse DFT.

saiunit.fft.fftn

N-dimensional DFT.

Examples

>>> import saiunit as u
>>> import saiunit.fft as sufft
>>> import jax.numpy as jnp
>>> x = jnp.array([1.0, 2.0, 3.0, 4.0]) * u.meter
>>> X = sufft.fft(x)
>>> x_roundtrip = sufft.ifft(X)