Module peak

The definition of the class Peak is in the classes module

find_peaks()

mocca2.find_peaks(data: ndarray[Any, dtype[_ScalarType_co]], min_rel_height: float = 0.01, min_height: float = -inf, width_at: float = 0.1, expand_borders: bool = True, merge_overlapping: bool = True, split_threshold: float | None = 0.05, min_elution_time: int | None = None, max_elution_time: int | None = None) List[Peak]

Finds all peaks in given 1D data. Assumes that baseline is flat and centered around 0.

Parameters

data: ArrayLike

1D chromatogram data

min_rel_height: float

minimum relative prominence of the peaks (relative to highest peak)

min_height: float

minimum prominence of the peaks

width_at: float

the peak width will be measured at this fraction of peak height

expand_borders: bool

if True, tries to find peak borders. Otherwise borders from scipy are returned

merge_overlapping: bool

if True, also calls the merge_overlapping_peaks before returning the peaks

split_threshold: float | None

maximum height of a minimum separating two peaks for splitting, relative to smaller of the peaks

min_elution_time: int | None

if specified, peaks with maximum before min_elution_time are omitted

max_elution_time: int | None

if specified, peaks with maximum after max_elution_time are omitted

Returns

List[Peak]

Description

  1. The peaks are picked using scipy.signal.find_peaks and filtered based on min_rel_height

  2. If min_elution_time or max_elution_time are specified, the peaks are filtered

  3. If expand_borders, the borders of the peaks are expanded down to baseline (up to estimated background noise)

  4. If merge_overlapping, any overlapping peaks are merged. See merge_overlapping_peaks

  5. If split_threshold is provided, merged peaks with sufficient minimum separating them are split. See split_peaks

merge_overlapping_peaks()

mocca2.peaks.merge_overlapping_peaks(data: ndarray[Any, dtype[_ScalarType_co]], peaks: List[Peak]) List[Peak]

Merges any overlapping peaks

Parameters

data: NDArray

1D chromatogram data

peaks: List[Peak]

peaks that are checked for overlap and merged

Returns

List[Peak]

List of new peaks. Non-overlapping peaks are copied as-is, and overlapping peaks are replaced by merged peaks

split_peaks()

mocca2.peaks.split_peaks(data: ndarray[Any, dtype[_ScalarType_co]], peaks: List[Peak], max_height: float = 0.05) List[Peak]

Splits any peaks that are have sufficient minimum separating them

Parameters

data: NDArray

1D chromatogram data

peaks:

List of peaks, only merged peaks can be split

max_height:

maximum height of a minimum separating two peaks, relative to smaller of the peaks

Returns

List[Peak]

split peaks