Package com.fa993

Class FindPeaks


  • public class FindPeaks
    extends Object
    A utility class for finding peaks in a 1D signal. This class provides methods to detect peaks in a signal using various conditions such as height, threshold, distance, prominence, width, and plateau size. The primary method is designed to mimic the behavior of Python's SciPy `find_peaks` function. The class uses the LocalMaxima interface for detecting local maxima, with a default implementation provided by LocalMaximaJIU.
    • Constructor Detail

      • FindPeaks

        public FindPeaks()
        Default constructor. Uses the LocalMaximaJIU implementation for detecting local maxima.
      • FindPeaks

        public FindPeaks​(LocalMaxima impl)
        Constructor that allows specifying a custom LocalMaxima implementation.
        Parameters:
        impl - The custom implementation of the LocalMaxima interface.
    • Method Detail

      • call

        public FindPeaksOutput call​(double[] points)
        Finds peaks in a 1D signal.
        Parameters:
        points - The input signal array.
        Returns:
        An output object containing the indices of detected peaks and an empty properties map.
        Throws:
        IllegalArgumentException - If the input signal is null.
      • call

        public FindPeaksOutput call​(double[] x,
                                    NumOrTwoSeqOrNdArr height,
                                    NumOrTwoSeqOrNdArr threshold,
                                    Double distance,
                                    NumOrTwoSeqOrNdArr prominence,
                                    NumOrTwoSeqOrNdArr width,
                                    Integer wlen,
                                    Double relHeight,
                                    NumOrTwoSeqOrNdArr plateauSize)
        Finds peaks in a 1D signal with various optional conditions and properties. This method detects peaks in the input signal and applies additional filtering based on the provided conditions such as height, threshold, distance, prominence, width, and plateau size. It mimics Python's SciPy `find_peaks` function.
        Parameters:
        x - The input signal array.
        height - Minimum and/or maximum height of peaks.
        threshold - Minimum and/or maximum threshold values for peak bases.
        distance - Minimum distance between peaks. Must be ≥ 1.
        prominence - Minimum and/or maximum prominence of peaks.
        width - Minimum and/or maximum width of peaks.
        wlen - Window length for prominence calculation. Rounded up to the nearest odd integer.
        relHeight - Relative height for width calculation (default: 0.5 if null).
        plateauSize - Minimum and/or maximum size of plateaus.
        Returns:
        An output object containing the indices of detected peaks and a properties map with additional details.
        Throws:
        IllegalArgumentException - If any input condition is invalid or incompatible with the input signal.
        See Also:
        FindPeaks Source