R and Python functions for identifying peaks from measurements taken from ACRUISE campaigns.
NB: There are 3 distinct peak detection methods used in this package:
- Using wavelets to directly extract the plumes (only in Python) Recommended
- Using a Generalized Additive Model (GAM) to estimate the background (only in the R package)
- Using a rolling averaging approach to estimate the background (in both R and Python packages)
The wavelet method is the preferred choice owing to its speed, limited number of parameters, and direct approach in estimating peaks compared to the 2-step method used by the other two algorithms. If the Python package isn't an option, the GAM method in the R package works well and only has a single parameter to tune, but it can be rather slow. The third method isn't recommended anymore owing to its large number of parameters.
Refer to the READMEs within the 2 sub-directories acruisepy
and acruiseR
for specific details of the Python and R packages respectively.
The workflow of the peak extraction comprises 2 or 3 steps depending on the algorithm. The wavelet method simply directly extracts the peaks themselves, while the other two approaches first estimate the background and then extract the peaks via subtraction. Once the peaks are established the plume concentrations can simply be identified by integrating the area under the curve via trapezoidal approximation.
There are no global optimum parameters, and instead an iterative approach is necessary to identify the best parameter values for a given dataset.
The following sections provide a few additional details.
The observed time-series
The background is estimated using either a Generalized Additive Model (R only for now), or a rolling window approach (both R and Python), giving
Subtracting
Plumes are then identified as any timepoints where plume_sd_threshold
).
This threshold will usually be at least 3, so if plumes were exclusively defined by this criteria then they would exclude some points between plume_sd_starting
.
Plumes that are close together can be combined by using the plume_buffer
parameter, which combines plumes if they are within plume_buffer
timepoints.
Currently the only method for integrating the area under the peaks is to use the trapezoidal approximation.