saftig.filtering.uwf¶
Updating Wiener Filter
Classes¶
Updating Wiener filter implementation |
Module Contents¶
- class saftig.filtering.uwf.UpdatingWienerFilter(n_filter, idx_target, n_channel=1, context_pre=0, context_post=0)¶
Bases:
saftig.filtering.common.FilterBaseUpdating Wiener filter implementation
- Parameters:
n_filter (int) – Length of the FIR filter (how many samples are in the input window per output sample)
idx_target (int) – Position of the prediction
n_channel (int) – Number of witness sensor channels
context_pre (int) – how many additional samples before the current block are used to update the filters
context_post (int) – how many additional samples after the current block are used to update the filters
>>> import saftig as sg >>> n_filter = 128 >>> witness, target = sg.evaluation.TestDataGenerator(0.1).generate(int(1e5)) >>> filt = sg.filtering.UpdatingWienerFilter(n_filter, 0, 1, context_pre=20*n_filter, context_post=20*n_filter) >>> prediction = filt.apply(witness, target) # check on the data used for conditioning >>> residual_rms = sg.evaluation.rms(target-prediction) >>> residual_rms > 0.05 and residual_rms < 0.15 # the expected RMS in this test scenario is 0.1 True
- context_pre: int¶
- context_post: int¶
- filter_name: str = 'UWF'¶
- filter_state: numpy.typing.NDArray | None = None¶
- static supports_saving_loading()¶
Indicates whether saving and loading is supported.
- condition(witness, target, hide_warning=False)¶
Placeholder for compatibility to other filters; does nothing!
- Parameters:
witness (collections.abc.Sequence | numpy.typing.NDArray) –
target (collections.abc.Sequence | numpy.typing.NDArray) –
hide_warning (bool) –
- Return type:
None
- apply(witness, target, pad=True, update_state=False)¶
Apply the filter to input data
- Parameters:
witness (collections.abc.Sequence | numpy.typing.NDArray) – Witness sensor data
target (collections.abc.Sequence | numpy.typing.NDArray) – Target sensor data (is ignored)
pad (bool) – if True, apply padding zeros so that the length matches the target signal
update_state (bool) – ignored
- Returns:
prediction, bool indicating if all WF updates had full rank
- Return type:
numpy.typing.NDArray