View Source NxSignal.Windows (NxSignal v0.1.0)
Common window functions.
Link to this section Summary
Functions: Windowing
Bartlett triangular window.
Blackman window.
Hamming window.
Hann window.
Rectangular window.
Triangular window.
Link to this section Functions: Windowing
Bartlett triangular window.
See also: triangular/1
options
Options
:n
- The window length. Mandatory option.:type
- the output type for the window. Defaults to{:f, 32}
:name
- the axis name. Defaults tonil
examples
Examples
iex> NxSignal.Windows.bartlett(n: 3)
#Nx.Tensor<
f32[3]
[0.0, 0.6666666865348816, 0.6666666269302368]
>
Blackman window.
options
Options
:n
- The window length. Mandatory option.:is_periodic
- Iftrue
, produces a periodic window, otherwise produces a symmetric window. Defaults totrue
:type
- the output type for the window. Defaults to{:f, 32}
:name
- the axis name. Defaults tonil
examples
Examples
iex> NxSignal.Windows.blackman(n: 5, is_periodic: false)
#Nx.Tensor<
f32[5]
[-1.4901161193847656e-8, 0.3400000333786011, 0.9999999403953552, 0.3400000333786011, -1.4901161193847656e-8]
>
iex> NxSignal.Windows.blackman(n: 5, is_periodic: true)
#Nx.Tensor<
f32[5]
[-1.4901161193847656e-8, 0.20077012479305267, 0.8492299318313599, 0.8492299318313599, 0.20077012479305267]
>
iex> NxSignal.Windows.blackman(n: 6, is_periodic: true, type: {:f, 32})
#Nx.Tensor<
f32[6]
[-1.4901161193847656e-8, 0.12999999523162842, 0.6299999952316284, 0.9999999403953552, 0.6299999952316284, 0.12999999523162842]
>
Hamming window.
options
Options
:n
- The window length. Mandatory option.:is_periodic
- Iftrue
, produces a periodic window, otherwise produces a symmetric window. Defaults totrue
:type
- the output type for the window. Defaults to{:f, 32}
:name
- the axis name. Defaults tonil
examples
Examples
iex> NxSignal.Windows.hamming(n: 5, is_periodic: true)
#Nx.Tensor<
f32[5]
[0.08000001311302185, 0.39785221219062805, 0.9121478796005249, 0.9121478199958801, 0.3978521227836609]
>
iex> NxSignal.Windows.hamming(n: 5, is_periodic: false)
#Nx.Tensor<
f32[5]
[0.08000001311302185, 0.5400000214576721, 1.0, 0.5400000214576721, 0.08000001311302185]
>
Hann window.
options
Options
:n
- The window length. Mandatory option.:is_periodic
- Iftrue
, produces a periodic window, otherwise produces a symmetric window. Defaults totrue
:type
- the output type for the window. Defaults to{:f, 32}
:name
- the axis name. Defaults tonil
examples
Examples
iex> NxSignal.Windows.hann(n: 5, is_periodic: false)
#Nx.Tensor<
f32[5]
[0.0, 0.5, 1.0, 0.5, 0.0]
>
iex> NxSignal.Windows.hann(n: 5, is_periodic: true)
#Nx.Tensor<
f32[5]
[0.0, 0.34549152851104736, 0.9045085310935974, 0.9045084714889526, 0.3454914391040802]
>
Rectangular window.
Useful for when no window function should be applied.
options
Options
:n
- the window length:type
- the output type. Defaults tos64
examples
Examples
iex> NxSignal.Windows.rectangular(n: 5)
#Nx.Tensor<
s64[5]
[1, 1, 1, 1, 1]
>
iex> NxSignal.Windows.rectangular(n: 5, type: :f32)
#Nx.Tensor<
f32[5]
[1.0, 1.0, 1.0, 1.0, 1.0]
>
Triangular window.
See also: bartlett/1
options
Options
:n
- The window length. Mandatory option.:type
- the output type for the window. Defaults to{:f, 32}
:name
- the axis name. Defaults tonil
examples
Examples
iex> NxSignal.Windows.triangular(n: 3)
#Nx.Tensor<
f32[3]
[0.5, 1.0, 0.5]
>