systole.detection.rsp_peaks#
- systole.detection.rsp_peaks(signal: List | ndarray | Series, sfreq: int, new_sfreq: int = 1000, method: str = 'msptd', kind: str = 'peaks-onsets', clean_nan: bool = False, verbose: bool = False, detector_kws: Dict = {}) Tuple[ndarray, ndarray | Tuple[ndarray, ndarray]] [source]#
Identify peaks and/or onsets in respiratory signal.
- Parameters:
- signal
The respiratory signal. Peaks are considered to represent end of inspiration, trough represent end of expiration.
- sfreq
The sampling frequency.
- new_sfreq
If resample is True, the new sampling frequency. Defaults to 1000 Hz.
- method
The peaks detection algorithm to use, can be “rolling_average” for an adaptation of [1] or “msptd” [2] (default).
- kind
What kind of detection to perform. Peak detection (“peaks”), trough detection (“onsets”) or both (“peaks-onsets”, default).
- clean_nan
If True, will interpolate NaNs values if any before any other operation. Defaults to False.
- verbose
Control function verbosity. Defaults to False (do not print processing steps).
- detector_kws
Additional keyword arguments that will be passed to the detector function.
- Returns:
- resampled_signal
Signal resampled to the new_sfreq frequency.
- peaks | trough | (peaks, trough)
Boolean arrays of peaks and / or onsets in the respiratory signal.
- Raises:
- ValueError
If kind is not one of the following: “peaks”, “onsets” or “peaks-onsets”. If method is not a valid method name.
References
[1]Torben Noto, Guangyu Zhou, Stephan Schuele, Jessica Templer, Christina Zelano,Automated analysis of breathing waveforms using BreathMetrics: a respiratory signal processing toolbox, Chemical Senses, Volume 43, Issue 8, October 2018, Pages 583-597, https://doi.org/10.1093/chemse/bjy045
[2]S. M. Bishop and A. Ercole, ‘Multi-scale peak and trough detection optimised for periodic and quasi-periodic neuroscience data,’ in Intracranial Pressure and Neuromonitoring XVI. Acta Neurochirurgica Supplement, T. Heldt, Ed. Springer, 2018, vol. 126, pp. 189-195. <https://doi.org/10.1007/978-3-319-65798-1_39>