![]() |
ProtoTracer
1.0
Real-time 3D rendering and animation engine
|
Detects peaks in time-series data using statistical methods. More...
#include <PeakDetection.h>
Public Member Functions | |
PeakDetection (uint8_t lag=12, float threshold=0.75f, float influence=0.5f) | |
Constructs a PeakDetection object with the specified parameters. | |
void | Calculate (float *data, bool *peaks) |
Processes the data and identifies peaks. | |
Private Member Functions | |
void | GetStdDev (uint8_t start, uint8_t length, float *data, float &avgRet, float &stdRet) |
Calculates the mean and standard deviation for a range of data. | |
Private Attributes | |
uint8_t | lag |
Number of data points to use for moving average and standard deviation. | |
float | threshold |
Threshold for peak detection, expressed as a multiple of the standard deviation. | |
float | influence |
Influence of detected peaks on subsequent calculations. | |
float | filData [sampleSize] |
Filtered data array for influence adjustment. | |
float | avg [sampleSize] |
Moving average of the data. | |
float | std [sampleSize] |
Moving standard deviation of the data. | |
Detects peaks in time-series data using statistical methods.
This class identifies peaks by calculating a moving average and standard deviation of the data and comparing each value against a dynamically adjusted threshold.
sampleSize | The size of the data window used for peak detection. |
Definition at line 27 of file PeakDetection.h.
PeakDetection | ( | uint8_t | lag = 12 , |
float | threshold = 0.75f , |
||
float | influence = 0.5f |
||
) |
Constructs a PeakDetection
object with the specified parameters.
Processes the data and identifies peaks.
data | Pointer to the input data array. |
peaks | Output array of boolean values indicating whether each point is a peak. |
|
private |
Calculates the mean and standard deviation for a range of data.
start | The starting index of the range. |
length | The number of elements in the range. |
data | Pointer to the data array. |
avgRet | Output parameter for the calculated mean. |
stdRet | Output parameter for the calculated standard deviation. |
|
private |
Moving average of the data.
Definition at line 33 of file PeakDetection.h.
|
private |
Filtered data array for influence adjustment.
Definition at line 32 of file PeakDetection.h.
Influence of detected peaks on subsequent calculations.
Definition at line 31 of file PeakDetection.h.
Number of data points to use for moving average and standard deviation.
Definition at line 29 of file PeakDetection.h.
|
private |
Moving standard deviation of the data.
Definition at line 34 of file PeakDetection.h.
Threshold for peak detection, expressed as a multiple of the standard deviation.
Definition at line 30 of file PeakDetection.h.