Package com.fa993.utils
Class PeakWidth
- java.lang.Object
-
- com.fa993.utils.PeakWidth
-
public class PeakWidth extends Object
Utility class for calculating the widths of peaks in a given dataset. The calculations are based on the prominence data and relative height.
-
-
Constructor Summary
Constructors Constructor Description PeakWidth()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PeakWidthsOutput
call(double[] x, int[] peaks, double relHeight, double[] prominences, int[] leftBases, int[] rightBases)
Calculates the widths of peaks in the input data array using prominence information and a specified relative height.
-
-
-
Method Detail
-
call
public static PeakWidthsOutput call(double[] x, int[] peaks, double relHeight, double[] prominences, int[] leftBases, int[] rightBases)
Calculates the widths of peaks in the input data array using prominence information and a specified relative height. The method determines the left and right intersection points of the peaks at the specified height and calculates the width for each peak.- Parameters:
x
- the input data array containing the signal values.peaks
- the indices of the peaks in the signal.relHeight
- the relative height (a fraction of the prominence) at which to calculate widths.prominences
- the prominence values corresponding to the peaks.leftBases
- the indices of the left bases for the peaks.rightBases
- the indices of the right bases for the peaks.- Returns:
- a
PeakWidthsOutput
object containing the calculated widths, intersection points, and heights for the peaks. - Throws:
IllegalArgumentException
- if:- `relHeight` is less than 0
- The arrays `peaks`, `prominences`, `leftBases`, or `rightBases` do not have the same length
- The prominence data is invalid for any peak
-
-