rfftfreq

Contents

rfftfreq#

class saiunit.fft.rfftfreq(n, d=1.0, *, dtype=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 (Union[saiunit.Quantity, Array, ndarray, number, bool]) – Sample spacing. If a Quantity with a time unit is given, the output will carry the matching frequency unit.

Returns:

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

Return type:

Union[saiunit.Quantity, Array, ndarray, number, bool]

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)