import matplotlib.pyplot as plt
import scipy.signal as sig
%matplotlib inline
n_points = 1025
window = sig.barthann(n_points)
plt.figure(figsize=(12, 8))
plt.plot(window)
plt.xlim([0, n_points])
plt.title('Bartlett-Hann')
<matplotlib.text.Text at 0x7fb3221be310>
window = sig.bartlett(n_points)
plt.figure(figsize=(12, 8))
plt.plot(window)
plt.xlim([0, n_points])
plt.title('Bartlett')
<matplotlib.text.Text at 0x7fb321f37210>
window = sig.blackman(n_points)
plt.figure(figsize=(12, 8))
plt.plot(window)
plt.xlim([0, n_points])
plt.title('Blackman')
<matplotlib.text.Text at 0x7fb3220e46d0>
window = sig.blackmanharris(n_points)
plt.figure(figsize=(12, 8))
plt.plot(window)
plt.xlim([0, n_points])
plt.title('Blackman-Harris')
<matplotlib.text.Text at 0x7fb32201f890>
window = sig.bohman(n_points)
plt.figure(figsize=(12, 8))
plt.plot(window)
plt.xlim([0, n_points])
plt.title('Bohman')
<matplotlib.text.Text at 0x7fb322007750>
(from the docs: included for correctness, equivalent to no window at all.)
window = sig.boxcar(n_points)
plt.figure(figsize=(12, 8))
plt.plot(window)
plt.xlim([0, n_points])
plt.title('Boxcar')
<matplotlib.text.Text at 0x7fb321c6e4d0>
window = sig.chebwin(n_points, at=100)
plt.figure(figsize=(12, 8))
plt.plot(window)
plt.xlim([0, n_points])
plt.title('Dolph-Chebyshev (attenutation 100 dB)')
<matplotlib.text.Text at 0x7fb321bc5b10>
window = sig.cosine(n_points)
plt.figure(figsize=(12, 8))
plt.plot(window)
plt.xlim([0, n_points])
plt.title('Cosine')
<matplotlib.text.Text at 0x7fb321b03510>
window = sig.flattop(n_points)
plt.figure(figsize=(12, 8))
plt.plot(window)
plt.xlim([0, n_points])
plt.title('Flat Top')
<matplotlib.text.Text at 0x7fb321a34810>
window = sig.gaussian(n_points, std=130)
plt.figure(figsize=(12, 8))
plt.plot(window)
plt.xlim([0, n_points])
plt.title('Gaussian ($\sigma$=130)')
<matplotlib.text.Text at 0x7fb321978210>
window = sig.general_gaussian(n_points, sig=150, p=1.5)
plt.figure(figsize=(12, 8))
plt.plot(window)
plt.xlim([0, n_points])
plt.title('Generalized Gaussian ($\sigma$=150, $p=1.5$)')
<matplotlib.text.Text at 0x7fb3218b1a10>
window = sig.hamming(n_points)
plt.figure(figsize=(12, 8))
plt.plot(window)
plt.xlim([0, n_points])
plt.title('Hamming')
<matplotlib.text.Text at 0x7fb3217c48d0>
window = sig.hann(n_points)
plt.figure(figsize=(12, 8))
plt.plot(window)
plt.xlim([0, n_points])
plt.title('Hann')
<matplotlib.text.Text at 0x7fb3216f0e10>
window = sig.kaiser(n_points, beta=14)
plt.figure(figsize=(12, 8))
plt.plot(window)
plt.xlim([0, n_points])
plt.title('Kaiser (beta=14)')
<matplotlib.text.Text at 0x7fb3216a0f50>
window = sig.nuttall(n_points)
plt.figure(figsize=(12, 8))
plt.plot(window)
plt.xlim([0, n_points])
plt.title('Nuttall')
<matplotlib.text.Text at 0x7fb3215c4f10>
window = sig.parzen(n_points)
plt.figure(figsize=(12, 8))
plt.plot(window)
plt.xlim([0, n_points])
plt.title('Parzen')
<matplotlib.text.Text at 0x7fb321596850>
window = sig.slepian(n_points, width=0.02)
plt.figure(figsize=(12, 8))
plt.plot(window)
plt.xlim([0, n_points])
plt.title('DPSS (width=0.002)')
<matplotlib.text.Text at 0x7fb3214d75d0>
window = sig.triang(n_points)
plt.figure(figsize=(12, 8))
plt.plot(window)
plt.xlim([0, n_points])
plt.title('Triangular')
<matplotlib.text.Text at 0x7fb3213c9b10>
arg_map = {
'barthann': [sig.barthann, dict(M=n_points)],
'bartlett': [sig.bartlett, dict(M=n_points)],
'blackman': [sig.blackman, dict(M=n_points)],
'blackmanharris': [sig.blackmanharris, dict(M=n_points)],
'bohman': [sig.bohman, dict(M=n_points)],
'boxcar': [sig.boxcar, dict(M=n_points)],
'chebwin': [sig.chebwin, dict(M=n_points, at=100)],
'cosine': [sig.cosine, dict(M=n_points)],
'flattop': [sig.flattop, dict(M=n_points)],
'gaussian': [sig.gaussian, dict(M=n_points, std=130)],
'general_gaussian': [sig.general_gaussian, dict(M=n_points, sig=150, p=1.5)],
'hamming': [sig.hamming, dict(M=n_points)],
'hann': [sig.hann, dict(M=n_points)],
'kaiser': [sig.kaiser, dict(M=n_points, beta=14)],
'nuttall': [sig.nuttall, dict(M=n_points)],
'parzen': [sig.parzen, dict(M=n_points)],
'selpian': [sig.slepian, dict(M=n_points, width=0.02)],
'triang': [sig.triang, dict(M=n_points)]
}
plt.figure(figsize=(15, 15))
plt.xlim([0, n_points])
for name, calldata in arg_map.iteritems():
function, args = calldata
window = function(**args)
plt.plot(window, label=name)
plt.legend()
<matplotlib.legend.Legend at 0x7fb3212ded50>