components.fft.window
General 2-D window. |
|
Hann window. |
|
Hamming window. |
|
Blackman window. |
|
Kaiser-Bessel window. |
|
Generate "inverse" window function with inter-tile cross-fade. |
|
|
|
|
|
|
|
|
FFT window functions.
Window functions are used with Fourier transforms to give some control over the trade-off between frequency resolution and “leakage”. See Wikipedia for a good introduction to the subject.
This module contains components to generate several popular window functions, and one to generate a corresponding “inverse window”. This can be used to reconstruct a signal from its Fourier transform. Note that overlapping tiles are almost essential to avoid visible tile edge effects when doing this. The inverse windows compensate for the attenuation of the original window and “cross fade” from one tile to the next, overlapping, tile. There is a choice of crossfade function.
For each window function component there is a “core” function. This
generates a single Frame containing
the window data. This is useful if you don’t need to change the window
while your network of components is running. For example:
window = Modulate()
window.cell(HammingCore(xtile=32, ytile=32))
creates a windowing component that uses a 32x32 Hamming window. Its
cell input does not need to be connected to anything.
Hann window. |
|
|
|
Hamming window. |
|
|
|
Blackman window. |
|
|
|
Kaiser-Bessel window. |
|
|
|
Generate "inverse" window function with inter-tile cross-fade. |
- class Window(config={}, **kwds)[source]
Bases:
ComponentGeneral 2-D window.
The
functionparameter selects one of several widely used 1-D window functions. Thesymparameter makes the window symmetrical or not. Note that a symmetrical window with an even size does not have a central value of unity.alphais the control parameter for theKaiserwindow. Seenumpy.kaiserfor more detail. Note that NumPy and SciPy use a control parameter calledbeta, which isalpha * pi.The
combine2Dparameter selects how the horizontal and vertical windows are combined to make a 2-D window. (If either dimension has size one it has no effect.) The option names refer to the shape of the contours if you plotted the window.squaremeans the two windows are simply multiplied together.roundmeans the window value depends on the normalised distance from the centre of the window, with points further than 0.5 set to zero.round2is an alternative that is normalised to the diagonal, so no points are further than 0.5.Config
xtileint
Horizontal tile size.
ytileint
Vertical tile size.
symbool
When True (default), generates a symmetric window.
combine2Dstr
How to combine 1-D windows to make 2-D window. Can be
square,roundorround2.functionstr
Choose the window function. Possible values:
'Hann','Hamming','Blackman','Kaiser'alphafloat
Window control parameter.
- class Hann(config={}, **kwds)[source]
Bases:
WindowBaseHann window.
Config
xtileint
Horizontal tile size.
ytileint
Vertical tile size.
symbool
When True (default), generates a symmetric window.
- class Hamming(config={}, **kwds)[source]
Bases:
WindowBaseHamming window.
Config
xtileint
Horizontal tile size.
ytileint
Vertical tile size.
symbool
When True (default), generates a symmetric window.
- class Blackman(config={}, **kwds)[source]
Bases:
WindowBaseBlackman window.
Config
xtileint
Horizontal tile size.
ytileint
Vertical tile size.
symbool
When True (default), generates a symmetric window.
alphafloat
Window control parameter.
- class Kaiser(config={}, **kwds)[source]
Bases:
WindowBaseKaiser-Bessel window.
See
numpy.kaiserfor more detail. Note that NumPy and SciPy use a control parameter calledbeta. This isalpha * pi.Config
xtileint
Horizontal tile size.
ytileint
Vertical tile size.
symbool
When True (default), generates a symmetric window.
alphafloat
Window control parameter.
- class InverseWindow(config={}, **kwds)[source]
Bases:
ComponentGenerate “inverse” window function with inter-tile cross-fade.
The
fadeconfig value determines the transition from one tile to the next, within their area of overlap.'switch'abruptly cuts from one tile to the next,'linear'does a cross-fade and'minsnr'does a weighted cross-fade to minimise signal to noise ratio.Config
xtileint
Horizontal tile size.
ytileint
Vertical tile size.
xoffint
Horizontal tile offset. Typically set to xtile / 2.
yoffint
Vertical tile offset. Typically set to ytile / 2.
fadestr
Can be
'switch','linear'or'minsnr'.- outputs = ['window', 'inv_window']
Comments or questions? Please email jim@jim-easterbrook.me.uk.