# ThresholdPeakDetector

Advanced Analysis Library Only

AnalysisLibErrType ThresholdPeakDetector (double inputArray[], int size, double threshold, int width, int peakIndices[], int *numberOfPeakIndices);

## Purpose

Analyzes the input sequence for valid peaks. This function keeps a count of the number of peaks encountered and a record of the peakIndices, which locate the points that exceed the threshold in a valid peak.

## Parameters

Input
Name | Type | Description
inputArray | double-precision array | The input sequence.
size | integer | The length of inputArray.
threshold | double-precision | The level that all valid peaks must equal or exceed for the duration of width samples.
width | integer | The minimum width, in number of samples, for which the input sequence inputArray must remain at or above the threshold value for the candidate peak to be considered valid.
Output
Name | Type | Description
peakIndices | integer array | The indices of all valid peaks. On input, you must allocate enough space for peakIndices. To be safe, allocate (n/width+1)*sizeof(intnum) bytes for peakIndices. On output, numberOfPeakIndices specifies the actual number of peaks found.
numberOfPeakIndices | integer | The number of valid peaks found.

## Return Value

Name | Type | Description
status | AnalysisLibErrType | A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.