Peaks

class cubie.outputhandling.summarymetrics.peaks.Peaks(precision)[source]

Bases: SummaryMetric

Summary metric that records the indices of detected peaks.

Notes

The buffer stores the two previous values, a peak counter, and slots for the recorded peak indices. The algorithm assumes 0.0 does not occur in valid data so it can serve as an initial sentinel.

__init__(precision) None[source]

Initialise the Peaks summary metric with parameterised sizes.

build() MetricFuncCache[source]

Generate CUDA device functions for peak detection.

Returns:

Cache containing the device update and save callbacks.

Return type:

MetricFuncCache

Notes

The update callback compares the current value against stored history to identify peaks, while the save callback copies stored indices and resets the buffer for the next period.