Skip to main content

Accelerometer data processing overview

Github all releases DOI install

A 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.

Install

Minimum requirements: Python 3.7 to 3.10, Java 8 (1.8)

The following instructions make use of Anaconda to meet the minimum requirements:

  1. Download & install Miniconda (light-weight version of Anaconda).
  2. (Windows) Once installed, launch the Anaconda Prompt.
  3. Create a virtual environment:
    $ conda create -n accelerometer python=3.9 openjdk pip
    
    This creates a virtual environment called accelerometer with Python version 3.9, OpenJDK, and Pip.
  4. Activate the environment:
    $ conda activate accelerometer
    
    You should now see (accelerometer) written in front of your prompt.
  5. Install accelerometer:
    $ pip install accelerometer
    

You are all set! The next time that you want to use accelerometer, open the Anaconda Prompt and activate the environment (step 4). If you see (accelerometer) in front of your prompt, you are ready to go!

Usage

Processing a single file

To extract summary movement statistics from an Axivity file (.cwa):

$ accProcess data/sample.cwa.gz

 <output written to outputs/sample/sample-summary.json>
 <time series output written to outputs/sample/sample-timeSeries.csv.gz>

Movement statistics will be stored in a JSON file:

{
    "file-name": "sample.cwa.gz",
    "file-startTime": "2014-05-07 13:29:50",
    "file-endTime": "2014-05-13 09:49:50",
    "acc-overall-avg(mg)": 32.78149,
    "wearTime-overall(days)": 5.8,
    "nonWearTime-overall(days)": 0.04,
    "quality-goodWearTime": 1
}

See Data Dictionary for the list of output variables.

Actigraph and GENEActiv files are also supported, as well as custom CSV files. See Usage for more details.

Batch processing multiple files

To process multiple files in a folder, you must specify which file extensions to process:

$ accProcess data/folder_with_cwa_files/ --fileExtensions cwa

 <outputs written to outputs/file1/, outputs/file2/, etc.>

You can specify multiple extensions (comma-separated):

$ accProcess data/my_data/ --fileExtensions cwa,bin,csv

The tool automatically includes compressed versions (.gz, .zip, .bz2, .xz), so --fileExtensions cwa will match both .cwa and .cwa.gz files.

To search subdirectories recursively:

$ accProcess data/my_data/ --fileExtensions cwa --recursive True

The batch processor will:

  • Automatically discover matching files
  • Process them serially with full error handling
  • Continue processing even if individual files fail
  • Provide a detailed summary of successful and failed files

To plot the activity profile:

$ accPlot data/sample-timeSeries.csv.gz
 <output plot written to data/sample-timeSeries-plot.png>

Time series plot

Troubleshooting

Some systems may face issues with Java when running the script. If this is your case, try fixing OpenJDK to version 8:

$ conda install -n accelerometer openjdk=8

Under the hood

Interpreted levels of physical activity can vary, as many approaches can be taken to extract summary physical activity information from raw accelerometer data. To minimise error and bias, our tool uses published methods to calibrate, resample, and summarise the accelerometer data.

Accelerometer data processing overview Activity classification

See Methods for more details.

Citing our work

When using this tool, please consider the works listed in CITATION.md.

Licence

See LICENSE.md.

Acknowledgements

We would like to thank all our code contributors and manuscript co-authors.

Contributors Graph

Metadata

Release files for accelerometer 7.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for accelerometer 7.5.0
File Size Uploaded
accelerometer-7.5.0.tar.gz 1.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for accelerometer 7.5.0
File Interpreter ABI Platform
accelerometer-7.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 3.1 MB

Release files / accelerometer-7.5.0.tar.gz

Download URL accelerometer-7.5.0.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
dabe6d300517cedc58254b448f3ccd1d44b08dd764ace4b1c6473af82fe5fc74
BLAKE2b-256 checksum
How to use checksums
93665305cd6a2c82a89c9ee719fb904af1a7d73060bf343a2b6ace06a128babf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / accelerometer-7.5.0-py3-none-any.whl

Download URL accelerometer-7.5.0-py3-none-any.whl
Size 1.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
766d271eb4b76666d845e13bca985edfc201f7dd086004f304acb56bbbb3d995
BLAKE2b-256 checksum
How to use checksums
5d3dccfe26ca297955276c2cedc48d529627c8238c7eda3970cb18e0d52a1e8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page