boxcar_smooth: Apply a moving average filter to a time series by convolution

View source: R/correct_peaks.R

boxcar_smoothR Documentation

Apply a moving average filter to a time series by convolution

Description

Apply a moving average filter to a time series by convolution

Usage

boxcar_smooth(sig, window_size = 10)

Arguments

sig

The signal vector to be smoothed

window_size

The width of a boxcar used for an equally weighted window

Details

N.B. This function mirrors the results of numpy boxcar convolution with mode='same'. Thus, we zero pad the series, convolve, then take the middle segment to maintain the same length as the original series.

Note that this works as expected, but is remarkably slow on long time series when compared to zoo::rollmean or data.table::frollmean.

Value

csig The smoothed time series


PennStateDEPENdLab/experiment_pipeline documentation built on Nov. 27, 2024, 4:56 a.m.