MCPcopy
hub / github.com/numpy/numpy / blackman

Function blackman

numpy/lib/_function_base_impl.py:3050–3145  ·  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

3048
3049@set_module('numpy')
3050def blackman(M):
3051 """
3052 Return the Blackman window.
3053
3054 The Blackman window is a taper formed by using the first three
3055 terms of a summation of cosines. It was designed to have close to the
3056 minimal leakage possible. It is close to optimal, only slightly worse
3057 than a Kaiser window.
3058
3059 Parameters
3060 ----------
3061 M : int
3062 Number of points in the output window. If zero or less, an empty
3063 array is returned.
3064
3065 Returns
3066 -------
3067 out : ndarray
3068 The window, with the maximum value normalized to one (the value one
3069 appears only if the number of samples is odd).
3070
3071 See Also
3072 --------
3073 bartlett, hamming, hanning, kaiser
3074
3075 Notes
3076 -----
3077 The Blackman window is defined as
3078
3079 .. math:: w(n) = 0.42 - 0.5 \\cos(2\\pi n/M) + 0.08 \\cos(4\\pi n/M)
3080
3081 Most references to the Blackman window come from the signal processing
3082 literature, where it is used as one of many windowing functions for
3083 smoothing values. It is also known as an apodization (which means
3084 "removing the foot", i.e. smoothing discontinuities at the beginning
3085 and end of the sampled signal) or tapering function. It is known as a
3086 "near optimal" tapering function, almost as good (by some measures)
3087 as the Kaiser window.
3088
3089 References
3090 ----------
3091 .. [1] Blackman, R.B. and Tukey, J.W., (1958)
3092 The measurement of power spectra, Dover Publications, New York.
3093 .. [2] Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing.
3094 Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471.
3095
3096 Examples
3097 --------
3098 >>> import numpy as np
3099 >>> import matplotlib.pyplot as plt
3100 >>> np.blackman(12)
3101 array([-1.38777878e-17, 3.26064346e-02, 1.59903635e-01, # may vary
3102 4.14397981e-01, 7.36045180e-01, 9.67046769e-01,
3103 9.67046769e-01, 7.36045180e-01, 4.14397981e-01,
3104 1.59903635e-01, 3.26064346e-02, -1.38777878e-17])
3105
3106 Plot the window and the frequency response.
3107

Callers 1

test_blackmanMethod · 0.90

Calls 2

onesFunction · 0.90
arrayFunction · 0.50

Tested by 1

test_blackmanMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…