embodied-computation-group / systole

Systole: A python package for cardiac signal synchrony and analysis
https://embodied-computation-group.github.io/systole/#
GNU General Public License v3.0
80 stars 31 forks source link

Few remarks from a first-timer #57

Open ryobg opened 1 year ago

ryobg commented 1 year ago

Hello,

As an unprofessional first-timer, I have kept a record of few notes while trying Systole:

Just my 2c. Thank you for the great framework! I will make good use if it for my chest-band monitor -> Garmin watch -> hrv report notebooks.

LegrandNico commented 1 year ago

Hi @ryobg , thank you for pointing this out, this kind of feedback is really helpful for developing the library 👍

These are all good points, I will work on a PR to add some fixes for that. Regarding the wavelet approach, this is probably an issue in itself. Do you have papers or toolbox that document that as a starting point?

ryobg commented 1 year ago

Heya, wrt to the wavelets:

I have checked out few articles:

But there are many others which are behind a paywall. My non-physiology view says that the ability to look at the temporal changes of cycles over time is a good addition. It seems, many articles agrees on that. The difficulty is being to setup the proper transforms of the mother wavelet (Daubechies?). I'm currently investigating some wavelet libs in python, like scipy.signal.cwt and PyWavelets.

I'm sorry I'm unable to help here.

ryobg commented 1 year ago

I'm having some barely noticeable success with a code along the lines of:

import pywt
wavelet = 'morl'
periods = [2.5, 5, 10, 20, 40, 80, 160, 320]
scales = pywt.frequency2scale (wavelet, 1 / numpy.array (periods))
_, ax = plt.subplots (figsize = (20, 7))
ax.set_ylabel ("Frequency (s)")
ax.set_xlabel ("Time (minutes)")
coef, _ = pywt.cwt (ibi, scales, wavelet)
ax.imshow (abs (coef), aspect = 'auto', interpolation = 'nearest',
        extent = [0, ibi.sum () / (1000*60), max (periods), min (periods)],
        vmax = abs (coef).max (), vmin = abs (coef).min ())  
plt.show ()