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

Function bartlett

numpy/lib/function_base.py:3016–3125  ·  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

3014
3015@set_module('numpy')
3016def bartlett(M):
3017 """
3018 Return the Bartlett window.
3019
3020 The Bartlett window is very similar to a triangular window, except
3021 that the end points are at zero. It is often used in signal
3022 processing for tapering a signal, without generating too much
3023 ripple in the frequency domain.
3024
3025 Parameters
3026 ----------
3027 M : int
3028 Number of points in the output window. If zero or less, an
3029 empty array is returned.
3030
3031 Returns
3032 -------
3033 out : array
3034 The triangular window, with the maximum value normalized to one
3035 (the value one appears only if the number of samples is odd), with
3036 the first and last samples equal to zero.
3037
3038 See Also
3039 --------
3040 blackman, hamming, hanning, kaiser
3041
3042 Notes
3043 -----
3044 The Bartlett window is defined as
3045
3046 .. math:: w(n) = \\frac{2}{M-1} \\left(
3047 \\frac{M-1}{2} - \\left|n - \\frac{M-1}{2}\\right|
3048 \\right)
3049
3050 Most references to the Bartlett window come from the signal processing
3051 literature, where it is used as one of many windowing functions for
3052 smoothing values. Note that convolution with this window produces linear
3053 interpolation. It is also known as an apodization (which means "removing
3054 the foot", i.e. smoothing discontinuities at the beginning and end of the
3055 sampled signal) or tapering function. The Fourier transform of the
3056 Bartlett window is the product of two sinc functions. Note the excellent
3057 discussion in Kanasewich [2]_.
3058
3059 References
3060 ----------
3061 .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra",
3062 Biometrika 37, 1-16, 1950.
3063 .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics",
3064 The University of Alberta Press, 1975, pp. 109-110.
3065 .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal
3066 Processing", Prentice-Hall, 1999, pp. 468-471.
3067 .. [4] Wikipedia, "Window function",
3068 https://en.wikipedia.org/wiki/Window_function
3069 .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling,
3070 "Numerical Recipes", Cambridge University Press, 1986, page 429.
3071
3072 Examples
3073 --------

Callers 1

test_bartlettMethod · 0.90

Calls 5

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

Tested by 1

test_bartlettMethod · 0.72