rfft

Contents

rfft#

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

Compute a one-dimensional DFT of a real-valued array.

Unit-aware implementation of numpy.fft.rfft(). Only the positive-frequency half of the spectrum is returned. The output unit is input_unit * second.

Parameters:
  • a (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – Real-valued input signal.

  • n (int | None) – Effective length of the input along axis. Defaults to the actual length.

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

  • norm (str | None) – Normalization mode.

Returns:

The one-dimensional real DFT of a. The length along axis is n // 2 + 1.

Return type:

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

See also

saiunit.fft.fft

Full one-dimensional DFT.

saiunit.fft.irfft

Inverse of rfft.

saiunit.fft.rfftn

N-dimensional real 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.rfft(x)