rfftfreq

Contents

rfftfreq#

class saiunit.fft.rfftfreq(n, d=1.0, *, dtype=None, device=None, **kwargs)#

Return sample frequencies for the real discrete Fourier transform.

Unit-aware implementation of numpy.fft.rfftfreq(). Only the non-negative frequencies are returned (length n // 2 + 1).

Parameters:
  • n (int) – Window length (number of samples in the FFT).

  • d (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – Sample spacing. If a Quantity with a time unit is given, the output will carry the matching frequency unit.

  • dtype (str | type[Any] | dtype | SupportsDType | None) – Desired data-type for the output.

  • device (Device | Sharding | None) – Device on which to place the output.

Returns:

Array of length n // 2 + 1 containing sample frequencies.

Return type:

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

See also

saiunit.fft.fftfreq

Full-spectrum sample frequencies.

Examples

>>> import saiunit as u
>>> import saiunit.fft as sufft
>>> freqs = sufft.rfftfreq(4, 1.0 * u.second)