saftig.external.spicypy_wf¶
A wrapper for spicypy.signal.WienerFilter with the saftig.common.FilterBase interface. This is intended to allow comparisons between the implementations.
Classes¶
A wrapper for the spicypy WF implementation |
Module Contents¶
- class saftig.external.spicypy_wf.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
- supports_multi_sequence = False¶
- 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: collections.abc.Sequence | numpy.typing.NDArray, target: None, sample_rate: float = 1.0) tuple[collections.abc.Sequence[spicypy.signal.TimeSeries], None]¶
- static make_spicypy_time_series(witness: collections.abc.Sequence | numpy.typing.NDArray, target: collections.abc.Sequence | numpy.typing.NDArray, sample_rate: float = 1.0) tuple[collections.abc.Sequence[spicypy.signal.TimeSeries], spicypy.signal.TimeSeries]
Convert the given witness and target signals to the format required by spicypy.
- Parameters:
witness – Witness sensor data
target – Target sensor data
sample_rate – The sample rate of the time series
- 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
- condition_multi_sequence(witness, target)¶
Not supported
- Parameters:
witness (collections.abc.Sequence | collections.abc.Sequence[collections.abc.Sequence] | numpy.typing.NDArray) –
target (collections.abc.Sequence | numpy.typing.NDArray) –
- apply(witness, target=None, 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 (collections.abc.Sequence | numpy.typing.NDArray | None) – 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
- apply_multi_sequence(witness, target, pad=True, update_state=False)¶
Not supported
- Parameters:
witness (collections.abc.Sequence | numpy.typing.NDArray) –
target (collections.abc.Sequence | numpy.typing.NDArray | None) –
pad (bool) –
update_state (bool) –
- Return type:
collections.abc.Sequence[numpy.typing.NDArray]