Package: actinet
actinetA tool to extract meaningful health information from large accelerometer datasets.
The software generates time-series and summary metrics useful for answering key questions such as how much time is spent in sleep, sedentary behaviour, or doing physical activity.
The backbone of this repository is a self-supervised Resnet18 model.InstallMinimum requirements: Python>=3.9, Java 8 (1.8)The following instructions make use of Anaconda to meet the minimum requirements:Download & installMiniconda(light-weight version of Anaconda).(Windows) Once installed, launch theAnaconda Prompt.Create a virtual environment:conda create -n actinet python=3.9 openjdk pipThis creates a virtual environment calledactinetwith Python version 3.9, OpenJDK, and Pip.Activate the environment:conda activate actinetYou should now see(actinet)written in front of your prompt.Installactinet:pip install actinetYou are all set! The next time that you want to useactinet, open the Anaconda Prompt and activate the environment (step 4). If you see(actinet)in front of your prompt, you are ready to go!Usage# Process an AX3 file$actinet-fsample.cwa# Or an ActiGraph file$actinet-fsample.gt3x# Or a GENEActiv file$actinet-fsample.bin# Or a CSV file (see data format below)$actinet-fsample.csvTroubleshootingSome systems may face issues with Java when running the script. If this is your case, try fixing OpenJDK to version 8:conda install -n actinet openjdk=8Offline usageTo use this package offline, one must first download and install the relevant classifier file and model modules.
This repository offers two ways of doing this.Run the following code when you have internet access:actinet --cache-classifierFollowing this, the actinet classifier can be used as standard without internet access, without needing to specify the flags relating to the model repository.Alternatively, you can download or git clone the ssl modules from thessl-wearables repository.In addition, you can donwload/prepare a custom classifier file.Once this is downloaded to an appopriate location, you can run the actinet model using:actinet -f sample.cwa -c /path/to/classifier.joblib.lzma -m /path/to/ssl-wearablesOutput filesBy default, output files will be stored in a folder named after the input file,outputs/{filename}/, created in the current working directory. You can change the output path with the-oflag:$actinet-fsample.cwa-o/path/to/some/folder/<Output summary written to: /path/to/some/folder/sample-outputSummary.json><Time series output written to: /path/to/some/folder/sample-timeSeries.csv.gz>The following output files are created:Info.jsonSummary info, as shown above.timeSeries.csvRaw time-series of activity levelsSeeData Dictionaryfor the list of output variables.Plotting activity profilesTo plot the activity profiles, you can use the -p flag:$actinet-fsample.cwa-p<Output plot written to: data/sample-timeSeries-plot.png>Crude vs. Adjusted EstimatesAdjusted estimates are provided that account for missing data.
Missing values in the time-series are imputed with the mean of the same timepoint of other available days.
For adjusted totals and daily statistics, 24h multiples are needed and will be imputed if necessary.
Estimates will be NaN where data is still missing after imputation.Processing CSV filesIf a CSV file is provided, it must have the following header:time,x,y,z.Example:time,x,y,z2013-10-21 10:00:08.000,-0.078923,0.396706,0.9177592013-10-21 10:00:08.010,-0.094370,0.381479,0.9335802013-10-21 10:00:08.020,-0.094370,0.366252,0.9019382013-10-21 10:00:08.030,-0.078923,0.411933,0.901938...Processing multiple filesWindowsTo process multiple files you can create a text file in Notepad which includes one line for each file you wish to process, as shown below forfile1.cwa,file2.cwa, andfile2.cwa.Example text filecommands.txt:actinet -f file1.cwa &actinet -f file2.cwa &actinet -f file3.cwa:ENDOnce this file is created, runcmd < commands.txtfrom the terminal.LinuxCreate a filecommand.shwith:actinet -f file1.cwaactinet -f file2.cwaactinet -f file3.cwaThen, runbash command.shfrom the terminal.Collating outputsA utility script is provided to collate outputs from multiple runs:actinet-collate-outputs outputs/This will collate all *-Info.json files found in outputs/ and generate a CSV file.Citing our workWhen using this tool, please consider citing the works listed inCITATION.md.LicenceSeeLICENSE.md.AcknowledgementsWe would like to thank all our code contributors, manuscript co-authors, and research participants for their help in making this work possible.