Step counter for wrist-worn accelerometers compatible with the UK Biobank Accelerometer Dataset
Project description
stepcount
A Python package to estimate step counts from accelerometer data.
The algorithm is tuned for wrist-worn AX3 data collected at 100 Hz, making it compatible with the UK Biobank Accelerometer Dataset.
Getting started
Install
Prerequisite: Java 8 (1.8.0) or greater. Check with:
$ java -version
To install:
$ pip install stepcount
Usage
# Process an AX3 file
$ stepcount sample.cwa
# Or an ActiGraph file
$ stepcount sample.gt3x
# Or a GENEActiv file
$ stepcount sample.bin
# Or a CSV file (see data format below)
$ stepcount sample.csv
Output:
Summary
-------
{
"Filename": "sample.cwa",
"Filesize(MB)": 65.1,
"Device": "Axivity",
"DeviceID": 2278,
"ReadErrors": 0,
"SampleRate": 100.0,
"ReadOK": 1,
"StartTime": "2013-10-21 10:00:07",
"EndTime": "2013-10-28 10:00:01",
"TotalWalking(min)": 655.75,
"TotalSteps": 43132,
...
}
Estimated Daily Steps
---------------------
steps
time
2013-10-21 5368
2013-10-22 7634
2013-10-23 10009
...
Output: outputs/sample/
Output files
By 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 -o
flag:
$ stepcount sample.cwa -o /path/to/some/folder/
Six output files are created:
- Info.json Summary info, as shown above.
- Steps.csv Raw time-series of step counts
- HourlySteps.csv Hourly step counts
- DailySteps.csv Daily step counts
- HourlyStepsAdjusted.csv Like HourlySteps but accounting for missing data (see section below).
- DailyStepsAdjusted.csv Like DailySteps but accounting for missing data (see section below).
Crude vs. Adjusted Estimates
Adjusted 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.
Processing CSV files
If a CSV file is provided, it must have the following header: time
, x
, y
, z
.
Example:
time,x,y,z
2013-10-21 10:00:08.000,-0.078923,0.396706,0.917759
2013-10-21 10:00:08.010,-0.094370,0.381479,0.933580
2013-10-21 10:00:08.020,-0.094370,0.366252,0.901938
2013-10-21 10:00:08.030,-0.078923,0.411933,0.901938
...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for stepcount-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2f0417fcc6090d47e091ab43eb1033dd081a2022b0deac15014e9acd2f9f8d9 |
|
MD5 | ccbc5285975544eb442e657eb047df42 |
|
BLAKE2b-256 | 0c589e736f531d88ac21747d7e17da073955dbf742de1950313d738bd4e24887 |