Skip to main content

A package to extract meaningful health information from large accelerometer datasets e.g. how much time individuals spend in sleep, sedentary behaviour, walking and moderate intensity physical activity

Project description

Accelerometer data processing overview

Github all releases Build Gt3X CWA

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.

Installation

pip install accelerometer

You also need Java 8 (1.8.0) or greater. Check with the following:

java -version

Usage

To extract a summary of movement (average sample vector magnitude) and (non)wear time from raw Axivity .CWA (or gzipped .cwa.gz) accelerometer files:

$ accProcess data/sample.cwa.gz

 <output written to data/sample-outputSummary.json>
 <time series output written to data/sample-timeSeries.csv.gz>

The main JSON output will look like:

{
    "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
}

To visualise the time series and activity classification output:

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

Time series plot

You can also import the underlying modules to use in your custom python scripts:

from accelerometer import summariseEpoch
summary = {}
epochData, labels = summariseEpoch.getActivitySummary(
    "sample-epoch.csv.gz",
    "sample-nonWear.csv.gz",
    summary)
# <nonWear file written to "sample-nonWear.csv.gz" and dict "summary" updated
# with outcomes>

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. Click here for detailed information on the data processing methods on our wiki.

Accelerometer data processing overview Activity classification

Citing our work

When describing or using the UK Biobank accelerometer dataset, or using this tool to extract overall activity from your accelerometer data, please cite [Doherty2017].

When using this tool to extract sleep duration and physical activity behaviours from your accelerometer data, please cite [Willetts2018], [Doherty2018], and [Walmsley2021]

[Doherty2017] Doherty A, Jackson D, et al. (2017)
Large scale population assessment of physical activity using wrist worn
accelerometers: the UK Biobank study. PLOS ONE. 12(2):e0169649

[Willetts2018] Willetts M, Hollowell S, et al. (2018)
Statistical machine learning of sleep and physical activity phenotypes from
sensor data in 96,220 UK Biobank participants. Scientific Reports. 8(1):7961

[Doherty2018] Doherty A, Smith-Byrne K, et al. (2018)
GWAS identifies 14 loci for device-measured physical activity and sleep
duration. Nature Communications. 9(1):5257

[Walmsley2021] Walmsley R, Chan S, Smith-Byrne K, et al. (2021)
Reallocation of time between device-measured movement behaviours and risk
of incident cardiovascular disease. British Journal of Sports Medicine.
Published Online First. doi: 10.1136/bjsports-2021-104050
Licence

This project is released under a BSD 2-Clause Licence (see LICENCE file)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

accelerometer-4.0.0.tar.gz (1.5 MB view details)

Uploaded Source

Built Distribution

accelerometer-4.0.0-py3-none-any.whl (1.5 MB view details)

Uploaded Python 3

File details

Details for the file accelerometer-4.0.0.tar.gz.

File metadata

  • Download URL: accelerometer-4.0.0.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/0.0.0 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for accelerometer-4.0.0.tar.gz
Algorithm Hash digest
SHA256 e46d23d7fae4077a59afbf99a39e9570589aae025682036bd85e2b4acf60f499
MD5 04508c9d4129f0e36a308344f7c62459
BLAKE2b-256 350dde6971622db019ed28fa58abe18daaff143ddab7a545a576620692fd63f0

See more details on using hashes here.

File details

Details for the file accelerometer-4.0.0-py3-none-any.whl.

File metadata

  • Download URL: accelerometer-4.0.0-py3-none-any.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/0.0.0 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for accelerometer-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f3ab0ad11974c9c6c6d9c666ebd602dff35f706579c4338d9aa28e03fe7cc44b
MD5 b97380a9934dbfd645072decba764ae6
BLAKE2b-256 10b0b43da57c130705d88a260368e4b22237d4e417733e8c11cc9e889b1fa438

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page