@@ -2081,8 +2081,8 @@ def blackman(M):
2081
2081
Returns
2082
2082
-------
2083
2083
out : ndarray
2084
- The window, normalized to one (the value one appears only if the
2085
- number of samples is odd).
2084
+ The window, with the maximum value normalized to one (the value one
2085
+ appears only if the number of samples is odd).
2086
2086
2087
2087
See Also
2088
2088
--------
@@ -2112,8 +2112,7 @@ def blackman(M):
2112
2112
2113
2113
Examples
2114
2114
--------
2115
- >>> from numpy import blackman
2116
- >>> blackman(12)
2115
+ >>> np.blackman(12)
2117
2116
array([ -1.38777878e-17, 3.26064346e-02, 1.59903635e-01,
2118
2117
4.14397981e-01, 7.36045180e-01, 9.67046769e-01,
2119
2118
9.67046769e-01, 7.36045180e-01, 4.14397981e-01,
@@ -2122,11 +2121,8 @@ def blackman(M):
2122
2121
2123
2122
Plot the window and the frequency response:
2124
2123
2125
- >>> from numpy import clip, log10, array, blackman, linspace
2126
2124
>>> from numpy.fft import fft, fftshift
2127
- >>> import matplotlib.pyplot as plt
2128
-
2129
- >>> window = blackman(51)
2125
+ >>> window = np.blackman(51)
2130
2126
>>> plt.plot(window)
2131
2127
[<matplotlib.lines.Line2D object at 0x...>]
2132
2128
>>> plt.title("Blackman window")
@@ -2140,10 +2136,10 @@ def blackman(M):
2140
2136
>>> plt.figure()
2141
2137
<matplotlib.figure.Figure object at 0x...>
2142
2138
>>> A = fft(window, 2048) / 25.5
2143
- >>> mag = abs(fftshift(A))
2144
- >>> freq = linspace(-0.5,0.5,len(A))
2145
- >>> response = 20* log10(mag)
2146
- >>> response = clip(response,-100,100)
2139
+ >>> mag = np. abs(fftshift(A))
2140
+ >>> freq = np. linspace(-0.5, 0.5, len(A))
2141
+ >>> response = 20 * np. log10(mag)
2142
+ >>> response = np. clip(response, -100, 100)
2147
2143
>>> plt.plot(freq, response)
2148
2144
[<matplotlib.lines.Line2D object at 0x...>]
2149
2145
>>> plt.title("Frequency response of Blackman window")
@@ -2182,9 +2178,9 @@ def bartlett(M):
2182
2178
Returns
2183
2179
-------
2184
2180
out : array
2185
- The triangular window, normalized to one ( the value one
2186
- appears only if the number of samples is odd), with the first
2187
- and last samples equal to zero.
2181
+ The triangular window, with the maximum value normalized to one
2182
+ (the value one appears only if the number of samples is odd), with
2183
+ the first and last samples equal to zero.
2188
2184
2189
2185
See Also
2190
2186
--------
@@ -2231,11 +2227,8 @@ def bartlett(M):
2231
2227
2232
2228
Plot the window and its frequency response (requires SciPy and matplotlib):
2233
2229
2234
- >>> from numpy import clip, log10, array, bartlett, linspace
2235
2230
>>> from numpy.fft import fft, fftshift
2236
- >>> import matplotlib.pyplot as plt
2237
-
2238
- >>> window = bartlett(51)
2231
+ >>> window = np.bartlett(51)
2239
2232
>>> plt.plot(window)
2240
2233
[<matplotlib.lines.Line2D object at 0x...>]
2241
2234
>>> plt.title("Bartlett window")
@@ -2249,10 +2242,10 @@ def bartlett(M):
2249
2242
>>> plt.figure()
2250
2243
<matplotlib.figure.Figure object at 0x...>
2251
2244
>>> A = fft(window, 2048) / 25.5
2252
- >>> mag = abs(fftshift(A))
2253
- >>> freq = linspace(-0.5,0.5,len(A))
2254
- >>> response = 20* log10(mag)
2255
- >>> response = clip(response,-100,100)
2245
+ >>> mag = np. abs(fftshift(A))
2246
+ >>> freq = np. linspace(-0.5, 0.5, len(A))
2247
+ >>> response = 20 * np. log10(mag)
2248
+ >>> response = np. clip(response, -100, 100)
2256
2249
>>> plt.plot(freq, response)
2257
2250
[<matplotlib.lines.Line2D object at 0x...>]
2258
2251
>>> plt.title("Frequency response of Bartlett window")
@@ -2288,8 +2281,8 @@ def hanning(M):
2288
2281
Returns
2289
2282
-------
2290
2283
out : ndarray, shape(M,)
2291
- The window, normalized to one (the value one
2292
- appears only if `M` is odd).
2284
+ The window, with the maximum value normalized to one (the value
2285
+ one appears only if `M` is odd).
2293
2286
2294
2287
See Also
2295
2288
--------
@@ -2325,17 +2318,14 @@ def hanning(M):
2325
2318
2326
2319
Examples
2327
2320
--------
2328
- >>> from numpy import hanning
2329
- >>> hanning(12)
2321
+ >>> np.hanning(12)
2330
2322
array([ 0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037,
2331
2323
0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249,
2332
2324
0.07937323, 0. ])
2333
2325
2334
2326
Plot the window and its frequency response:
2335
2327
2336
2328
>>> from numpy.fft import fft, fftshift
2337
- >>> import matplotlib.pyplot as plt
2338
-
2339
2329
>>> window = np.hanning(51)
2340
2330
>>> plt.plot(window)
2341
2331
[<matplotlib.lines.Line2D object at 0x...>]
@@ -2350,10 +2340,10 @@ def hanning(M):
2350
2340
>>> plt.figure()
2351
2341
<matplotlib.figure.Figure object at 0x...>
2352
2342
>>> A = fft(window, 2048) / 25.5
2353
- >>> mag = abs(fftshift(A))
2354
- >>> freq = np.linspace(-0.5,0.5,len(A))
2355
- >>> response = 20* np.log10(mag)
2356
- >>> response = np.clip(response,-100,100)
2343
+ >>> mag = np. abs(fftshift(A))
2344
+ >>> freq = np.linspace(-0.5, 0.5, len(A))
2345
+ >>> response = 20 * np.log10(mag)
2346
+ >>> response = np.clip(response, -100, 100)
2357
2347
>>> plt.plot(freq, response)
2358
2348
[<matplotlib.lines.Line2D object at 0x...>]
2359
2349
>>> plt.title("Frequency response of the Hann window")
@@ -2367,10 +2357,6 @@ def hanning(M):
2367
2357
>>> plt.show()
2368
2358
2369
2359
"""
2370
- # XXX: this docstring is inconsistent with other filter windows, e.g.
2371
- # Blackman and Bartlett - they should all follow the same convention for
2372
- # clarity. Either use np. for all numpy members (as above), or import all
2373
- # numpy members (as in Blackman and Bartlett examples)
2374
2360
if M < 1 :
2375
2361
return array ([])
2376
2362
if M == 1 :
@@ -2393,8 +2379,8 @@ def hamming(M):
2393
2379
Returns
2394
2380
-------
2395
2381
out : ndarray
2396
- The window, normalized to one (the value one
2397
- appears only if the number of samples is odd).
2382
+ The window, with the maximum value normalized to one (the value
2383
+ one appears only if the number of samples is odd).
2398
2384
2399
2385
See Also
2400
2386
--------
@@ -2437,8 +2423,6 @@ def hamming(M):
2437
2423
Plot the window and the frequency response:
2438
2424
2439
2425
>>> from numpy.fft import fft, fftshift
2440
- >>> import matplotlib.pyplot as plt
2441
-
2442
2426
>>> window = np.hamming(51)
2443
2427
>>> plt.plot(window)
2444
2428
[<matplotlib.lines.Line2D object at 0x...>]
@@ -2638,8 +2622,8 @@ def kaiser(M,beta):
2638
2622
Returns
2639
2623
-------
2640
2624
out : array
2641
- The window, normalized to one (the value one
2642
- appears only if the number of samples is odd).
2625
+ The window, with the maximum value normalized to one (the value
2626
+ one appears only if the number of samples is odd).
2643
2627
2644
2628
See Also
2645
2629
--------
@@ -2682,7 +2666,6 @@ def kaiser(M,beta):
2682
2666
large enough to sample the increasingly narrow spike, otherwise nans will
2683
2667
get returned.
2684
2668
2685
-
2686
2669
Most references to the Kaiser window come from the signal processing
2687
2670
literature, where it is used as one of many windowing functions for
2688
2671
smoothing values. It is also known as an apodization (which means
@@ -2701,8 +2684,7 @@ def kaiser(M,beta):
2701
2684
2702
2685
Examples
2703
2686
--------
2704
- >>> from numpy import kaiser
2705
- >>> kaiser(12, 14)
2687
+ >>> np.kaiser(12, 14)
2706
2688
array([ 7.72686684e-06, 3.46009194e-03, 4.65200189e-02,
2707
2689
2.29737120e-01, 5.99885316e-01, 9.45674898e-01,
2708
2690
9.45674898e-01, 5.99885316e-01, 2.29737120e-01,
@@ -2711,11 +2693,8 @@ def kaiser(M,beta):
2711
2693
2712
2694
Plot the window and the frequency response:
2713
2695
2714
- >>> from numpy import clip, log10, array, kaiser, linspace
2715
2696
>>> from numpy.fft import fft, fftshift
2716
- >>> import matplotlib.pyplot as plt
2717
-
2718
- >>> window = kaiser(51, 14)
2697
+ >>> window = np.kaiser(51, 14)
2719
2698
>>> plt.plot(window)
2720
2699
[<matplotlib.lines.Line2D object at 0x...>]
2721
2700
>>> plt.title("Kaiser window")
@@ -2729,10 +2708,10 @@ def kaiser(M,beta):
2729
2708
>>> plt.figure()
2730
2709
<matplotlib.figure.Figure object at 0x...>
2731
2710
>>> A = fft(window, 2048) / 25.5
2732
- >>> mag = abs(fftshift(A))
2733
- >>> freq = linspace(-0.5,0.5,len(A))
2734
- >>> response = 20* log10(mag)
2735
- >>> response = clip(response,-100,100)
2711
+ >>> mag = np. abs(fftshift(A))
2712
+ >>> freq = np. linspace(-0.5, 0.5, len(A))
2713
+ >>> response = 20 * np. log10(mag)
2714
+ >>> response = np. clip(response, -100, 100)
2736
2715
>>> plt.plot(freq, response)
2737
2716
[<matplotlib.lines.Line2D object at 0x...>]
2738
2717
>>> plt.title("Frequency response of Kaiser window")
@@ -2809,7 +2788,6 @@ def sinc(x):
2809
2788
-5.84680802e-02, -8.90384387e-02, -8.40918587e-02,
2810
2789
-4.92362781e-02, -3.89804309e-17])
2811
2790
2812
- >>> import matplotlib.pyplot as plt
2813
2791
>>> plt.plot(x, np.sinc(x))
2814
2792
[<matplotlib.lines.Line2D object at 0x...>]
2815
2793
>>> plt.title("Sinc Function")
0 commit comments