actinet 0.0.dev0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- actinet/__init__.py +8 -0
- actinet/_version.py +21 -0
- actinet/main.py +13 -0
- actinet-0.0.dev0.dist-info/LICENSE.md +52 -0
- actinet-0.0.dev0.dist-info/METADATA +197 -0
- actinet-0.0.dev0.dist-info/RECORD +9 -0
- actinet-0.0.dev0.dist-info/WHEEL +5 -0
- actinet-0.0.dev0.dist-info/entry_points.txt +2 -0
- actinet-0.0.dev0.dist-info/top_level.txt +1 -0
actinet/__init__.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
name = "actinet"
|
|
2
|
+
__author__ = "Shing Chan, Aidan Acquah, Charilaos Zisou, Aiden Doherty"
|
|
3
|
+
__maintainer__ = "Shing Chan"
|
|
4
|
+
__maintainer_email__ = "shing.chan@ndph.ox.ac.uk"
|
|
5
|
+
__license__ = "See LICENSE file."
|
|
6
|
+
|
|
7
|
+
from . import _version
|
|
8
|
+
__version__ = _version.get_versions()['version']
|
actinet/_version.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
# This file was generated by 'versioneer.py' (0.28) from
|
|
3
|
+
# revision-control system data, or from the parent directory name of an
|
|
4
|
+
# unpacked source archive. Distribution tarballs contain a pre-generated copy
|
|
5
|
+
# of this file.
|
|
6
|
+
|
|
7
|
+
import json
|
|
8
|
+
|
|
9
|
+
version_json = '''
|
|
10
|
+
{
|
|
11
|
+
"date": "2024-02-01T15:00:01+0000",
|
|
12
|
+
"dirty": false,
|
|
13
|
+
"error": null,
|
|
14
|
+
"full-revisionid": "06430ebfcf184880f4f8d8402b18fa8074b49959",
|
|
15
|
+
"version": "0.0.dev0"
|
|
16
|
+
}
|
|
17
|
+
''' # END VERSION_JSON
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def get_versions():
|
|
21
|
+
return json.loads(version_json)
|
actinet/main.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Academic Use Licence
|
|
2
|
+
|
|
3
|
+
**These licence terms apply to all licences granted by THE CHANCELLOR, MASTERS AND SCHOLARS OF THE UNIVERSITY OF OXFORD whose administrative offices are at University Offices, Wellington Square, Oxford OX1 2JD, United Kingdom (the “University”) for use of “actinet” (“the Software”) through this website (https://github.com/OxWearables) (the ”Website”).
|
|
4
|
+
|
|
5
|
+
By downloading the Software through the Website, you (the “Licensee”) are confirming that you agree that your use of the Software is subject to these licence terms**
|
|
6
|
+
|
|
7
|
+
**PLEASE READ THESE LICENCE TERMS CAREFULLY BEFORE DOWNLOADING THE SOFTWARE. IF YOU DO NOT AGREE TO THESE LICENCE TERMS YOU SHOULD NOT DOWNLOAD THE SOFTWARE.**
|
|
8
|
+
|
|
9
|
+
**THE SOFTWARE IS INTENDED FOR USE BY ACADEMICS CARRYING OUT RESEARCH AND NOT FOR USE BY CONSUMERS OR COMMERCIAL BUSINESSES.**
|
|
10
|
+
|
|
11
|
+
**1. Academic Use Licence**
|
|
12
|
+
1.1 The Licensee is granted a limited non-exclusive and non-transferable royalty free licence to download and use the Software provided that the Licensee will:
|
|
13
|
+
- (a) limit their use of the Software to their own internal academic non-commercial research which is undertaken for the purposes of education or other scholarly use;
|
|
14
|
+
- (b) not use the Software for or on behalf of any third party or to provide a service or integrate all or part of the Software into a product for sale or license to third parties;
|
|
15
|
+
- (c) use the Software in accordance with the prevailing instructions and guidance for use given on the Website and comply with procedures on the Website for user identification, authentication and access;
|
|
16
|
+
- (d) comply with all applicable laws and regulations with respect to their use of the Software; and
|
|
17
|
+
- (e) ensure that the Copyright Notice “Copyright © 2022, University of Oxford” appears prominently wherever the Software is reproduced and is referenced or cited with the Copyright Notice when the Software is described in any research publication or on any documents or other material created using the Software.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
1.2 The Licensee may only reproduce, modify, transmit or transfer the Software where:
|
|
21
|
+
- (a) such reproduction, modification, transmission or transfer is for academic, research or other scholarly use;
|
|
22
|
+
- (b) the conditions of this Licence are imposed upon the receiver of the Software or any modified Software;
|
|
23
|
+
- (c) all original and modified Source Code is included in any transmitted software program; and
|
|
24
|
+
- (d) the Licensee grants the University an irrevocable, indefinite, royalty free, non-exclusive unlimited licence to use and sub-licence any modified Source Code as part of the Software.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
1.3 The University reserves the right at any time and without liability or prior notice to the Licensee to revise, modify and replace the functionality and performance of the access to and operation of the Software.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
1.4 The Licensee acknowledges and agrees that the University owns all intellectual property rights in the Software. The Licensee shall not have any right, title or interest in the Software.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
1.5 This Licence will terminate immediately and the Licensee will no longer have any right to use the Software or exercise any of the rights granted to the Licensee upon any breach of the conditions in Section 1 of this Licence.
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
**2. Indemnity and Liability**
|
|
37
|
+
2.1 The Licensee shall defend, indemnify and hold harmless the University against any claims, actions, proceedings, losses, damages, expenses and costs (including without limitation court costs and reasonable legal fees) arising out of or in connection with the Licensee's possession or use of the Software, or any breach of these terms by the Licensee.
|
|
38
|
+
|
|
39
|
+
2.2 The Software is provided on an ‘as is’ basis and the Licensee uses the Software at their own risk. No representations, conditions, warranties or other terms of any kind are given in respect of the the Software and all statutory warranties and conditions are excluded to the fullest extent permitted by law. Without affecting the generality of the previous sentences, the University gives no implied or express warranty and makes no representation that the Software or any part of the Software: (a) will enable specific results to be obtained; or (b) meets a particular specification or is comprehensive within its field or that it is error free or will operate without interruption; or (c) is suitable for any particular, or the Licensee's specific purposes.
|
|
40
|
+
|
|
41
|
+
2.3 Except in relation to fraud, death or personal injury, the University's liability to the Licensee for any use of the Software, in negligence or arising in any other way out of the subject matter of these licence terms, will not extend to any incidental or consequential damages or losses, or any loss of profits, loss of revenue, loss of data, loss of contracts or opportunity, whether direct or indirect.
|
|
42
|
+
|
|
43
|
+
2.4 The Licensee hereby irrevocably undertakes to the University not to make any claim against any employee, student, researcher or other individual engaged by the University, being a claim which seeks to enforce against any of them any liability whatsoever in connection with these licence terms or their subject-matter.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
**3. General**
|
|
47
|
+
**3.1 Severability** - If any provision (or part of a provision) of these licence terms is found by any court or administrative body of competent jurisdiction to be invalid, unenforceable or illegal, the other provisions shall remain in force.
|
|
48
|
+
**3.2 Entire Agreement** - These licence terms constitute the whole agreement between the parties and supersede any previous arrangement, understanding or agreement between them relating to the Software.
|
|
49
|
+
**3.3 Law and Jurisdiction** - These licence terms and any disputes or claims arising out of or in connection with them shall be governed by, and construed in accordance with, the law of England. The Licensee irrevocably submits to the exclusive jurisdiction of the English courts for any dispute or claim that arises out of or in connection with these licence terms.
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
If you are interested in using the Software commercially, please contact Oxford University Innovation Limited to negotiate a licence. Contact details are enquiries@innovation.ox.ac.uk
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: actinet
|
|
3
|
+
Version: 0.0.dev0
|
|
4
|
+
Summary: Activity detection algorithm compatible with the UK Biobank Accelerometer Dataset
|
|
5
|
+
Home-page: https://github.com/OxWearables/actinet
|
|
6
|
+
Download-URL: https://github.com/OxWearables/actinet
|
|
7
|
+
Author: Shing Chan, Aidan Acquah, Charilaos Zisou, Aiden Doherty
|
|
8
|
+
Maintainer: Shing Chan
|
|
9
|
+
Maintainer-email: shing.chan@ndph.ox.ac.uk
|
|
10
|
+
License: See LICENSE file.
|
|
11
|
+
Keywords: example,setuptools,versioneer
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering
|
|
14
|
+
Requires-Python: >=3.8, <4
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE.md
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: versioneer ; extra == 'dev'
|
|
19
|
+
Requires-Dist: twine ; extra == 'dev'
|
|
20
|
+
Requires-Dist: ipdb ; extra == 'dev'
|
|
21
|
+
Requires-Dist: flake8 ; extra == 'dev'
|
|
22
|
+
Requires-Dist: autopep8 ; extra == 'dev'
|
|
23
|
+
Provides-Extra: docs
|
|
24
|
+
Requires-Dist: sphinx >=4.2 ; extra == 'docs'
|
|
25
|
+
Requires-Dist: sphinx-rtd-theme >=1.0 ; extra == 'docs'
|
|
26
|
+
Requires-Dist: readthedocs-sphinx-search >=0.1 ; extra == 'docs'
|
|
27
|
+
Requires-Dist: docutils <0.18 ; extra == 'docs'
|
|
28
|
+
|
|
29
|
+
# actinet
|
|
30
|
+
|
|
31
|
+
A tool to extract meaningful health information from large accelerometer datasets.
|
|
32
|
+
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.
|
|
33
|
+
The backbone of this repository is a self-supervised Resnet18 model.
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
*Minimum requirements*: Python>=3.8, Java 8 (1.8)
|
|
38
|
+
|
|
39
|
+
The following instructions make use of Anaconda to meet the minimum requirements:
|
|
40
|
+
|
|
41
|
+
1. Download & install [Miniconda](https://docs.conda.io/en/latest/miniconda.html) (light-weight version of Anaconda).
|
|
42
|
+
1. (Windows) Once installed, launch the **Anaconda Prompt**.
|
|
43
|
+
1. Create a virtual environment:
|
|
44
|
+
```console
|
|
45
|
+
$ conda create -n actinet python=3.9 openjdk pip
|
|
46
|
+
```
|
|
47
|
+
This creates a virtual environment called `actinet` with Python version 3.9, OpenJDK, and Pip.
|
|
48
|
+
1. Activate the environment:
|
|
49
|
+
```console
|
|
50
|
+
$ conda activate actinet
|
|
51
|
+
```
|
|
52
|
+
You should now see `(actinet)` written in front of your prompt.
|
|
53
|
+
1. Install `actinet`:
|
|
54
|
+
```console
|
|
55
|
+
$ pip install actinet
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
You are all set! The next time that you want to use `actinet`, open the Anaconda Prompt and activate the environment (step 4). If you see `(actinet)` in front of your prompt, you are ready to go!
|
|
59
|
+
|
|
60
|
+
## Usage
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Process an AX3 file
|
|
64
|
+
$ actinet sample.cwa
|
|
65
|
+
|
|
66
|
+
# Or an ActiGraph file
|
|
67
|
+
$ actinet sample.gt3x
|
|
68
|
+
|
|
69
|
+
# Or a GENEActiv file
|
|
70
|
+
$ actinet sample.bin
|
|
71
|
+
|
|
72
|
+
# Or a CSV file (see data format below)
|
|
73
|
+
$ actinet sample.csv
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
### Troubleshooting
|
|
78
|
+
Some systems may face issues with Java when running the script. If this is your case, try fixing OpenJDK to version 8:
|
|
79
|
+
```console
|
|
80
|
+
$ conda install -n actinet openjdk=8
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Output files
|
|
84
|
+
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:
|
|
85
|
+
|
|
86
|
+
```console
|
|
87
|
+
$ actinet sample.cwa -o /path/to/some/folder/
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The following output files are created:
|
|
91
|
+
|
|
92
|
+
- *Info.json* Summary info, as shown above.
|
|
93
|
+
- *timeSeries.csv* Raw time-series of activity levels
|
|
94
|
+
|
|
95
|
+
See [Data Dictionary](https://biobankaccanalysis.readthedocs.io/en/latest/datadict.html) for the list of output variables.
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
### Crude vs. Adjusted Estimates
|
|
99
|
+
Adjusted estimates are provided that account for missing data.
|
|
100
|
+
Missing values in the time-series are imputed with the mean of the same timepoint of other available days.
|
|
101
|
+
For adjusted totals and daily statistics, 24h multiples are needed and will be imputed if necessary.
|
|
102
|
+
Estimates will be NaN where data is still missing after imputation.
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
### Processing CSV files
|
|
106
|
+
If a CSV file is provided, it must have the following header: `time`, `x`, `y`, `z`.
|
|
107
|
+
|
|
108
|
+
Example:
|
|
109
|
+
```console
|
|
110
|
+
time,x,y,z
|
|
111
|
+
2013-10-21 10:00:08.000,-0.078923,0.396706,0.917759
|
|
112
|
+
2013-10-21 10:00:08.010,-0.094370,0.381479,0.933580
|
|
113
|
+
2013-10-21 10:00:08.020,-0.094370,0.366252,0.901938
|
|
114
|
+
2013-10-21 10:00:08.030,-0.078923,0.411933,0.901938
|
|
115
|
+
...
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Processing multiple files
|
|
119
|
+
#### Windows
|
|
120
|
+
To process multiple files you can create a text file in Notepad which includes one line for each file you wish to process, as shown below for *file1.cwa*, *file2.cwa*, and *file2.cwa*.
|
|
121
|
+
|
|
122
|
+
Example text file *commands.txt*:
|
|
123
|
+
```console
|
|
124
|
+
actinet file1.cwa &
|
|
125
|
+
actinet file2.cwa &
|
|
126
|
+
actinet file3.cwa
|
|
127
|
+
:END
|
|
128
|
+
````
|
|
129
|
+
Once this file is created, run `cmd < commands.txt` from the terminal.
|
|
130
|
+
|
|
131
|
+
#### Linux
|
|
132
|
+
Create a file *command.sh* with:
|
|
133
|
+
```console
|
|
134
|
+
actinet file1.cwa
|
|
135
|
+
actinet file2.cwa
|
|
136
|
+
actinet file3.cwa
|
|
137
|
+
```
|
|
138
|
+
Then, run `bash command.sh` from the terminal.
|
|
139
|
+
|
|
140
|
+
#### Collating outputs
|
|
141
|
+
|
|
142
|
+
A utility script is provided to collate outputs from multiple runs:
|
|
143
|
+
|
|
144
|
+
```console
|
|
145
|
+
$ actinet-collate-outputs outputs/
|
|
146
|
+
```
|
|
147
|
+
This will collate all *-Info.json files found in outputs/ and generate a CSV file.
|
|
148
|
+
|
|
149
|
+
## Citing our work
|
|
150
|
+
|
|
151
|
+
When using this tool, please consider citing the works listed in [CITATION.md](https://github.com/OxWearables/actinet/blob/main/CITATION.md).
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
## Licence
|
|
155
|
+
See [LICENSE.md](https://github.com/OxWearables/actinet/blob/main/LICENSE.md).
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
## Acknowledgements
|
|
159
|
+
We would like to thank all our code contributors, manuscript co-authors, and research participants for their help in making this work possible.
|
|
160
|
+
|
|
161
|
+
# Sample PyPI package + GitHub Actions + Versioneer
|
|
162
|
+
|
|
163
|
+
This template aims to automate the tedious and error-prone steps of tagging/versioning, building and publishing new package versions. This is achieved by syncing git tags and versions with Versioneer, and automating the build and release with GitHub Actions, so that publishing a new version is as painless as:
|
|
164
|
+
|
|
165
|
+
```console
|
|
166
|
+
$ git tag vX.Y.Z && git push --tags
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
The following guide assumes familiarity with `setuptools` and PyPI. For an introduction to Python packaging, see the references at the bottom.
|
|
170
|
+
|
|
171
|
+
## How to use this template
|
|
172
|
+
|
|
173
|
+
1. Click on the *Use this template* button to get a copy of this repository.
|
|
174
|
+
1. Rename *src/sample_package* folder to your package name — *src/* is where your package must reside.
|
|
175
|
+
1. Go through each of the following files and rename all instances of *sample-package* or *sample_package* to your package name. Also update the package information such as author names, URLs, etc.
|
|
176
|
+
1. setup.py
|
|
177
|
+
1. pyproject.toml
|
|
178
|
+
1. \_\_init\_\_.py
|
|
179
|
+
1. Install `versioneer` and `tomli`, and run `versioneer`:
|
|
180
|
+
|
|
181
|
+
```console
|
|
182
|
+
$ pip install tomli
|
|
183
|
+
$ pip install versioneer
|
|
184
|
+
$ versioneer install
|
|
185
|
+
```
|
|
186
|
+
Then *commit* the changes produced by `versioneer`. See [here](https://github.com/python-versioneer/python-versioneer/blob/master/INSTALL.md) to learn more.
|
|
187
|
+
1. Setup your PyPI credentials. See the section *Saving credentials on Github* of [this guide](https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/). You should use the variable names `TEST_PYPI_API_TOKEN` and `PYPI_API_TOKEN` for the TestPyPI and PyPI tokens, respectively. See *.github/workflows/release.yaml*.
|
|
188
|
+
|
|
189
|
+
You are all set! It should now be possible to run `git tag vX.Y.Z && git push --tags` to automatically version, build and publish a new release to PyPI.
|
|
190
|
+
|
|
191
|
+
Finally, it is a good idea to [configure tag protection rules](https://docs.github.com/en/enterprise-server@3.8/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/configuring-tag-protection-rules) in your repository.
|
|
192
|
+
|
|
193
|
+
## References
|
|
194
|
+
- Python packaging guide: https://packaging.python.org/en/latest/tutorials/packaging-projects/
|
|
195
|
+
- ...and how things are changing: https://snarky.ca/what-the-heck-is-pyproject-toml/ — in particular, note that while *pyproject.toml* seems to be the future, currently Versioneer still depends on *setup.py*.
|
|
196
|
+
- Versioneer: https://github.com/python-versioneer/python-versioneer
|
|
197
|
+
- GitHub Actions: https://docs.github.com/en/actions
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
actinet/__init__.py,sha256=mPZDGQ1OJTu37W66DK2tOZGLm3h4GH6lkVGAVicFICY,276
|
|
2
|
+
actinet/_version.py,sha256=bNy8rZVlRIvbmX27-SXqsF7pDN6t7HX8m8mHgYkoKnM,500
|
|
3
|
+
actinet/main.py,sha256=-4KM6wCNVSkO7uCF589zKULTPwgOW9zeG7JPIjJ57wI,235
|
|
4
|
+
actinet-0.0.dev0.dist-info/LICENSE.md,sha256=mk8YRvzzqqlFdfCwHD7JrZAdHBstj-SPueEuvojp7Pg,6176
|
|
5
|
+
actinet-0.0.dev0.dist-info/METADATA,sha256=k5dLLpaSHD6s54Q_CYU3ffIHARRv1Pplhp4-HTglkzE,7897
|
|
6
|
+
actinet-0.0.dev0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
7
|
+
actinet-0.0.dev0.dist-info/entry_points.txt,sha256=G36R983SiPyTjAqNU94wskgb5caUiM4v8wVQY0V0Wok,44
|
|
8
|
+
actinet-0.0.dev0.dist-info/top_level.txt,sha256=KwI3BzpUNNu-IatQgD7JNbHenvetn05JUBmePTKVGB8,8
|
|
9
|
+
actinet-0.0.dev0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
actinet
|