saftig.external¶
Wrappers for other implementations of filtering techniques.
Submodules¶
Classes¶
A wrapper for the spicypy WF implementation |
Package Contents¶
- class saftig.external.SpicypyWienerFilter(n_filter, idx_target, n_channel=1)¶
Bases:
saftig.filtering.common.FilterBaseA wrapper for the spicypy WF 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
>>> import saftig as sg >>> n_filter = 10 >>> witness, target = sg.evaluation.TestDataGenerator(0.1).generate(int(1e3)) >>> filt = sg.external.SpicypyWienerFilter(n_filter, 0, 1) >>> sp_filt = filt.condition(witness, target) >>> prediction = filt.apply(witness, target) # apply to training data
- filter_name = 'SpicypyWF'¶
- conditioned = False¶
- filter_state: spicypy.signal.WienerFilter | None¶
- static supports_saving_loading()¶
Indicates whether saving and loading is supported.
- static make_spicypy_time_series(witness, target, sample_rate=1.0)¶
Convert the given witness and target signals to the format requried by spicypy.
- Parameters:
witness (collections.abc.Sequence | numpy.typing.NDArray) – Witness sensor data
target (Optional[collections.abc.Sequence | numpy.typing.NDArray]) – Target sensor data
sample_rate (float) – The sample rate of the time series
- Return type:
Tuple[spicypy.signal.TimeSeries, spicypy.signal.TimeSeries]
- condition(witness, target, sample_rate=1.0, use_multiprocessing=False)¶
Use an input dataset to condition the filter
- Parameters:
witness (collections.abc.Sequence | numpy.typing.NDArray) – Witness sensor data
target (collections.abc.Sequence | numpy.typing.NDArray) – Target sensor data
sample_rate (float) – The sample rate of the time series
use_multiprocessing (bool) –
- Return type:
spicypy.signal.WienerFilter
- apply(witness, target, pad=True, update_state=False, sample_rate=1.0)¶
Apply the filter to input data
- Parameters:
witness (collections.abc.Sequence | numpy.typing.NDArray) – Witness sensor data
target (Optional[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
sample_rate (float) –
- Returns:
prediction
- Return type:
numpy.typing.NDArray