Cyforanumera
npm

API reference

Window functions

Tapering windows used in signal processing, as in NumPy. They are computed natively in float64 with NumPy's formulas.

NameSummary
np.bartlettTriangular (Bartlett) window.
np.blackmanBlackman window: 0.42 + 0.5 cos(πn/(M-1)) + 0.08 cos(2πn/(M-1)).
np.hammingHamming window: 0.54 + 0.46 cos(πn/(M-1)).
np.hanningHann window: 0.5 + 0.5 cos(πn/(M-1)).
np.kaiserKaiser window: i0(beta·sqrt(1 - ((n - α)/α)²)) / i0(beta) with α = (M-1)/2, using NumPy's Chebyshev approximation of the Bessel function i0.

np.bartlett

#
np.bartlett(M)

Triangular (Bartlett) window. Returns M float64 values; an empty array when M < 1 and [1] when M = 1.

Parameters

Mnumber
Number of points.

Returns

NDArray

Example

TypeScript
np.bartlett(5); // => [0, 0.5, 1, 0.5, 0]
TypeScript declaration
np.bartlett(M: number | bigint | NDArray): NDArray

np.blackman

#
np.blackman(M)

Blackman window: 0.42 + 0.5 cos(πn/(M-1)) + 0.08 cos(2πn/(M-1)). Returns M float64 values; an empty array when M < 1 and [1] when M = 1.

Parameters

Mnumber
Number of points.

Returns

NDArray

Example

TypeScript
np.blackman(3); // => [-1.3877787807814457e-17, 1, -1.3877787807814457e-17]
TypeScript declaration
np.blackman(M: number | bigint | NDArray): NDArray

np.hamming

#
np.hamming(M)

Hamming window: 0.54 + 0.46 cos(πn/(M-1)). Returns M float64 values; an empty array when M < 1 and [1] when M = 1.

Parameters

Mnumber
Number of points.

Returns

NDArray

Example

TypeScript
np.hamming(3); // => [0.08000000000000002, 1, 0.08000000000000002]
TypeScript declaration
np.hamming(M: number | bigint | NDArray): NDArray

np.hanning

#
np.hanning(M)

Hann window: 0.5 + 0.5 cos(πn/(M-1)). Returns M float64 values; an empty array when M < 1 and [1] when M = 1.

Parameters

Mnumber
Number of points.

Returns

NDArray

Example

TypeScript
np.hanning(5); // => [0, 0.5, 1, 0.5, 0]
TypeScript declaration
np.hanning(M: number | bigint | NDArray): NDArray

np.kaiser

#
np.kaiser(M, beta)

Kaiser window: i0(beta·sqrt(1 - ((n - α)/α)²)) / i0(beta) with α = (M-1)/2, using NumPy's Chebyshev approximation of the Bessel function i0. beta = 0 gives a rectangular window.

Parameters

Mnumber
Number of points.
betanumber
Shape parameter.

Returns

NDArray

Example

TypeScript
np.kaiser(3, 0); // => [1, 1, 1]
np.kaiser(4, 5); // => [0.036710892271286676, 0.7753221044454067, 0.7753221044454067, 0.036710892271286676]
TypeScript declaration
np.kaiser(M: number | bigint | NDArray, beta: number | NDArray): NDArray