neuropsychology / NeuroKit.py

A Python Toolbox for Statistics and Neurophysiological Signal Processing (EEG, EDA, ECG, EMG...).
http://neurokit.rtfd.io
MIT License
365 stars 102 forks source link

ECG: RSA (respiratory sinus arrhythmia) #1

Closed DominiqueMakowski closed 7 years ago

DominiqueMakowski commented 7 years ago

Aim:

DominiqueMakowski commented 7 years ago

Here I was, thinking about the zero crossings again, and then I realized that it does not indicate the proper locations of respiratory cycles. From what I understood, a respiratory cycle is divided into 2 phases: inspiration and expiration. The former starts when the signal is a its lowest and the second when at its highest. Thus, a rsp cycle starts and ends at every lowest points of the signal.

Here's the current zero-crossings returned by biosppy: figure_2

However, I have the feeling that indicators of RSP cycles should be like this: figure_2-1

@rhenanbartels what do you think?

DominiqueMakowski commented 7 years ago

I added the rsp_process() function (previously included in ecg_process). This computes the proper cycles onsets (and more: a "continuous" phase (inspiration and expiration) marker (see plot below), some respiratory variability indices (to be developped) and such).

figure_1

The code for this plot is available in our test bed 😆

DominiqueMakowski commented 7 years ago

Ok, I've reworked the RSA function. It extracts several indices (mean RSA, variability, and the unfamous continuous RSA signal 😛)

We can then plot the RSA evolution (see the purple line).

figure_1

I think we're good to integrate it within ecg_process 😸

DominiqueMakowski commented 7 years ago

Done: ecg_process

Tell me what do you think