Physio¶
Auto-generated documentation for musicalgestures._physio module.
Physiology signal features for standstill / micromotion studies.
Two pure numpy/scipy surfaces ported from the "still standing" study:
- :func:
respiration_rate-- windowed breathing rate (breaths per minute) from a respiration waveform, via band-pass filtering and a Welch spectral peak per window. - :func:
spectral_band_fractions-- the fraction of a signal's Welch power falling in each of a set of caller-supplied named frequency bands. This is the generic "cardiorespiratory QoM" spectral-composition diagnostic with the heart-rate/respiration bands supplied by the caller, so the function carries no dependency on any particular physiological sensor.
Source: still standing study (Jensenius) -- Deichman / Equivital physiology analyses.
respiration_rate¶
Windowed respiration rate (breaths per minute) from a breathing waveform.
Each analysis window is band-pass filtered to the respiration band and
its dominant frequency is taken as the Welch spectral peak inside that
band; the rate is that frequency times 60. Windows advance by step_s
seconds. The default band (0.1, 0.6) Hz corresponds to about
6-36 breaths/min. Each window must contain at least 15 seconds of valid
samples for spectral estimation.
Source: still standing study (Jensenius), Deichman respiration analysis
(compute_qom_resp).
Arguments¶
waveformnp.ndarray - 1-D respiration/breathing waveform.fsfloat - Sampling rate in Hz.bandtuple, optional -(low, high)respiration band in Hz. Defaults to(0.1, 0.6).window_sfloat, optional - Window length in seconds. Defaults to 30.step_sfloat, optional - Hop between windows in seconds. Defaults to 30.
Returns¶
dict-{"rate_bpm", "times_s", "median_bpm"}whererate_bpmis the per-window rate (breaths/min,nanfor windows without a clear peak),times_sthe window centre times in seconds, andmedian_bpmthe median across valid windows.
spectral_band_fractions¶
Fraction of a signal's power in each of a set of named frequency bands.
Estimates the Welch power spectrum and, for each named band in bands,
returns that band's summed power divided by the summed power in
total_band. This is the generic spectral-composition diagnostic used
for the "cardiorespiratory QoM artifact" analysis (e.g. how much of a
chest-accelerometer QoM signal sits in a cardiac vs a respiration band),
with the bands supplied by the caller so there is no built-in dependence
on a heart-rate or respiration sensor. Power is bin-summed on the Welch
grid; the study source integrated with trapz, which yields nearly
identical results on the uniform frequency spacing of Welch.
Source: still standing study (Jensenius), Deichman chest-QoM
cardiorespiratory spectral-composition analysis (deichman_full).
Arguments¶
signalnp.ndarray - 1-D input signal.fsfloat - Sampling rate in Hz.bandsdict - Mapping of band name to(low, high)in Hz, e.g.`{"cardiac"` - (0.9, 1.3), "resp": (0.12, 0.5)}.
total_bandtuple, optional -(low, high)reference band whose power is the denominator. Defaults to(0.1, 8.0).nperseg_sfloat, optional - Welch segment length in seconds. Defaults to 20.
Returns¶
dict- Mapping of each band name to its power fraction in[0, 1](nanif the total band contains no power).