summaryrefslogtreecommitdiff
path: root/numpy/lib
diff options
context:
space:
mode:
authorRalf Gommers <ralf.gommers@gmail.com>2019-04-15 16:52:02 +0200
committerRalf Gommers <ralf.gommers@gmail.com>2019-04-15 16:52:02 +0200
commit26a8b418a9e19437d76b00be8a0a4f32aee68c4b (patch)
tree5b430747cb67619f8eb09edb70413ce9693a51df /numpy/lib
parent418e3bf0789dcd7d064de55a266b186d4ab42774 (diff)
downloadnumpy-26a8b418a9e19437d76b00be8a0a4f32aee68c4b.tar.gz
DOC: fix doc build warnings in a cleaner way.
Addresses review comment by @eric-wieser.
Diffstat (limited to 'numpy/lib')
-rw-r--r--numpy/lib/function_base.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index dad2e3bcd..e9908d1ef 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -2602,7 +2602,7 @@ def blackman(M):
Plot the window and the frequency response:
>>> from numpy.fft import fft, fftshift
- >>> window = np.blackman(51) + 1e-10 # eps shift to avoid division by zero
+ >>> window = np.blackman(51)
>>> plt.plot(window)
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.title("Blackman window")
@@ -2618,7 +2618,9 @@ def blackman(M):
>>> A = fft(window, 2048) / 25.5
>>> mag = np.abs(fftshift(A))
>>> freq = np.linspace(-0.5, 0.5, len(A))
- >>> response = 20 * np.log10(mag)
+ >>> with np.errstate(divide='ignore', invalid='ignore'):
+ ... response = 20 * np.log10(mag)
+ ...
>>> response = np.clip(response, -100, 100)
>>> plt.plot(freq, response)
[<matplotlib.lines.Line2D object at 0x...>]
@@ -2709,7 +2711,7 @@ def bartlett(M):
Plot the window and its frequency response (requires SciPy and matplotlib):
>>> from numpy.fft import fft, fftshift
- >>> window = np.bartlett(51) + 1e-10 # eps shift to avoid division by zero
+ >>> window = np.bartlett(51)
>>> plt.plot(window)
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.title("Bartlett window")
@@ -2725,7 +2727,9 @@ def bartlett(M):
>>> A = fft(window, 2048) / 25.5
>>> mag = np.abs(fftshift(A))
>>> freq = np.linspace(-0.5, 0.5, len(A))
- >>> response = 20 * np.log10(mag)
+ >>> with np.errstate(divide='ignore', invalid='ignore'):
+ ... response = 20 * np.log10(mag)
+ ...
>>> response = np.clip(response, -100, 100)
>>> plt.plot(freq, response)
[<matplotlib.lines.Line2D object at 0x...>]
@@ -2810,7 +2814,7 @@ def hanning(M):
>>> import matplotlib.pyplot as plt
>>> from numpy.fft import fft, fftshift
- >>> window = np.hanning(51) + 1e-10 # eps shift to avoid division by zero
+ >>> window = np.hanning(51)
>>> plt.plot(window)
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.title("Hann window")
@@ -2826,7 +2830,9 @@ def hanning(M):
>>> A = fft(window, 2048) / 25.5
>>> mag = np.abs(fftshift(A))
>>> freq = np.linspace(-0.5, 0.5, len(A))
- >>> response = 20 * np.log10(mag)
+ >>> with np.errstate(divide='ignore', invalid='ignore'):
+ ... response = 20 * np.log10(mag)
+ ...
>>> response = np.clip(response, -100, 100)
>>> plt.plot(freq, response)
[<matplotlib.lines.Line2D object at 0x...>]