resurfemg.data_connector.synthetic_data module¶
Copyright 2022 Netherlands eScience Center and Twente University. Licensed under the Apache License, version 2.0. See LICENSE for details.
This file contains methods to create synthetic data with several methods.
- resurfemg.data_connector.synthetic_data.respiratory_pattern_generator(t_end=420, fs=2048, rr=22, ie_ratio=0.5, t_p_occs=None)¶
This function simulates an on/off respiratory muscle activiation pattern for generating a synthetic EMG. ————————————————————————— :param t_end: end time :type t_end: float :param fs: Sampling rate :type fs: int :param rr: Respiratory rate (/min) :type rr: float :param ie_ratio: Ratio between inspiratory and expiratory time :type ie_ratio: float :param t_p_occs: Timing of occlusions (s) :type t_p_occs: float
- Returns respiratory_pattern:
The simulated on/off respiratory muscle pattern.
- Rtype respiratory_pattern:
np.array[float]
- resurfemg.data_connector.synthetic_data.simulate_emg(muscle_activation, fs_emg=2048, emg_amp=5, drift_amp=100, noise_amp=2)¶
This function simulates an surface respiratory emg based on the provided muscle_activation and adds noise and drift to the signal. No ecg component is included, but can be added later. ————————————————————————— :param muscle_activation: The muscle activation pattern :type muscle_activation: float :param emg_amp: Approximate EMG-RMS amplitude (uV) :type emg_amp: float :param drift_amp: Approximate drift RMS amplitude (uV) :type drift_amp: float :param noise_amp: Approximate baseline noise RMS amplitude (uV) :type noise_amp: float
- Returns emg_raw:
The raw synthetic EMG without the ECG added.
- Return type:
np.array[float]
- resurfemg.data_connector.synthetic_data.simulate_muscle_dynamics(block_pattern, fs=2048, tau_mus_up=0.3, tau_mus_down=0.3)¶
This function simulates an respiratory muscle activation dynamics for generating a synthetic EMG. ————————————————————————— :param block_pattern: Simulated on/off respiratory muscle pattern. :type block_pattern: ~np.array[float] :param fs: Sampling rate :type fs: int :param tau_mus_up: Muscle contraction time constant (s) :type tau_mus_up: float :param tau_mus_down: Muscle relaxation time constant (s) :type tau_mus_down: float
- Returns muscle_activation:
The simulated muscle activation pattern.
- Rtype muscle_activation:
np.array[float]
- resurfemg.data_connector.synthetic_data.simulate_ventilator_data(p_mus, fs_vent=100, t_occ_bool=None, **kwargs)¶
This function simulates ventilator data with occlusion manouevers based on the provided p_mus and adds noise to the signal. ————————————————————————— :param p_mus: Respiratory muscle pressure :type p_mus: numpy.ndarray[float] :param fs_vent: Ventilator sampling rate :type fs_vent: int :param t_occ_bool: Boolean array. Is true when a Pocc manoeuver is done :type t_occ_bool: numpy.ndarray[bool]
- Returns y_vent:
The synthetic ventilator pressure, flow and volume
- Rtype y_vent:
np.array[float]