systole icon indicating copy to clipboard operation
systole copied to clipboard

Few remarks from a first-timer

Open ryobg opened this issue 2 years ago • 3 comments

Hello,

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

  • [ ] An error message X must be a 1darray is more readable as a X must be a 1d array for example.

  • [ ] * Document somewhere that in order to use Bokeh, output_notebook () should be called. I know it is a 3rd part add-on, but it took me hours until I noticed that call in one (of many) places in the documentation. After that I read their API ofc. But that time could have been saved?

  • [ ] The current usage of CDSView is deprecated in Bokeh 3.0+ (e.g. plot_rr (show_artefacts = True) fails)

  • [ ] Not all function can actually work with integer arrays (non numpy.float64). For the rr_ms type I had to explicit convert beforehand.

  • [ ] A mixed time-frequency report, like wavelet transforms, would be great.

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.

ryobg avatar Apr 12 '23 11:04 ryobg

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?

LegrandNico avatar Apr 14 '23 10:04 LegrandNico

Heya, wrt to the wavelets:

I have checked out few articles:

  • Wavelet transform to quantify heart rate variability and to assess its instantaneous changes https://journals.physiology.org/doi/full/10.1152/jappl.1999.86.3.1081

  • Wavelet analysis of heart rate variability: Impact of wavelet selection https://www.researchgate.net/publication/320555701_Wavelet_analysis_of_heart_rate_variability_Impact_of_wavelet_selection

  • Spectral Analysis of Heart Rate Variability: Time Window Matters https://www.frontiersin.org/articles/10.3389/fneur.2019.00545/full

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 avatar Apr 16 '23 18:04 ryobg

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 () 

ryobg avatar Apr 17 '23 20:04 ryobg