Threshold (Peak Find)

<series> output = <series>.thresholdfind(<number> Cycle Start, <number> Cycle Length, <number> Search Window Width, <bool> Peak Type, <bool> Rectify Input, <bool> Low Pass Filter Input, <number> Low Pass Filter Frequency)

This function returns an array of start times of windows that meet the threshold requirement.  Meant for cyclical data, this function begins at time Cycle Start (specified in seconds), and searches within a window of size Search Window Width (also specified in seconds) for the maximum value.  This window is centered on Cycle Start.  When the maximum value is found in this window, its index is stored.  Peak Type specifies whether the function searches for maximums (peaks) or minimums (valleys) when it performs the threshold.  A true value indicates maximums, a false value indicates minimums.  Cycle Length is then added to this index, and the search begins again.  These maximums are returned as the window start times, representing the beginnings of cycles within the data (each detection has a 50% duty cycle).  If Rectify Input is selected, the input series will be rectified before processing.  If Low Pass Filter Input is selected, the data will be low-pass filtered after rectification, using the Low Pass Filter Frequency as the cutoff.  All arguments must be supplied to this function, even if the selected arguments will cause some of them to be ignored.

Example:

var myThreshold = mySeries.thresholdfind(1.2, 1.0, 0.2, true, false, false, 0);

This example searches for peaks in a data series.  The search starts at 1.2 seconds, and searches for peaks approximately every 1 seconds in a 0.2 second window.  No pre-processing is performed on the data in this example.