fftfreq#
- class saiunit.fft.fftfreq(n, d=1.0, *, dtype=None, device=None, **kwargs)#
Return sample frequencies for the discrete Fourier transform.
Unit-aware implementation of
numpy.fft.fftfreq(). When d carries a time unit, the returned frequencies carry the corresponding reciprocal (frequency) unit.- 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 aQuantitywith a time unit is given, the output will carry the matching frequency unit (e.g.second->hertz).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 containing sample frequencies.
- Return type:
saiunit.Quantity |
Array|ndarray|bool|number|bool|int|float|complex
See also
Examples
>>> import saiunit as u >>> import saiunit.fft as sufft >>> freqs = sufft.fftfreq(4, 1.0 * u.second)