# actipy
A Python package to process accelerometer data.
Axivity3 and Axivity6 (`.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](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0169649).
## Getting started
### Prerequisite
- Python 3.8 or greater
```console
$ python --version # or python3 --version
```
- Java 8 (1.8.0) or greater
```console
$ java -version
```
### Install
```bash
$ pip install actipy
```
<!-- With Conda:
```bash
$ conda install -c oxwear actipy
``` -->
## Usage
```python
import actipy
data, info = actipy.read_device("sample.cwa.gz", # or "sample.gt3x.gz" or "sample.bin.gz"
lowpass_hz=20,
calibrate_gravity=True,
detect_nonwear=True,
resample_hz=50)
```
Output:
```console
data [pandas.DataFrame]
x y z temperature light
time
2014-05-07 13:29:50.430 -0.513990 0.070390 1.671922 20.000000 78.420235
2014-05-07 13:29:50.440 -0.233940 -0.586568 0.082067 20.000000 78.420235
2014-05-07 13:29:50.450 -0.080319 -0.950817 -0.810613 20.000000 78.420235
2014-05-07 13:29:50.460 -0.067236 -0.975886 -0.865132 20.000000 78.420235
2014-05-07 13:29:50.470 -0.109636 -0.857004 -0.508666 20.000000 78.420235
... ... ... ... ... ...
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](data-dictionary.md) for a comprehensive list of outputs.
### Processing a custom CSV file
You can also use the routines in `actipy.processing` to process custom CSV files, or for more fine-grained control:
```python
import actipy.processing as P
data, info_lowpass = P.lowpass(data, 100, 20)
data, info_calib = P.calibrate_gravity(data)
data, info_nonwear = P.flag_nonwear(data)
data, info_resample = P.resample(data, sample_rate)
```
See the [documentation](https://actipy.readthedocs.io/en/latest/) for more.
### Processing from the command line
We also provide a command-line tool to process a device file (currently, only AX3 and AX6 are supported) and output to CSV:
```bash
$ read_cwa sample.cwa.gz -o outputs --lowpass-hz 20 --resample-hz 50 --calibrate-gravity --detect-nonwear
```
Outputs:
- "outputs/sample/sample.csv.gz"
- "outputs/sample/sample-Info.json"
## Contributing
If you would like to contribute to this repository, please check out [CONTRIBUTING.md](https://github.com/OxWearables/actipy/blob/main/CONTRIBUTING.md).
We welcome contributions in the form of bug reports, feature requests, and pull requests.
## License
See [LICENSE.md](LICENSE.md).
Raw data
{
"_id": null,
"home_page": "https://github.com/OxWearables/actipy",
"name": "actipy",
"maintainer": "Shing Chan",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "shing.chan@ndph.ox.ac.uk",
"keywords": "wearable accelerometer data processing",
"author": "Shing Chan, Aiden Doherty",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/bb/8b/f57e915a95bdf8305e4104fc8f3c782f15b7708b0b73bda990abaaabbe96/actipy-3.4.2.post0.tar.gz",
"platform": null,
"description": "# actipy\n\nA Python package to process accelerometer data.\n\nAxivity3 and Axivity6 (`.cwa`), Actigraph (`.gt3x`), and GENEActiv (`.bin`) files are supported,\nas well as custom CSV files.\n\nAxivity3 is the activity tracker watch used in the large-scale\n[UK-Biobank accelerometer study](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0169649).\n\n## Getting started\n\n### Prerequisite\n\n- Python 3.8 or greater\n ```console\n $ python --version # or python3 --version\n ```\n\n- Java 8 (1.8.0) or greater\n ```console\n $ java -version\n ```\n\n### Install\n\n```bash\n$ pip install actipy\n```\n\n<!-- With Conda:\n```bash\n$ conda install -c oxwear actipy\n``` -->\n\n## Usage\n\n```python\nimport actipy\n\ndata, info = actipy.read_device(\"sample.cwa.gz\", # or \"sample.gt3x.gz\" or \"sample.bin.gz\"\n lowpass_hz=20,\n calibrate_gravity=True,\n detect_nonwear=True,\n resample_hz=50)\n```\n\nOutput:\n```console\ndata [pandas.DataFrame]\n x y z temperature light\n time\n 2014-05-07 13:29:50.430 -0.513990 0.070390 1.671922 20.000000 78.420235\n 2014-05-07 13:29:50.440 -0.233940 -0.586568 0.082067 20.000000 78.420235\n 2014-05-07 13:29:50.450 -0.080319 -0.950817 -0.810613 20.000000 78.420235\n 2014-05-07 13:29:50.460 -0.067236 -0.975886 -0.865132 20.000000 78.420235\n 2014-05-07 13:29:50.470 -0.109636 -0.857004 -0.508666 20.000000 78.420235\n ... ... ... ... ... ...\n\ninfo [dict]\n Filename : data/sample.cwa.gz\n Filesize(MB) : 69.4\n Device : Axivity\n DeviceID : 13110\n ReadErrors : 0\n SampleRate : 100.0\n ReadOK : 1\n StartTime : 2014-05-07 13:29:50\n EndTime : 2014-05-13 09:50:33\n NumTicks : 51391800\n WearTime(days) : 5.847725231481482\n NumInterrupts : 1\n ResampleRate : 100.0\n NumTicksAfterResample : 25262174\n LowpassOK : 1\n LowpassCutoff(Hz) : 20.0\n CalibErrorBefore(mg) : 82.95806873592024\n CalibErrorAfter(mg) : 4.434966371604519\n CalibOK : 1\n NonwearTime(days) : 0.0\n NumNonwearEpisodes : 0\n ...\n\n```\nRefer to the [Data Dictionary](data-dictionary.md) for a comprehensive list of outputs.\n\n### Processing a custom CSV file\nYou can also use the routines in `actipy.processing` to process custom CSV files, or for more fine-grained control:\n\n```python\nimport actipy.processing as P\n\ndata, info_lowpass = P.lowpass(data, 100, 20)\ndata, info_calib = P.calibrate_gravity(data)\ndata, info_nonwear = P.flag_nonwear(data)\ndata, info_resample = P.resample(data, sample_rate)\n```\n\nSee the [documentation](https://actipy.readthedocs.io/en/latest/) for more.\n\n### Processing from the command line\nWe also provide a command-line tool to process a device file (currently, only AX3 and AX6 are supported) and output to CSV:\n```bash\n$ read_cwa sample.cwa.gz -o outputs --lowpass-hz 20 --resample-hz 50 --calibrate-gravity --detect-nonwear\n```\n\nOutputs:\n - \"outputs/sample/sample.csv.gz\"\n - \"outputs/sample/sample-Info.json\"\n\n\n## Contributing\nIf you would like to contribute to this repository, please check out [CONTRIBUTING.md](https://github.com/OxWearables/actipy/blob/main/CONTRIBUTING.md).\nWe welcome contributions in the form of bug reports, feature requests, and pull requests. \n\n## License\nSee [LICENSE.md](LICENSE.md).\n",
"bugtrack_url": null,
"license": "See LICENSE.md",
"summary": "Python package to process wearable accelerometer data",
"version": "3.4.2.post0",
"project_urls": {
"Download": "https://github.com/OxWearables/actipy",
"Homepage": "https://github.com/OxWearables/actipy"
},
"split_keywords": [
"wearable",
"accelerometer",
"data",
"processing"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ca0d8b707b8ce29ea196feed9b2391648de81fbd9650e19e4e63eb97f6481737",
"md5": "ba8102f282440683565fbf8e20e867d0",
"sha256": "edc27c9a52937beff9e4ecc7c74157d384fb54d9e68111c071bcca930d866e03"
},
"downloads": -1,
"filename": "actipy-3.4.2.post0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ba8102f282440683565fbf8e20e867d0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 60776,
"upload_time": "2024-12-18T13:27:47",
"upload_time_iso_8601": "2024-12-18T13:27:47.383208Z",
"url": "https://files.pythonhosted.org/packages/ca/0d/8b707b8ce29ea196feed9b2391648de81fbd9650e19e4e63eb97f6481737/actipy-3.4.2.post0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bb8bf57e915a95bdf8305e4104fc8f3c782f15b7708b0b73bda990abaaabbe96",
"md5": "cf221751a418b43c905192bec2a363f9",
"sha256": "c233a4421eb87f6ebac31d45d81c429d9fbaa1e26b0b17ebf72de35c961f5899"
},
"downloads": -1,
"filename": "actipy-3.4.2.post0.tar.gz",
"has_sig": false,
"md5_digest": "cf221751a418b43c905192bec2a363f9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 77650,
"upload_time": "2024-12-18T13:27:49",
"upload_time_iso_8601": "2024-12-18T13:27:49.757990Z",
"url": "https://files.pythonhosted.org/packages/bb/8b/f57e915a95bdf8305e4104fc8f3c782f15b7708b0b73bda990abaaabbe96/actipy-3.4.2.post0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-18 13:27:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "OxWearables",
"github_project": "actipy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "actipy"
}