Peak search function¶
This module provides a peak search function and tools related to peak analysis.
-
silx.math.fit.peaks.
peak_search
(y, fwhm, sensitivity=3.5, begin_index=None, end_index=None, debug=False, relevance_info=False)¶ Find peaks in a curve.
Parameters: - y (numpy.ndarray) – Data array
- fwhm – Estimated full width at half maximum of the typical peaks we are interested in (expressed in number of samples)
- sensitivity – Threshold factor used for peak detection. Only peaks
with amplitudes higher than
σ * sensitivity
- whereσ
is the standard deviation of the noise - qualify as peaks. - begin_index – Index of the first sample of the region of interest
in the
y
array. IfNone
, start from the first sample. - end_index – Index of the last sample of the region of interest in
the
y
array. IfNone
, process until the last sample. - debug – If
True
, print debug messages. Default:False
- relevance_info – If
True
, add a second dimension with relevance information to the output array. Default:False
Returns: 1D sequence with indices of peaks in the data if
relevance_info
isFalse
. Else, sequence of(peak_index, peak_relevance)
tuples (one tuple per peak).Raise: IndexError
if the number of peaks is too large to fit in the output array.
-
silx.math.fit.peaks.
guess_fwhm
(y)¶ Return the full-width at half maximum for the largest peak in the data array.
The algorithm removes the background, then finds a global maximum and its corresponding FWHM.
This value can be used as an initial fit parameter, used as input for an iterative fit function.
Parameters: y – Data to be used for guessing the fwhm. Returns: Estimation of full-width at half maximum, based on fwhm of the global maximum.