R/filter.R
bandlimited_interp.Rdbandlimited_interp function takes a multi-channel signal and applies a
bandlimited interpolation filter to the signal to change its sampling rate.
bandlimited_interp(df, orig_sr, new_sr)dataframe. Filtered signal.
This function filters the input multi-channel signal by applying a bandlimited
interpolation filter. See resample for the underlying
implementation.
This function is not used in the released version of MIMS-unit algorithm, but has once been considered to be used after extrapolation to harmonize sampling rate before filtering. But in the end, we decided to use linear interpolation before extrapolation to increase the sampling rate to 100Hz, so this method is no longer needed.
Other filtering functions:
iir()
# Use sample data
df = sample_raw_accel_data
# View input
illustrate_signal(df, plot_maxed_out_line = FALSE)
#> Warning: `aes_string()` was deprecated in ggplot2 3.0.0.
#> ℹ Please use tidy evaluation idioms with `aes()`.
#> ℹ See also `vignette("ggplot2-in-packages")` for more information.
#> ℹ The deprecated feature was likely used in the MIMSunit package.
#> Please report the issue at
#> <https://github.com/mhealthgroup/MIMSunit/issues/>.
#> Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
#> ℹ Please use `linewidth` instead.
#> ℹ The deprecated feature was likely used in the MIMSunit package.
#> Please report the issue at
#> <https://github.com/mhealthgroup/MIMSunit/issues/>.
# Apply filtering that uses the same setting as in MIMSunit algorithm
output = bandlimited_interp(df, orig_sr=80, new_sr=30)
# View output
illustrate_signal(output, plot_maxed_out_line = FALSE)