View source: R/correct_peaks.R
correct_peaks | R Documentation |
Adjust a set of detected peaks to coincide with local signal maxima.
correct_peaks(
sig,
peak_inds,
search_radius,
smooth_window_size,
peak_dir = "compare"
)
sig |
The 1d signal vector |
peak_inds |
Vector of the original peak indices |
search_radius |
The radius within which the original peaks may be shifted. |
smooth_window_size |
The window size of the moving average filter applied on the signal. Peak distance is calculated on the difference between the original and smoothed signal. |
peak_dir |
optional string denoting the expected peak direction: 'up' or 'down', 'both', or 'compare'. |
Functionality of peak_dir
param:
- If 'up', the peaks will be shifted to local maxima.
- If 'down', the peaks will be shifted to local minima.
- If 'both', the peaks will be shifted to local maxima of the
rectified signal.
- If 'compare', the function will try both 'up' and 'down'
options, and choose the direction that gives the largest mean
distance from the smoothed signal.
shifted_peak_inds vector of the corrected peak indices.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.