summaryrefslogtreecommitdiff
path: root/numpy/fft/helper.py
diff options
context:
space:
mode:
authorendolith <endolith@gmail.com>2012-11-26 13:40:21 -0500
committerendolith <endolith@gmail.com>2012-11-26 13:49:26 -0500
commit2596867bd3165fcde339cbb06d8879085bc5d3b1 (patch)
tree7ffede08d2920512741a3d76182d780dadfeceed /numpy/fft/helper.py
parent749e5c1c47a12530018839edf8358457d74224ad (diff)
downloadnumpy-2596867bd3165fcde339cbb06d8879085bc5d3b1.tar.gz
DOC: Reword "Hermite symmetry", clarify units of sample spacing
Diffstat (limited to 'numpy/fft/helper.py')
-rw-r--r--numpy/fft/helper.py26
1 files changed, 15 insertions, 11 deletions
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