butterworth (pyleoclim.utils.filter.butterworth)

pyleoclim.utils.filter.butterworth(ys, fc, fs=1, filter_order=3, pad='reflect', reflect_type='odd', params=(2, 1, 2), padFrac=0.1)[source]
Applies a Butterworth filter with frequency fc, with padding

Supports both lowpass and band-pass filtering.

Parameters
  • ys (numpy array) – Timeseries

  • fc (float or list) – cutoff frequency. If scalar, it is interpreted as a low-frequency cutoff (lowpass) If fc is a list, it is interpreted as a frequency band (f1, f2), with f1 < f2 (bandpass)

  • fs (float) – sampling frequency

  • filter_order (int) – order n of Butterworth filter

  • pad (string) – Indicates if padding is needed. - ‘reflect’: Reflects the timeseries - ‘ARIMA’: Uses an ARIMA model for the padding - None: No padding.

  • params (tuple) – model parameters for ARIMA model (if pad = ‘ARIMA’)

  • padFrac (float) – fraction of the series to be padded

Returns

yf – filtered array

Return type

array

See also

pyleoclim.utils.filter.ts_pad

Pad a timeseries based on timeseries model predictions