ghammad / pyActigraphy

Python-based open source package for actigraphy data analysis

Home Page:https://ghammad.github.io/pyActigraphy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Other file formats and calculating SRI

gauerin opened this issue · comments

I've been trying to use pyActigraphy, but a bunch of my files are in .dat or .wac format. Do you know how to get around this in a way that I could use them for input?

Also, I read the tutorials on how to use pyActigraphy, but didn't find any instructions about calculating SRI. Reading the original article, If I'm not wrong, I can obtain SRI by multiplying kRA x kAR. But it doesn't seem logical.

Thank you!

Hello @gauerin

Could you provide us with more info about the .dat/.wac file format? Which devices do they correspond to? Could you send us an example of such files (anonymized)?

Concerning the Sleep Regularity Index (SRI), the documentation of the function can be found here.
You can use different resampling frequencies as well as algorithms to detect the rest (sleep) periods.

The example below uses the Roenneberg/MASDA algorithm to detect the sleep bouts. The other arguments passed to the function are specific to that algorithm. If you use another algorithm, please check which arguments you might want to pass (list of algo):

import os
import pyActigraphy
fpath = os.path.join(os.path.dirname(pyActigraphy.__file__),'tests/data/')
raw = pyActigraphy.io.read_raw_awd(fpath+'example_01.AWD')
sri=raw.SleepRegularityIndex(algo='Roenneberg',min_seed_period='30min', threshold=.20)
print(sri)

Concerning the link between kAR/kRA and SRI, I am not sure there is one as the kRA/kAR uses stretches of inactivity of length p, while the SRI relies on a sleep detection algorithm to identify epochs in the same state (sleep or wake) across consecutive days.

Hope that helps.

Happy actigraphy.

Greg

Thank you! It helped a lot!