mad-lab-fau / BioPsyKit

A Python package for the analysis of biopsychological data.
MIT License
39 stars 8 forks source link

van Hees 2015 sleep / wake classification algorithm #34

Open m-patterson-wearable opened 2 years ago

m-patterson-wearable commented 2 years ago

Is your feature request related to a problem? Please describe. Current sleep/wake classification algorithms all rely on activity counts, which are difficult to replicate properly for a variety of reasons.

Describe the solution you'd like A sleep/wake classification algorithm based off the van Hees, 2015 paper

This method was designed purposely to be an easy to describe heuristic. It also showed similar performance to other sleep/wake classification algorithms. It uses two thresholds, 1 - the z-angle range and 2- a length of time. The default parameters are 5 degrees and 5 minutes. So, if the z-angle changes less than 5-degrees in 5-minutes, then the 5-minute period is classified as sleep. If the z-angel changes more than 5-degrees in 5-minutes, then the 5-minute period is classified as wake.

richrobe commented 2 years ago

Hi @m-patterson-wearable, thanks for pointing this out! In fact, we're actually already aware of the 2015 van Hees algorithm and also considered implementing the algorithm for biopsykit. We definitely agree that an algorithm that uses raw acceleration as input instead of activity counts would be beneficial. However, weren't able to do so yet due to time constraints and other higher prioritized feature requests. But we'd be happy to take a contribution to our open-source package... so if you want to implement the algorithm in Python and open a pull request, we'd be happy to merge it 😊