mad-lab-fau / BioPsyKit

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

Sum counts #33

Open rouzbeh opened 2 years ago

rouzbeh commented 2 years ago

This PR fixes a suspected bug. It seems that counts should be summed over each minute, and not averaged. The current counts are not integers, which doesn't seem to be correct.

I think this is an oversight, but please check!

codecov[bot] commented 2 years ago

Codecov Report

Merging #33 (7e7b4e5) into main (33ec0e6) will not change coverage. The diff coverage is 0.00%.

@@           Coverage Diff           @@
##             main      #33   +/-   ##
=======================================
  Coverage   47.11%   47.11%           
=======================================
  Files          91       91           
  Lines        7749     7749           
  Branches     1481     1481           
=======================================
  Hits         3651     3651           
  Misses       4027     4027           
  Partials       71       71           
Impacted Files Coverage Δ
src/biopsykit/signals/imu/activity_counts.py 38.66% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 33ec0e6...7e7b4e5. Read the comment docs.

richrobe commented 2 years ago

Hi @rouzbeh, you are totally right, this formula is wrong! Additionally, the values should be summed over 1 sec instead of 1 min to match the output in the paper by Brond et al.. I am about to update the code accordingly. If it's desired to accumulate the activity counts even more (e.g., to epochs of 30s or 1min), I will add a utility function. However these changes will also affect other parts of biopsykit, especially the biopsykit.sleep.sleep_wake_detection module, which we're currently working on and which will be ready soon. I will create a new release once we're finished with the rework!

rouzbeh commented 2 years ago

Hi @richrobe . That's good to know. You may also be interested in agcounts, which is a python package published by ActiGraph and replicating our counts algorithm. A paper will be published soon about this.

richrobe commented 2 years ago

thanks for the hint, I'll check it out! I'm also happy to have a look at your paper as soon as it's published 🙂

rouzbeh commented 2 years ago

@richrobe https://www.nature.com/articles/s41598-022-16003-x