time_series.savitzky_golay
Smooth and optionally differentiate data of non-uniform sampling with a Savitzky-Golay filter
A type of low-pass filter, particularly suited for smoothing noisy data
For each point makes a least-square fit of a polynomial over an odd-sized window centered at the point
Calling Sequence
import gravity_toolkit.time_series
sg = gravity_toolkit.time_series.savitzky_golay(t_in, d_in, WINDOW=13, ORDER=2)
- gravity_toolkit.time_series.savitzky_golay(t_in, y_in, WINDOW=None, ORDER=2, DERIV=0, RATE=1, DATA_ERR=0)[source]
Smooth and optionally differentiate data with a Savitzky-Golay filter [51, 54]
- Parameters:
- t_in: float
time array
- y_in: float
data magnitude array
- WINDOW: int or NoneType, default None
Length of the window
Must be an odd integer
- ORDER: int, default 2
Order of the polynomial used in the filtering
Must be less than (window_size - 1)
- DERIV: int, default 0
Order of the derivative to compute
- RATE: float, default 1
Scaling factor for output data and error
- DATA_ERR: float, default 0
Estimated data error of known and equal value
- Returns:
- data: float
Smoothed signal (or n-th derivative)
- error: float
Estimated error at time points
- time: float
Time points for window