HWindow
A collection of window functions.
Methods
barthann
barthann(npoints: integer, sym: bool, dtype: HDataType) -> HArray
source
Returns a modified Bartlett-Hann window.
The maximum value is normalized to 1 (though the value 1 does not appear if npoints
is even and window_type
is symmetric).
Arguments
npoints
An integer
. Number of points in the output window.
sym
A bool
.
When TRUE
, generates a symmetric window, for use in filter design.
When FALSE
, generates a periodic window, for use in spectral analysis.
dtype
An HDataType
to indicate which type of HArray
to be created.
Must be a float dtype.
Returns
An HArray
.
Examples
library(harmnonium)
$barthann(npoints = 10L, sym = TRUE, dtype = HDataType$Float64) HWindow
bartlett
bartlett(npoints: integer, sym: bool, dtype: HDataType) -> HArray
source
\(w(n) = \frac{2}{npoints-1} (\frac{npoints-1}{2} - |n - \frac{npoints-1}{2}|)\)
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.
The maximum value is normalized to 1 (though the value 1 does not appear if npoints
is even and window_type
is symmetric.
Arguments
npoints
An integer
. Number of points in the output window.
sym
A bool
.
When TRUE
, generates a symmetric window, for use in filter design.
When FALSE
, generates a periodic window, for use in spectral analysis.
dtype
An HDataType
to indicate which type of HArray
to be created.
Must be a float dtype.
Returns
An HArray
.
Examples
library(harmnonium)
$bartlett(npoints = 10L, sym = TRUE, dtype = HDataType$Float64) HWindow
blackman
blackman(npoints: integer, sym: bool, dtype: HDataType) -> HArray
source
Returns a Blackman window.
\(w(n) = 0.42 - 0.5 \cos(2\pi n/npoints) + 0.08 \cos(4\pi n/npoints)\)
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.
The maximum value is normalized to 1 (though the value 1 does not appear if npoints
is even and sym
is TRUE
).
The “exact Blackman” window was designed to null out the third and fourth sidelobes, but has discontinuities at the boundaries, resulting in a 6 dB/oct fall-off. This window is an approximation of the “exact” window, which does not null the sidelobes as well, but is smooth at the edges, improving the fall-off rate to 18 dB/oct.
Most references to the Blackman window come from the signal processing literature, where it is used as one of many windowing functions for smoothing values. It is also known as an apodization (which means “removing the foot”, i.e. smoothing discontinuities at the beginning and end of the sampled signal) or tapering function. It is known as a “near optimal” tapering function, almost as good (by some measures) as the Kaiser window.
Arguments
npoints
An integer
. Number of points in the output window.
sym
A bool
.
When TRUE
, generates a symmetric window, for use in filter design.
When FALSE
, generates a periodic window, for use in spectral analysis.
dtype
An HDataType
to indicate which type of HArray
to be created.
Must be a float dtype.
Returns
An HArray
.
Examples
library(harmnonium)
$blackman(npoints = 10L, sym = TRUE, dtype = HDataType$Float64) HWindow
blackmanharris
blackmanharris(npoints: integer, sym: bool, dtype: HDataType) -> HArray
source
Return a minimum 4-term Blackman-Harris window.
The maximum value is normalized to 1 (though the value 1 does not appear if npoints
is even and window_type
is symmetric.
Arguments
npoints
An integer
. Number of points in the output window.
sym
A bool
.
When TRUE
, generates a symmetric window, for use in filter design.
When FALSE
, generates a periodic window, for use in spectral analysis.
dtype
An HDataType
to indicate which type of HArray
to be created.
Must be a float dtype.
Returns
An HArray
.
Examples
library(harmnonium)
$blackmanharris(npoints = 10L, sym = TRUE, dtype = HDataType$Float64) HWindow
bohman
bohman(npoints: integer, sym: bool, dtype: HDataType) -> HArray
source
Returns a Bohman window.
The maximum value is normalized to 1 (though the value 1 does not appear if npoints
is even and window_type
is symmetric).
Arguments
npoints
An integer
. Number of points in the output window.
sym
A bool
.
When TRUE
, generates a symmetric window, for use in filter design.
When FALSE
, generates a periodic window, for use in spectral analysis.
dtype
An HDataType
to indicate which type of HArray
to be created.
Must be a float dtype.
Returns
An HArray
.
Examples
library(harmnonium)
$bohman(npoints = 10L, sym = TRUE, dtype = HDataType$Float64) HWindow
boxcar
boxcar(npoints: integer, dtype: HDataType) -> HArray
source
Returns a boxcar or rectangular window.
Also known as a rectangular window or Dirichlet window, this is equivalent to no window at all.
Arguments
npoints
An integer
. Number of points in the output window.
dtype
An HDataType
to indicate which type of HArray
to be created.
Must be a float dtype.
Returns
An HArray
.
Examples
library(harmnonium)
$boxcar(npoints = 10L, dtype = HDataType$Float64) HWindow
cosine
cosine(npoints: integer, sym: bool, dtype: HDataType) -> HArray
source
Returns a window with a simple cosine shape.
The maximum value is normalized to 1 (though the value 1 does not appear if npoints
is even and window_type
is symmetric).
Arguments
npoints
An integer
. Number of points in the output window.
sym
A bool
.
When TRUE
, generates a symmetric window, for use in filter design.
When FALSE
, generates a periodic window, for use in spectral analysis.
dtype
An HDataType
to indicate which type of HArray
to be created.
Must be a float dtype.
Returns
An HArray
.
Examples
library(harmnonium)
$cosine(npoints = 10L, sym = TRUE, dtype = HDataType$Float64) HWindow
hann
hann(npoints: integer, sym: bool, dtype: HDataType) -> HArray
source
Returns a Hann window.
\(w(n) = 0.5 - 0.5 \cos\left(\frac{2\pi{n}}{npoints-1}\right) \qquad 0 \leq n \leq npoints-1\)
The maximum value is normalized to 1 (though the value 1 does not appear if npoints
is even and window_type
is symmetric.
The Hann window is a taper formed by using a raised cosine or sine-squared with ends that touch zero.
Arguments
npoints
An integer
. Number of points in the output window.
sym
A bool
.
When TRUE
, generates a symmetric window, for use in filter design.
When FALSE
, generates a periodic window, for use in spectral analysis.
dtype
An HDataType
to indicate which type of HArray
to be created.
Must be a float dtype.
Returns
An HArray
.
Examples
library(harmnonium)
$hann(npoints = 10L, sym = TRUE, dtype = HDataType$Float64) HWindow