-
Notifications
You must be signed in to change notification settings - Fork 4
pyFRI.tools.filters
The pyFRI.tools.filters
module provides a set of filters to smooth state signals.
Abstract state filter class that provides functionality for a filter implementation.
A sub-class must provide an implementation for the filter
method. E.g.
class MyFilter(StateFilter):
def filter(self, x):
# ..filter implementation..
Constructor for the StateFilter
class.
Parameters
-
window_size
[int
]: The size of the data window used in the filtering process. The filter will operate on the most recent window_size joint states.
Reset the internal data buffer. This method clears the data buffer, removing all previously stored states.
Update the internal data buffer with new state.
This method maintains the buffer's size to the specified window_size
, discarding older states when the buffer size exceeds window_size
.
Parameters
-
x
[numpy.ndarray
]: array containing the most recent state to be added to the data buffer.
Abstract method to be implemented by subclasses. This method applies the specific filtering algorithm to the given state.
Parameters:
-
x
[numpy.ndarray
]: The state to be filtered.
Returns:
-
xf
[numpy.ndarray
]: The filtered states based on the specific filtering algorithm.
The ExponentialStateFilter
implements the exponential smoothing algorithm.
Constructor for the ExponentialStateFilter
class.
Parameters
-
smooth
[float
]: The smoothing factor used in the filter update. The value must be a float in the range[0, 1]
.
The MovingAverageFilter
implements the simple moving average algorithm.