lightlab.util.data.peaks module¶
Implementation of core peak finding algorithm.
It is wrapped to be more user-friendly by findResonanceFeatures().
ResonanceFeature is a data storage class
returned by findResonanceFeatures()
Summary¶
Exceptions:
PeakFinderError |
Classes:
ResonanceFeature |
A data holder for resonance features (i.e. |
Functions:
findPeaks |
Takes an array and finds a specified number of peaks |
Reference¶
-
class
ResonanceFeature(lam, fwhm, amp, isPeak=True)[source]¶ Bases:
objectA data holder for resonance features (i.e. peaks or dips)
-
lam¶ float – center wavelength
-
fwhm¶ float – full width half maximum – can be less if the extinction depth is less than half
-
amp¶ float – peak amplitude
-
isPeak¶ float – is it a peak or a dip
-
copy()[source]¶ Simple copy so you can modify without side effect
Returns: new object Return type: ResonanceFeature
-
-
exception
PeakFinderError[source]¶ Bases:
RuntimeError
-
findPeaks(yArrIn, isPeak=True, isDb=False, expectedCnt=1, descendMin=1, descendMax=3, minSep=0)[source]¶ Takes an array and finds a specified number of peaks
Looks for maxima/minima that are separated from others, and stops after finding
expectedCntParameters: - isDb (bool) – treats dips like DB dips, so their width is relative to outside the peak, not inside
- descendMin (float) – minimum amount to descend to be classified as a peak
- descendMax (float) – amount to descend down from the peaks to get the width (i.e. FWHM is default)
- minSep (int) – the minimum spacing between two peaks, in array index units
Returns: indeces of peaks, sorted from biggest peak to smallest peak array (float): width of peaks, in array index units
Return type: array (float)
Raises: Exception– if not enough peaks found. This plots on fail, so you can see what’s going on