MCPcopy Create free account
hub / github.com/numpy/numpy / blackman

Function blackman

numpy/lib/function_base.py:2911–3012  ·  view source on GitHub ↗

Return the Blackman window. The Blackman window is a taper formed by using the first three terms of a summation of cosines. It was designed to have close to the minimal leakage possible. It is close to optimal, only slightly worse than a Kaiser window. Parameters ----

(M)

Source from the content-addressed store, hash-verified

2909
2910@set_module('numpy')
2911def blackman(M):
2912 """
2913 Return the Blackman window.
2914
2915 The Blackman window is a taper formed by using the first three
2916 terms of a summation of cosines. It was designed to have close to the
2917 minimal leakage possible. It is close to optimal, only slightly worse
2918 than a Kaiser window.
2919
2920 Parameters
2921 ----------
2922 M : int
2923 Number of points in the output window. If zero or less, an empty
2924 array is returned.
2925
2926 Returns
2927 -------
2928 out : ndarray
2929 The window, with the maximum value normalized to one (the value one
2930 appears only if the number of samples is odd).
2931
2932 See Also
2933 --------
2934 bartlett, hamming, hanning, kaiser
2935
2936 Notes
2937 -----
2938 The Blackman window is defined as
2939
2940 .. math:: w(n) = 0.42 - 0.5 \\cos(2\\pi n/M) + 0.08 \\cos(4\\pi n/M)
2941
2942 Most references to the Blackman window come from the signal processing
2943 literature, where it is used as one of many windowing functions for
2944 smoothing values. It is also known as an apodization (which means
2945 "removing the foot", i.e. smoothing discontinuities at the beginning
2946 and end of the sampled signal) or tapering function. It is known as a
2947 "near optimal" tapering function, almost as good (by some measures)
2948 as the kaiser window.
2949
2950 References
2951 ----------
2952 Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra,
2953 Dover Publications, New York.
2954
2955 Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing.
2956 Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471.
2957
2958 Examples
2959 --------
2960 >>> import matplotlib.pyplot as plt
2961 >>> np.blackman(12)
2962 array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary
2963 4.14397981e-01, 7.36045180e-01, 9.67046769e-01,
2964 9.67046769e-01, 7.36045180e-01, 4.14397981e-01,
2965 1.59903635e-01, 3.26064346e-02, -1.38777878e-17])
2966
2967 Plot the window and the frequency response:
2968

Callers 1

test_blackmanMethod · 0.90

Calls 4

onesFunction · 0.90
arangeFunction · 0.85
cosFunction · 0.85
arrayFunction · 0.50

Tested by 1

test_blackmanMethod · 0.72