Package com.fa993
Class FindPeaks
- java.lang.Object
-
- com.fa993.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 theLocalMaxima
interface for detecting local maxima, with a default implementation provided byLocalMaximaJIU
.
-
-
Constructor Summary
Constructors Constructor Description FindPeaks()
Default constructor.FindPeaks(LocalMaxima impl)
Constructor that allows specifying a customLocalMaxima
implementation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FindPeaksOutput
call(double[] points)
Finds peaks in a 1D signal.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.
-
-
-
Constructor Detail
-
FindPeaks
public FindPeaks()
Default constructor. Uses theLocalMaximaJIU
implementation for detecting local maxima.
-
FindPeaks
public FindPeaks(LocalMaxima impl)
Constructor that allows specifying a customLocalMaxima
implementation.- Parameters:
impl
- The custom implementation of theLocalMaxima
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
-
-