From d221db34f32b1fb82d6015e79e46e49b92bbaeb7 Mon Sep 17 00:00:00 2001 From: David Rotermund <54365609+davrot@users.noreply.github.com> Date: Fri, 15 Dec 2023 14:22:03 +0100 Subject: [PATCH] Update README.md Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com> --- numpy/fft/README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/numpy/fft/README.md b/numpy/fft/README.md index 28955ca..99c8ab4 100644 --- a/numpy/fft/README.md +++ b/numpy/fft/README.md @@ -75,7 +75,7 @@ print(rfft_result.shape) # -> (5001,) ### [numpy.fft.fftfreq](https://numpy.org/doc/stable/reference/generated/numpy.fft.fftfreq.html#numpy-fft-fftfreq) ```python -fft.fftfreq(n, d=1.0)[source] +fft.fftfreq(n, d=1.0) ``` > Return the Discrete Fourier Transform sample frequencies. > @@ -88,6 +88,25 @@ f = [0, 1, ..., n/2-1, -n/2, ..., -1] / (d*n) if n is even f = [0, 1, ..., (n-1)/2, -(n-1)/2, ..., -1] / (d*n) if n is odd ``` +## [numpy.fft.rfftfreq](https://numpy.org/doc/stable/reference/generated/numpy.fft.rfftfreq.html#numpy-fft-rfftfreq) + +```python +fft.rfftfreq(n, d=1.0) +``` + +> Return the Discrete Fourier Transform sample frequencies (for usage with rfft, irfft). +> +> The returned float array f contains the frequency bin centers in cycles per unit of the sample spacing (with zero at the start). For instance, if the sample spacing is in seconds, then the frequency unit is cycles/second. +> +> Given a window length n and a sample spacing d: + +```python +f = [0, 1, ..., n/2-1, n/2] / (d*n) if n is even +f = [0, 1, ..., (n-1)/2-1, (n-1)/2] / (d*n) if n is odd +``` + +> Unlike fftfreq (but like scipy.fftpack.rfftfreq) the Nyquist frequency component is considered to be positive. + ## [Discrete Fourier Transform (numpy.fft)](https://numpy.org/doc/stable/reference/routines.fft.html#discrete-fourier-transform-numpy-fft) ## [Standard FFTs](https://numpy.org/doc/stable/reference/routines.fft.html#standard-ffts)