Python package to process wearable accelerometer data
Project description
actipy
A Python package to process accelerometer data.
Axivity3 (.cwa
), Actigraph (.gt3x
), and GENEActiv (.bin
) files are supported,
as well as custom CSV files.
Axivity3 is the activity tracker watch used in the large-scale UK-Biobank accelerometer study.
Getting started
Prerequisite
-
Python 3.8 or greater
$ python --version # or python3 --version
-
Java 8 (1.8.0) or greater
$ java -version
Install
$ pip install actipy
Usage
Process an Axivity3 (.cwa) file:
import actipy
data, info = actipy.read_device("sample.cwa.gz",
lowpass_hz=20,
calibrate_gravity=True,
detect_nonwear=True,
resample_hz=50)
Output:
data [pandas.DataFrame]
x y z temperature
time
2014-05-07 13:29:50.430 -0.513936 0.070043 1.671264 20.000000
2014-05-07 13:29:50.440 -0.233910 -0.586894 0.081946 20.000000
2014-05-07 13:29:50.450 -0.080303 -0.951132 -0.810433 20.000000
2014-05-07 13:29:50.460 -0.067221 -0.976200 -0.864934 20.000000
2014-05-07 13:29:50.470 -0.109617 -0.857322 -0.508587 20.000000
... ... ... ... ...
info [dict]
Filename : data/sample.cwa.gz
Filesize(MB) : 69.4
Device : Axivity
DeviceID : 13110
ReadErrors : 0
SampleRate : 100.0
ReadOK : 1
StartTime : 2014-05-07 13:29:50
EndTime : 2014-05-13 09:50:33
NumTicks : 51391800
WearTime(days) : 5.847725231481482
NumInterrupts : 1
ResampleRate : 100.0
NumTicksAfterResample : 25262174
LowpassOK : 1
LowpassCutoff(Hz) : 20.0
CalibErrorBefore(mg) : 82.95806873592024
CalibErrorAfter(mg) : 4.434966371604519
CalibOK : 1
NonwearTime(days) : 0.0
NumNonwearEpisodes : 0
...
Refer to the Data Dictionary for a comprehensive list of outputs.
If you have a CSV file that you want to process, you can also use the data processing routines from actipy.processing
:
import actipy.processing as P
data, info_lowpass = P.lowpass(data, 100, 20)
data, info_calib = P.calibrate_gravity(data)
data, info_nonwear = P.detect_nonwear(data)
data, info_resample = P.resample(data, sample_rate)
See the documentation for more.
Contributing
If you would like to contribute to this repository, please check out CONTRIBUTING.md. We welcome contributions in the form of bug reports, feature requests, and pull requests.
License
See LICENSE.md.
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
File details
Details for the file actipy-3.0.8.tar.gz
.
File metadata
- Download URL: actipy-3.0.8.tar.gz
- Upload date:
- Size: 71.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb6eae530cac486b0ed8974ab2186e919a28e5aeb3965fe8c329bd97fe2d4084 |
|
MD5 | 6e4a8e943c22198456aadc55b536582e |
|
BLAKE2b-256 | 11c661d7618680990011cb18f5fd6d18c080a7d2b3b5ce2f0eab76852081d01e |
File details
Details for the file actipy-3.0.8-py3-none-any.whl
.
File metadata
- Download URL: actipy-3.0.8-py3-none-any.whl
- Upload date:
- Size: 54.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c86773dd77cafd1b649f321b7100c3ea40e2fafc73fc45e5c6f10d198e66c50a |
|
MD5 | ba8806dc55ad0f9e6dbf03a17b24351f |
|
BLAKE2b-256 | 545aebc4ed0e4edb11b24b5d6f72bd061b352e17dd1f38cc8b73f8dffa2f38a2 |