ButterworthFilter.filter#
- ButterworthFilter.filter(data)[source]#
Filter a panel.
Converts the cutoff period to the penalty, then runs the shared penalized smoother column by column; a one-dimensional series is treated as a one-column panel.
- Parameters:
data (
ArrayLike) – A(nobs, k)panel or one-dimensional series.- Return type:
- Returns:
The
DecompositionFilterResult, every row kept, with the first and lastceil(period)rows flagged provisional.- Raises:
DimensionError – If the panel is malformed.
SpecificationError – If it is shorter than
2 order + 2.
Example
>>> rng = np.random.default_rng(0) >>> panel = np.cumsum(rng.standard_normal((150, 2)), axis=0) >>> res = ButterworthFilter(period=32).filter(panel) >>> res.n_series, res.method, int(res.provisional.sum()) (2, 'butterworth', 64) >>> ButterworthFilter(order=3).filter(panel[:7, 0]) Traceback (most recent call last): ... cultivars.exceptions.SpecificationError: a Butterworth filter of order 3 needs at ...