MCPcopy Index your code
hub / github.com/numpy/numpy / bartlett

Function bartlett

numpy/lib/_function_base_impl.py:3149–3252  ·  view source on GitHub ↗

Return the Bartlett window. The Bartlett window is very similar to a triangular window, except that the end points are at zero. It is often used in signal processing for tapering a signal, without generating too much ripple in the frequency domain. Parameters --------

(M)

Source from the content-addressed store, hash-verified

3147
3148@set_module('numpy')
3149def bartlett(M):
3150 """
3151 Return the Bartlett window.
3152
3153 The Bartlett window is very similar to a triangular window, except
3154 that the end points are at zero. It is often used in signal
3155 processing for tapering a signal, without generating too much
3156 ripple in the frequency domain.
3157
3158 Parameters
3159 ----------
3160 M : int
3161 Number of points in the output window. If zero or less, an
3162 empty array is returned.
3163
3164 Returns
3165 -------
3166 out : array
3167 The triangular window, with the maximum value normalized to one
3168 (the value one appears only if the number of samples is odd), with
3169 the first and last samples equal to zero.
3170
3171 See Also
3172 --------
3173 blackman, hamming, hanning, kaiser
3174
3175 Notes
3176 -----
3177 The Bartlett window is defined as
3178
3179 .. math:: w(n) = \\frac{2}{M-1} \\left(
3180 \\frac{M-1}{2} - \\left|n - \\frac{M-1}{2}\\right|
3181 \\right)
3182
3183 Most references to the Bartlett window come from the signal processing
3184 literature, where it is used as one of many windowing functions for
3185 smoothing values. Note that convolution with this window produces linear
3186 interpolation. It is also known as an apodization (which means "removing
3187 the foot", i.e. smoothing discontinuities at the beginning and end of the
3188 sampled signal) or tapering function. The Fourier transform of the
3189 Bartlett window is the product of two sinc functions. Note the excellent
3190 discussion in Kanasewich [2]_.
3191
3192 References
3193 ----------
3194 .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra",
3195 Biometrika 37, 1-16, 1950.
3196 .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics",
3197 The University of Alberta Press, 1975, pp. 109-110.
3198 .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal
3199 Processing", Prentice-Hall, 1999, pp. 468-471.
3200 .. [4] Wikipedia, "Window function",
3201 https://en.wikipedia.org/wiki/Window_function
3202 .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling,
3203 "Numerical Recipes", Cambridge University Press, 1986, page 429.
3204
3205 Examples
3206 --------

Callers 1

test_bartlettMethod · 0.90

Calls 4

onesFunction · 0.90
less_equalFunction · 0.85
arrayFunction · 0.50
whereFunction · 0.50

Tested by 1

test_bartlettMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…