ezmsg.sigproc.ewma#
Functions
- ewma_step(sample, zi, alpha, beta=None)[source]#
Do an exponentially weighted moving average step.
- Parameters:
- Returns:
alpha * sample + beta * zi
Classes
- class EWMASettings(time_constant: float = 1.0, axis: str | None = None, accumulate: bool = True)[source]#
Bases:
Settings- time_constant: float = 1.0#
The amount of time for the smoothed response of a unit step function to reach 1 - 1/e approx-eq 63.2%.
- class EWMATransformer(*args, **kwargs)[source]#
Bases:
BaseStatefulTransformer[EWMASettings,AxisArray,AxisArray,EWMAState]
- class EWMAUnit(*args, settings=None, **kwargs)[source]#
Bases:
BaseTransformerUnit[EWMASettings,AxisArray,AxisArray,EWMATransformer]- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
EWMASettings
- async on_settings(msg)[source]#
Handle settings updates with smart reset behavior.
Only resets state if axis changes (structural change). Changes to time_constant or accumulate are applied without resetting accumulated state.
- Parameters:
msg (EWMASettings)
- Return type:
None
- class EWMA_Deprecated(alpha, max_len)[source]#
Bases:
objectGrabbed these methods from https://stackoverflow.com/a/70998068 and other answers in that topic, but they ended up being slower than the scipy.signal.lfilter method. Additionally, compute and compute2 suffer from potential errors as the vector length increases and beta**n approaches zero.
- ewma_step(sample, zi, alpha, beta=None)[source]#
Do an exponentially weighted moving average step.
- Parameters:
- Returns:
alpha * sample + beta * zi
- class EWMA_Deprecated(alpha, max_len)[source]#
Bases:
objectGrabbed these methods from https://stackoverflow.com/a/70998068 and other answers in that topic, but they ended up being slower than the scipy.signal.lfilter method. Additionally, compute and compute2 suffer from potential errors as the vector length increases and beta**n approaches zero.
- class EWMASettings(time_constant: float = 1.0, axis: str | None = None, accumulate: bool = True)[source]#
Bases:
Settings- time_constant: float = 1.0#
The amount of time for the smoothed response of a unit step function to reach 1 - 1/e approx-eq 63.2%.
- class EWMATransformer(*args, **kwargs)[source]#
Bases:
BaseStatefulTransformer[EWMASettings,AxisArray,AxisArray,EWMAState]
- class EWMAUnit(*args, settings=None, **kwargs)[source]#
Bases:
BaseTransformerUnit[EWMASettings,AxisArray,AxisArray,EWMATransformer]- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
EWMASettings
- async on_settings(msg)[source]#
Handle settings updates with smart reset behavior.
Only resets state if axis changes (structural change). Changes to time_constant or accumulate are applied without resetting accumulated state.
- Parameters:
msg (EWMASettings)
- Return type:
None