diff options
author | endolith <endolith@gmail.com> | 2012-11-26 13:40:21 -0500 |
---|---|---|
committer | endolith <endolith@gmail.com> | 2012-11-26 13:49:26 -0500 |
commit | 2596867bd3165fcde339cbb06d8879085bc5d3b1 (patch) | |
tree | 7ffede08d2920512741a3d76182d780dadfeceed /numpy | |
parent | 749e5c1c47a12530018839edf8358457d74224ad (diff) | |
download | numpy-2596867bd3165fcde339cbb06d8879085bc5d3b1.tar.gz |
DOC: Reword "Hermite symmetry", clarify units of sample spacing
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/fft/fftpack.py | 3 | ||||
-rw-r--r-- | numpy/fft/helper.py | 26 |
2 files changed, 16 insertions, 13 deletions
diff --git a/numpy/fft/fftpack.py b/numpy/fft/fftpack.py index 472d3e06c..2f8982d3c 100644 --- a/numpy/fft/fftpack.py +++ b/numpy/fft/fftpack.py @@ -297,8 +297,7 @@ def rfft(a, n=None, axis=-1): axis of the output is therefore ``n//2+1``. When ``A = rfft(a)`` and fs is the sampling frequency, ``A[0]`` contains - the zero-frequency term 0*fs, which must be purely real due to the Hermite - symmetry. + the zero-frequency term 0*fs, which is real due to Hermitian symmetry. If `n` is even, ``A[-1]`` contains the term representing both positive and negative Nyquist frequency (+fs/2 and -fs/2), and must also be purely diff --git a/numpy/fft/helper.py b/numpy/fft/helper.py index 88b38bf6f..c940a83d2 100644 --- a/numpy/fft/helper.py +++ b/numpy/fft/helper.py @@ -121,9 +121,11 @@ def fftfreq(n, d=1.0): """ Return the Discrete Fourier Transform sample frequencies. - The returned float array contains the frequency bins in - cycles/unit (with zero at the start) given a window length `n` and a - sample spacing `d`:: + 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`:: 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 @@ -133,11 +135,11 @@ def fftfreq(n, d=1.0): n : int Window length. d : scalar, optional - Sample spacing. Default is 1. - + Sample spacing (inverse of the sampling rate). Defaults to 1. + Returns ------- - out : ndarray + f : ndarray The array of length `n`, containing the sample frequencies. Examples @@ -169,9 +171,11 @@ def rfftfreq(n, d=1.0): Return the Discrete Fourier Transform sample frequencies (for usage with rfft, irfft). - The returned float array contains the frequency bins in - cycles/unit (with zero at the start) given a window length `n` and a - sample spacing `d`:: + 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`:: 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 @@ -184,11 +188,11 @@ def rfftfreq(n, d=1.0): n : int Window length. d : scalar, optional - Sample spacing. Default is 1. + Sample spacing (inverse of the sampling rate). Defaults to 1. Returns ------- - out : ndarray + f : ndarray The array of length `n//2+1`, containing the sample frequencies. Examples |