components.interp.filtergenerator
- class FilterGenerator(config={}, **kwds)[source]
Bases:
ComponentClassic filter generator component.
Create a filter from a Hamming windowed sinc function. The cut frequency is set to the “Nyquist limit” (half the sampling frequency) of the input or output sampling frequency, whichever is the lower. This cut frequency can be adjusted with the
xcutandycutconfiguration.Connecting a
FilterGeneratorcomponent’soutputto aResizecomponent’sfilterinput allows the filter to be updated (while the components are running) by changing theFilterGeneratorconfig:filgen = FilterGenerator(xup=2, xaperture=16) resize = Resize(xup=2) filgen.connect('output', resize.filter) ... start(..., filgen, resize, ...) ... filgen.set_config({'xaperture': 8}) ...
If you don’t need to change the configuration after creating the
Resizecomponent then it’s simpler to use aFilterGeneratorCoreto create a fixed filter.2-dimensional filters can be produced by setting both
xapertureandyaperture, but it is usually more efficient to use twoResizecomponents to process the two dimensions independently.Config:
xupint
Horizontal up-conversion factor.
xdownint
Horizontal down-conversion factor.
xapertureint
Horizontal filter aperture.
xcutint
Adjust horizontal cut frequency. Default is 100%.
yupint
Vertical up-conversion factor.
ydownint
Vertical down-conversion factor.
yapertureint
Vertical filter aperture.
ycutint
Adjust vertical cut frequency. Default is 100%.
- classmethod core(x_up=1, x_down=1, x_ap=1, x_cut=100, y_up=1, y_down=1, y_ap=1, y_cut=100)[source]
Classic filter generator core.
Alternative to the
FilterGeneratorcomponent that can be used to make a non-reconfigurable resizer:resize = Resize(xup=2) resize.filter(FilterGenerator.core(xup=2, xaperture=16)) ... start(..., resize, ...) ...
- Parameters:
x_up (int) – Horizontal up-conversion factor.
x_down (int) – Horizontal down-conversion factor.
x_ap (int) – Horizontal filter aperture.
x_cut (int) – Horizontal cut frequency adjustment.
y_up (int) – Vertical up-conversion factor.
y_down (int) – Vertical down-conversion factor.
y_ap (int) – Vertical filter aperture.
y_cut (int) – Vertical cut frequency adjustment.
- Returns:
A
Frameobject containing the filter.
Comments or questions? Please email jim@jim-easterbrook.me.uk.