dado93 / pywearable

Python package for extraction, visualization, and analysis of physiological data collected through wearable sensors.
https://pywearable.readthedocs.io/en/latest/
MIT License
7 stars 1 forks source link

Statistics based on physiological cycles and not on midnight-to-midnight #89

Open dado93 opened 3 months ago

dado93 commented 3 months ago

The statistics of the cardiac and respiration module are computed using as a timeframe the time that goes from midnight to midnight. It would be interesting to offer two different functions for each of the statistic:

Of course, in order to compute statistics on a physiological cycle level, we need to:

https://support.whoop.com/s/article/WHOOP-Cycles?language=en_US

What do you think @Vaeliss ?

Vaeliss commented 3 months ago

Yes, agreed, I would expand this also to stress and activity modules in the future too. Essentially, I’d extend it to any metric that we can obtain as a series and then compute aggregates over time.

Perhaps we should consider adding a cycle_type parameter to any get_XX function, rather than creating different versions of the function. This parameter could be set to "physiological" (like WHOOP) or "solar_day" (or something like that, i.e. midnight to midnight); we could also consider including the choices "day" and "night" for the same parameter (i.e. while awake, while asleep). Then we can have 4 functions in utils that take as input any time series and filters / divides it based on the necessary logic (e.g. there's already utils.filter_out_awake). Seems to me cleaner than having multiple versions of the same statistic as a function?

Also, it seems reasonable to me to say that if a physiological cycle is longer than 36 hours, instead of having a very long sleep cycle we assume solar day cycles for those days (i.e. stops and start at midnight). And "night" statistics would be NaT.