resurfemg.preprocessing.pneumatic module

Copyright 2022 Netherlands eScience Center and University of Twente Licensed under the Apache License, version 2.0. See LICENSE for details.

This file contains functions for processing pneumatic data.

volume_computation(t, flow, fs, zc_idxs, method)

Function to compute the volume signal from the flow signal. The volume signal is computed by integrating the flow signal. The volume signal is then baseline corrected using the end-expiratory samples. The end- expiratory samples are selected around the zero crossings of the flow signal. The baseline correction method can be set to “Last point”, “Last points” or “Mask”. The “Last point” option uses the zero crossing only. “Last points” uses the samples up to 0.1 seconds before the zero crossing. “Mask” selects the samples where the flow signal is below 0.01 L/s and the raw volume signal is below 0.1 L. :param t: The time vector. :type t: ~numpy.ndarray :param flow: The flow signal. :type flow: ~numpy.ndarray :param fs: The sampling frequency. :type fs: float :param zc_idxs: The zero crossing indices. :type zc_idxs: ~numpy.ndarray :param method: The baseline correction method. :type method: str

Return volume:

The volume signal.

Return type:

ndarray

Return vol_baseline:

The baseline of the volume signal.

Return type:

ndarray

Return volume_raw:

The raw volume signal.

Return type:

ndarray

Return end_exp_idxs:

End-expiratory samples used for baseline correction.

Return type:

ndarray

zero_cros_flow(flow, flow_threshold=0.3)

Function to find the onset of inspiratory,i.e., positive, flow in the flow signal. Flow onsets are defined as the points where the flow signal crosses the zero line to become positive and the flow signal reaches above the flow_threshold during the breath. :param flow: The flow signal. :type flow: ~numpy.ndarray :param flow_threshold: The threshold for the flow signal. :type flow_threshold: float

Return zc_idxs:

zero crossings indices

Return type:

tuple

Return zc_candi:

zero crossings candidates indices

Return type:

tuple