actinet 0.0.dev0__tar.gz
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-0.0.dev0/LICENSE.md +52 -0
- actinet-0.0.dev0/PKG-INFO +188 -0
- actinet-0.0.dev0/README.md +169 -0
- actinet-0.0.dev0/pyproject.toml +163 -0
- actinet-0.0.dev0/setup.cfg +4 -0
- actinet-0.0.dev0/setup.py +92 -0
- actinet-0.0.dev0/src/actinet/__init__.py +8 -0
- actinet-0.0.dev0/src/actinet/_version.py +21 -0
- actinet-0.0.dev0/src/actinet/main.py +13 -0
- actinet-0.0.dev0/src/actinet.egg-info/PKG-INFO +188 -0
- actinet-0.0.dev0/src/actinet.egg-info/SOURCES.txt +14 -0
- actinet-0.0.dev0/src/actinet.egg-info/dependency_links.txt +1 -0
- actinet-0.0.dev0/src/actinet.egg-info/entry_points.txt +2 -0
- actinet-0.0.dev0/src/actinet.egg-info/requires.txt +13 -0
- actinet-0.0.dev0/src/actinet.egg-info/top_level.txt +1 -0
- actinet-0.0.dev0/versioneer.py +2205 -0
|
@@ -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,188 @@
|
|
|
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
|
+
Provides-Extra: dev
|
|
17
|
+
Provides-Extra: docs
|
|
18
|
+
License-File: LICENSE.md
|
|
19
|
+
|
|
20
|
+
# actinet
|
|
21
|
+
|
|
22
|
+
A tool to extract meaningful health information from large accelerometer datasets.
|
|
23
|
+
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.
|
|
24
|
+
The backbone of this repository is a self-supervised Resnet18 model.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
*Minimum requirements*: Python>=3.8, Java 8 (1.8)
|
|
29
|
+
|
|
30
|
+
The following instructions make use of Anaconda to meet the minimum requirements:
|
|
31
|
+
|
|
32
|
+
1. Download & install [Miniconda](https://docs.conda.io/en/latest/miniconda.html) (light-weight version of Anaconda).
|
|
33
|
+
1. (Windows) Once installed, launch the **Anaconda Prompt**.
|
|
34
|
+
1. Create a virtual environment:
|
|
35
|
+
```console
|
|
36
|
+
$ conda create -n actinet python=3.9 openjdk pip
|
|
37
|
+
```
|
|
38
|
+
This creates a virtual environment called `actinet` with Python version 3.9, OpenJDK, and Pip.
|
|
39
|
+
1. Activate the environment:
|
|
40
|
+
```console
|
|
41
|
+
$ conda activate actinet
|
|
42
|
+
```
|
|
43
|
+
You should now see `(actinet)` written in front of your prompt.
|
|
44
|
+
1. Install `actinet`:
|
|
45
|
+
```console
|
|
46
|
+
$ pip install actinet
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
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!
|
|
50
|
+
|
|
51
|
+
## Usage
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Process an AX3 file
|
|
55
|
+
$ actinet sample.cwa
|
|
56
|
+
|
|
57
|
+
# Or an ActiGraph file
|
|
58
|
+
$ actinet sample.gt3x
|
|
59
|
+
|
|
60
|
+
# Or a GENEActiv file
|
|
61
|
+
$ actinet sample.bin
|
|
62
|
+
|
|
63
|
+
# Or a CSV file (see data format below)
|
|
64
|
+
$ actinet sample.csv
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Troubleshooting
|
|
69
|
+
Some systems may face issues with Java when running the script. If this is your case, try fixing OpenJDK to version 8:
|
|
70
|
+
```console
|
|
71
|
+
$ conda install -n actinet openjdk=8
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Output files
|
|
75
|
+
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:
|
|
76
|
+
|
|
77
|
+
```console
|
|
78
|
+
$ actinet sample.cwa -o /path/to/some/folder/
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The following output files are created:
|
|
82
|
+
|
|
83
|
+
- *Info.json* Summary info, as shown above.
|
|
84
|
+
- *timeSeries.csv* Raw time-series of activity levels
|
|
85
|
+
|
|
86
|
+
See [Data Dictionary](https://biobankaccanalysis.readthedocs.io/en/latest/datadict.html) for the list of output variables.
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
### Crude vs. Adjusted Estimates
|
|
90
|
+
Adjusted estimates are provided that account for missing data.
|
|
91
|
+
Missing values in the time-series are imputed with the mean of the same timepoint of other available days.
|
|
92
|
+
For adjusted totals and daily statistics, 24h multiples are needed and will be imputed if necessary.
|
|
93
|
+
Estimates will be NaN where data is still missing after imputation.
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
### Processing CSV files
|
|
97
|
+
If a CSV file is provided, it must have the following header: `time`, `x`, `y`, `z`.
|
|
98
|
+
|
|
99
|
+
Example:
|
|
100
|
+
```console
|
|
101
|
+
time,x,y,z
|
|
102
|
+
2013-10-21 10:00:08.000,-0.078923,0.396706,0.917759
|
|
103
|
+
2013-10-21 10:00:08.010,-0.094370,0.381479,0.933580
|
|
104
|
+
2013-10-21 10:00:08.020,-0.094370,0.366252,0.901938
|
|
105
|
+
2013-10-21 10:00:08.030,-0.078923,0.411933,0.901938
|
|
106
|
+
...
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Processing multiple files
|
|
110
|
+
#### Windows
|
|
111
|
+
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*.
|
|
112
|
+
|
|
113
|
+
Example text file *commands.txt*:
|
|
114
|
+
```console
|
|
115
|
+
actinet file1.cwa &
|
|
116
|
+
actinet file2.cwa &
|
|
117
|
+
actinet file3.cwa
|
|
118
|
+
:END
|
|
119
|
+
````
|
|
120
|
+
Once this file is created, run `cmd < commands.txt` from the terminal.
|
|
121
|
+
|
|
122
|
+
#### Linux
|
|
123
|
+
Create a file *command.sh* with:
|
|
124
|
+
```console
|
|
125
|
+
actinet file1.cwa
|
|
126
|
+
actinet file2.cwa
|
|
127
|
+
actinet file3.cwa
|
|
128
|
+
```
|
|
129
|
+
Then, run `bash command.sh` from the terminal.
|
|
130
|
+
|
|
131
|
+
#### Collating outputs
|
|
132
|
+
|
|
133
|
+
A utility script is provided to collate outputs from multiple runs:
|
|
134
|
+
|
|
135
|
+
```console
|
|
136
|
+
$ actinet-collate-outputs outputs/
|
|
137
|
+
```
|
|
138
|
+
This will collate all *-Info.json files found in outputs/ and generate a CSV file.
|
|
139
|
+
|
|
140
|
+
## Citing our work
|
|
141
|
+
|
|
142
|
+
When using this tool, please consider citing the works listed in [CITATION.md](https://github.com/OxWearables/actinet/blob/main/CITATION.md).
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
## Licence
|
|
146
|
+
See [LICENSE.md](https://github.com/OxWearables/actinet/blob/main/LICENSE.md).
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
## Acknowledgements
|
|
150
|
+
We would like to thank all our code contributors, manuscript co-authors, and research participants for their help in making this work possible.
|
|
151
|
+
|
|
152
|
+
# Sample PyPI package + GitHub Actions + Versioneer
|
|
153
|
+
|
|
154
|
+
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:
|
|
155
|
+
|
|
156
|
+
```console
|
|
157
|
+
$ git tag vX.Y.Z && git push --tags
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
The following guide assumes familiarity with `setuptools` and PyPI. For an introduction to Python packaging, see the references at the bottom.
|
|
161
|
+
|
|
162
|
+
## How to use this template
|
|
163
|
+
|
|
164
|
+
1. Click on the *Use this template* button to get a copy of this repository.
|
|
165
|
+
1. Rename *src/sample_package* folder to your package name — *src/* is where your package must reside.
|
|
166
|
+
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.
|
|
167
|
+
1. setup.py
|
|
168
|
+
1. pyproject.toml
|
|
169
|
+
1. \_\_init\_\_.py
|
|
170
|
+
1. Install `versioneer` and `tomli`, and run `versioneer`:
|
|
171
|
+
|
|
172
|
+
```console
|
|
173
|
+
$ pip install tomli
|
|
174
|
+
$ pip install versioneer
|
|
175
|
+
$ versioneer install
|
|
176
|
+
```
|
|
177
|
+
Then *commit* the changes produced by `versioneer`. See [here](https://github.com/python-versioneer/python-versioneer/blob/master/INSTALL.md) to learn more.
|
|
178
|
+
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*.
|
|
179
|
+
|
|
180
|
+
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.
|
|
181
|
+
|
|
182
|
+
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.
|
|
183
|
+
|
|
184
|
+
## References
|
|
185
|
+
- Python packaging guide: https://packaging.python.org/en/latest/tutorials/packaging-projects/
|
|
186
|
+
- ...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*.
|
|
187
|
+
- Versioneer: https://github.com/python-versioneer/python-versioneer
|
|
188
|
+
- GitHub Actions: https://docs.github.com/en/actions
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# actinet
|
|
2
|
+
|
|
3
|
+
A tool to extract meaningful health information from large accelerometer datasets.
|
|
4
|
+
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.
|
|
5
|
+
The backbone of this repository is a self-supervised Resnet18 model.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
*Minimum requirements*: Python>=3.8, Java 8 (1.8)
|
|
10
|
+
|
|
11
|
+
The following instructions make use of Anaconda to meet the minimum requirements:
|
|
12
|
+
|
|
13
|
+
1. Download & install [Miniconda](https://docs.conda.io/en/latest/miniconda.html) (light-weight version of Anaconda).
|
|
14
|
+
1. (Windows) Once installed, launch the **Anaconda Prompt**.
|
|
15
|
+
1. Create a virtual environment:
|
|
16
|
+
```console
|
|
17
|
+
$ conda create -n actinet python=3.9 openjdk pip
|
|
18
|
+
```
|
|
19
|
+
This creates a virtual environment called `actinet` with Python version 3.9, OpenJDK, and Pip.
|
|
20
|
+
1. Activate the environment:
|
|
21
|
+
```console
|
|
22
|
+
$ conda activate actinet
|
|
23
|
+
```
|
|
24
|
+
You should now see `(actinet)` written in front of your prompt.
|
|
25
|
+
1. Install `actinet`:
|
|
26
|
+
```console
|
|
27
|
+
$ pip install actinet
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
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!
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Process an AX3 file
|
|
36
|
+
$ actinet sample.cwa
|
|
37
|
+
|
|
38
|
+
# Or an ActiGraph file
|
|
39
|
+
$ actinet sample.gt3x
|
|
40
|
+
|
|
41
|
+
# Or a GENEActiv file
|
|
42
|
+
$ actinet sample.bin
|
|
43
|
+
|
|
44
|
+
# Or a CSV file (see data format below)
|
|
45
|
+
$ actinet sample.csv
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Troubleshooting
|
|
50
|
+
Some systems may face issues with Java when running the script. If this is your case, try fixing OpenJDK to version 8:
|
|
51
|
+
```console
|
|
52
|
+
$ conda install -n actinet openjdk=8
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Output files
|
|
56
|
+
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:
|
|
57
|
+
|
|
58
|
+
```console
|
|
59
|
+
$ actinet sample.cwa -o /path/to/some/folder/
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The following output files are created:
|
|
63
|
+
|
|
64
|
+
- *Info.json* Summary info, as shown above.
|
|
65
|
+
- *timeSeries.csv* Raw time-series of activity levels
|
|
66
|
+
|
|
67
|
+
See [Data Dictionary](https://biobankaccanalysis.readthedocs.io/en/latest/datadict.html) for the list of output variables.
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### Crude vs. Adjusted Estimates
|
|
71
|
+
Adjusted estimates are provided that account for missing data.
|
|
72
|
+
Missing values in the time-series are imputed with the mean of the same timepoint of other available days.
|
|
73
|
+
For adjusted totals and daily statistics, 24h multiples are needed and will be imputed if necessary.
|
|
74
|
+
Estimates will be NaN where data is still missing after imputation.
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
### Processing CSV files
|
|
78
|
+
If a CSV file is provided, it must have the following header: `time`, `x`, `y`, `z`.
|
|
79
|
+
|
|
80
|
+
Example:
|
|
81
|
+
```console
|
|
82
|
+
time,x,y,z
|
|
83
|
+
2013-10-21 10:00:08.000,-0.078923,0.396706,0.917759
|
|
84
|
+
2013-10-21 10:00:08.010,-0.094370,0.381479,0.933580
|
|
85
|
+
2013-10-21 10:00:08.020,-0.094370,0.366252,0.901938
|
|
86
|
+
2013-10-21 10:00:08.030,-0.078923,0.411933,0.901938
|
|
87
|
+
...
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Processing multiple files
|
|
91
|
+
#### Windows
|
|
92
|
+
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*.
|
|
93
|
+
|
|
94
|
+
Example text file *commands.txt*:
|
|
95
|
+
```console
|
|
96
|
+
actinet file1.cwa &
|
|
97
|
+
actinet file2.cwa &
|
|
98
|
+
actinet file3.cwa
|
|
99
|
+
:END
|
|
100
|
+
````
|
|
101
|
+
Once this file is created, run `cmd < commands.txt` from the terminal.
|
|
102
|
+
|
|
103
|
+
#### Linux
|
|
104
|
+
Create a file *command.sh* with:
|
|
105
|
+
```console
|
|
106
|
+
actinet file1.cwa
|
|
107
|
+
actinet file2.cwa
|
|
108
|
+
actinet file3.cwa
|
|
109
|
+
```
|
|
110
|
+
Then, run `bash command.sh` from the terminal.
|
|
111
|
+
|
|
112
|
+
#### Collating outputs
|
|
113
|
+
|
|
114
|
+
A utility script is provided to collate outputs from multiple runs:
|
|
115
|
+
|
|
116
|
+
```console
|
|
117
|
+
$ actinet-collate-outputs outputs/
|
|
118
|
+
```
|
|
119
|
+
This will collate all *-Info.json files found in outputs/ and generate a CSV file.
|
|
120
|
+
|
|
121
|
+
## Citing our work
|
|
122
|
+
|
|
123
|
+
When using this tool, please consider citing the works listed in [CITATION.md](https://github.com/OxWearables/actinet/blob/main/CITATION.md).
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
## Licence
|
|
127
|
+
See [LICENSE.md](https://github.com/OxWearables/actinet/blob/main/LICENSE.md).
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
## Acknowledgements
|
|
131
|
+
We would like to thank all our code contributors, manuscript co-authors, and research participants for their help in making this work possible.
|
|
132
|
+
|
|
133
|
+
# Sample PyPI package + GitHub Actions + Versioneer
|
|
134
|
+
|
|
135
|
+
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:
|
|
136
|
+
|
|
137
|
+
```console
|
|
138
|
+
$ git tag vX.Y.Z && git push --tags
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The following guide assumes familiarity with `setuptools` and PyPI. For an introduction to Python packaging, see the references at the bottom.
|
|
142
|
+
|
|
143
|
+
## How to use this template
|
|
144
|
+
|
|
145
|
+
1. Click on the *Use this template* button to get a copy of this repository.
|
|
146
|
+
1. Rename *src/sample_package* folder to your package name — *src/* is where your package must reside.
|
|
147
|
+
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.
|
|
148
|
+
1. setup.py
|
|
149
|
+
1. pyproject.toml
|
|
150
|
+
1. \_\_init\_\_.py
|
|
151
|
+
1. Install `versioneer` and `tomli`, and run `versioneer`:
|
|
152
|
+
|
|
153
|
+
```console
|
|
154
|
+
$ pip install tomli
|
|
155
|
+
$ pip install versioneer
|
|
156
|
+
$ versioneer install
|
|
157
|
+
```
|
|
158
|
+
Then *commit* the changes produced by `versioneer`. See [here](https://github.com/python-versioneer/python-versioneer/blob/master/INSTALL.md) to learn more.
|
|
159
|
+
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*.
|
|
160
|
+
|
|
161
|
+
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.
|
|
162
|
+
|
|
163
|
+
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.
|
|
164
|
+
|
|
165
|
+
## References
|
|
166
|
+
- Python packaging guide: https://packaging.python.org/en/latest/tutorials/packaging-projects/
|
|
167
|
+
- ...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*.
|
|
168
|
+
- Versioneer: https://github.com/python-versioneer/python-versioneer
|
|
169
|
+
- GitHub Actions: https://docs.github.com/en/actions
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# [project]
|
|
2
|
+
# # Template from: https://github.com/pypa/sampleproject
|
|
3
|
+
# # This is the name of your project. The first time you publish this
|
|
4
|
+
# # package, this name will be registered for you. It will determine how
|
|
5
|
+
# # users can install this project, e.g.:
|
|
6
|
+
# #
|
|
7
|
+
# # $ pip install sampleproject
|
|
8
|
+
# #
|
|
9
|
+
# # And where it will live on PyPI: https://pypi.org/project/sampleproject/
|
|
10
|
+
# #
|
|
11
|
+
# # There are some restrictions on what makes a valid project name
|
|
12
|
+
# # specification here:
|
|
13
|
+
# # https://packaging.python.org/specifications/core-metadata/#name
|
|
14
|
+
# name = "sample-package-chanshing" # Required
|
|
15
|
+
|
|
16
|
+
# # Versions should comply with PEP 440:
|
|
17
|
+
# # https://www.python.org/dev/peps/pep-0440/
|
|
18
|
+
# #
|
|
19
|
+
# # For a discussion on single-sourcing the version, see
|
|
20
|
+
# # https://packaging.python.org/guides/single-sourcing-package-version/
|
|
21
|
+
# version = "0.0.1" # Required
|
|
22
|
+
|
|
23
|
+
# # This is a one-line description or tagline of what your project does. This
|
|
24
|
+
# # corresponds to the "Summary" metadata field:
|
|
25
|
+
# # https://packaging.python.org/specifications/core-metadata/#summary
|
|
26
|
+
# description = "An example Python project" # Optional
|
|
27
|
+
|
|
28
|
+
# # This is an optional longer description of your project that represents
|
|
29
|
+
# # the body of text which users will see when they visit PyPI.
|
|
30
|
+
# #
|
|
31
|
+
# # Often, this is the same as your README, so you can just read it in from
|
|
32
|
+
# # that file directly (as we have already done above)
|
|
33
|
+
# #
|
|
34
|
+
# # This field corresponds to the "Description" metadata field:
|
|
35
|
+
# # https://packaging.python.org/specifications/core-metadata/#description-optional
|
|
36
|
+
# readme = "README.md" # Optional
|
|
37
|
+
|
|
38
|
+
# # Specify which Python versions you support. In contrast to the
|
|
39
|
+
# # 'Programming Language' classifiers above, 'pip install' will check this
|
|
40
|
+
# # and refuse to install the project if the version does not match. See
|
|
41
|
+
# # https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-requires
|
|
42
|
+
# requires-python = ">=3.8"
|
|
43
|
+
|
|
44
|
+
# # This is either text indicating the license for the distribution, or a file
|
|
45
|
+
# # that contains the license
|
|
46
|
+
# # https://packaging.python.org/en/latest/specifications/core-metadata/#license
|
|
47
|
+
# license = {file = "LICENSE.md"}
|
|
48
|
+
|
|
49
|
+
# # This field adds keywords for your project which will appear on the
|
|
50
|
+
# # project page. What does your project relate to?
|
|
51
|
+
# #
|
|
52
|
+
# # Note that this is a list of additional keywords, separated
|
|
53
|
+
# # by commas, to be used to assist searching for the distribution in a
|
|
54
|
+
# # larger catalog.
|
|
55
|
+
# keywords = ["example", "setuptools", "development"] # Optional
|
|
56
|
+
|
|
57
|
+
# # This should be your name or the name of the organization who originally
|
|
58
|
+
# # authored the project, and a valid email address corresponding to the name
|
|
59
|
+
# # listed.
|
|
60
|
+
# authors = [
|
|
61
|
+
# {name = "A. Random Developer", email = "author@example.com" } # Optional
|
|
62
|
+
# ]
|
|
63
|
+
|
|
64
|
+
# # This should be your name or the names of the organization who currently
|
|
65
|
+
# # maintains the project, and a valid email address corresponding to the name
|
|
66
|
+
# # listed.
|
|
67
|
+
# maintainers = [
|
|
68
|
+
# {name = "A. Great Maintainer", email = "maintainer@example.com" } # Optional
|
|
69
|
+
# ]
|
|
70
|
+
|
|
71
|
+
# # Classifiers help users find your project by categorizing it.
|
|
72
|
+
# #
|
|
73
|
+
# # For a list of valid classifiers, see https://pypi.org/classifiers/
|
|
74
|
+
# classifiers = [ # Optional
|
|
75
|
+
# # How mature is this project? Common values are
|
|
76
|
+
# # 3 - Alpha
|
|
77
|
+
# # 4 - Beta
|
|
78
|
+
# # 5 - Production/Stable
|
|
79
|
+
# "Development Status :: 3 - Alpha",
|
|
80
|
+
|
|
81
|
+
# # Indicate who your project is intended for
|
|
82
|
+
# "Intended Audience :: Developers",
|
|
83
|
+
# "Topic :: Software Development :: Build Tools",
|
|
84
|
+
|
|
85
|
+
# # Pick your license as you wish
|
|
86
|
+
# "License :: OSI Approved :: MIT License",
|
|
87
|
+
|
|
88
|
+
# # Specify the Python versions you support here. In particular, ensure
|
|
89
|
+
# # that you indicate you support Python 3. These classifiers are *not*
|
|
90
|
+
# # checked by "pip install". See instead "python_requires" below.
|
|
91
|
+
# "Programming Language :: Python :: 3",
|
|
92
|
+
# "Programming Language :: Python :: 3.7",
|
|
93
|
+
# "Programming Language :: Python :: 3.8",
|
|
94
|
+
# "Programming Language :: Python :: 3.9",
|
|
95
|
+
# "Programming Language :: Python :: 3.10",
|
|
96
|
+
# "Programming Language :: Python :: 3.11",
|
|
97
|
+
# "Programming Language :: Python :: 3 :: Only",
|
|
98
|
+
# ]
|
|
99
|
+
|
|
100
|
+
# # This field lists other packages that your project depends on to run.
|
|
101
|
+
# # Any package you put here will be installed by pip when your project is
|
|
102
|
+
# # installed, so they must be valid existing projects.
|
|
103
|
+
# #
|
|
104
|
+
# # For an analysis of this field vs pip's requirements files see:
|
|
105
|
+
# # https://packaging.python.org/discussions/install-requires-vs-requirements/
|
|
106
|
+
# dependencies = [ # Optional
|
|
107
|
+
# "peppercorn"
|
|
108
|
+
# ]
|
|
109
|
+
|
|
110
|
+
# # List additional groups of dependencies here (e.g. development
|
|
111
|
+
# # dependencies). Users will be able to install these using the "extras"
|
|
112
|
+
# # syntax, for example:
|
|
113
|
+
# #
|
|
114
|
+
# # $ pip install sampleproject[dev]
|
|
115
|
+
# #
|
|
116
|
+
# # Similar to `dependencies` above, these must be valid existing
|
|
117
|
+
# # projects.
|
|
118
|
+
# [project.optional-dependencies] # Optional
|
|
119
|
+
# dev = ["check-manifest", "build", "twine", "versioneer", "flake8", "autopep8", "ipdb"]
|
|
120
|
+
# test = ["coverage"]
|
|
121
|
+
|
|
122
|
+
# # List URLs that are relevant to your project
|
|
123
|
+
# #
|
|
124
|
+
# # This field corresponds to the "Project-URL" and "Home-Page" metadata fields:
|
|
125
|
+
# # https://packaging.python.org/specifications/core-metadata/#project-url-multiple-use
|
|
126
|
+
# # https://packaging.python.org/specifications/core-metadata/#home-page-optional
|
|
127
|
+
# #
|
|
128
|
+
# # Examples listed include a pattern for specifying where the package tracks
|
|
129
|
+
# # issues, where the source is hosted, where to say thanks to the package
|
|
130
|
+
# # maintainers, and where to support the project financially. The key is
|
|
131
|
+
# # what's used to render the link text on PyPI.
|
|
132
|
+
# [project.urls] # Optional
|
|
133
|
+
# "Homepage" = "https://github.com/pypa/sampleproject"
|
|
134
|
+
# "Bug Reports" = "https://github.com/pypa/sampleproject/issues"
|
|
135
|
+
# "Funding" = "https://donate.pypi.org"
|
|
136
|
+
# "Say Thanks!" = "http://saythanks.io/to/example"
|
|
137
|
+
# "Source" = "https://github.com/pypa/sampleproject/"
|
|
138
|
+
|
|
139
|
+
# # The following would provide a command line executable called `example`
|
|
140
|
+
# # which executes the function `main` from this package when invoked.
|
|
141
|
+
# [project.scripts] # Optional
|
|
142
|
+
# example = "sample_package.main:main"
|
|
143
|
+
|
|
144
|
+
# This is configuration specific to the `setuptools` build backend.
|
|
145
|
+
# If you are using a different build backend, you will need to change this.
|
|
146
|
+
# [tool.setuptools]
|
|
147
|
+
# If there are data files included in your packages that need to be
|
|
148
|
+
# installed, specify them here.
|
|
149
|
+
# package-data = {"sample_package" = ["*.rst", "*.txt", "*.java", "*.class"]}
|
|
150
|
+
|
|
151
|
+
[build-system]
|
|
152
|
+
# These are the assumed default build requirements from pip:
|
|
153
|
+
# https://pip.pypa.io/en/stable/reference/pip/#pep-517-and-518-support
|
|
154
|
+
requires = ["setuptools>=43.0.0", "wheel", "tomli"]
|
|
155
|
+
build-backend = "setuptools.build_meta"
|
|
156
|
+
|
|
157
|
+
[tool.versioneer]
|
|
158
|
+
VCS = "git"
|
|
159
|
+
style = "pep440"
|
|
160
|
+
versionfile_source = "src/actinet/_version.py"
|
|
161
|
+
versionfile_build = "actinet/_version.py"
|
|
162
|
+
tag_prefix = "v"
|
|
163
|
+
parentdir_prefix = "actinet-"
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import os.path
|
|
3
|
+
# https://github.com/python-versioneer/python-versioneer/issues/193
|
|
4
|
+
sys.path.insert(0, os.path.dirname(__file__))
|
|
5
|
+
|
|
6
|
+
from setuptools import setup, find_packages
|
|
7
|
+
import codecs
|
|
8
|
+
|
|
9
|
+
import versioneer
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def main():
|
|
14
|
+
|
|
15
|
+
with open("README.md", "r") as fh:
|
|
16
|
+
long_description = fh.read()
|
|
17
|
+
|
|
18
|
+
setup(
|
|
19
|
+
name="actinet",
|
|
20
|
+
version=versioneer.get_version(), # Do not edit
|
|
21
|
+
cmdclass=versioneer.get_cmdclass(), # Do not edit
|
|
22
|
+
python_requires=">=3.8, <4",
|
|
23
|
+
description="Activity detection algorithm compatible with the UK Biobank Accelerometer Dataset",
|
|
24
|
+
long_description=long_description, # Do not edit. See README.md
|
|
25
|
+
long_description_content_type="text/markdown",
|
|
26
|
+
keywords="example, setuptools, versioneer",
|
|
27
|
+
url="https://github.com/OxWearables/actinet",
|
|
28
|
+
download_url="https://github.com/OxWearables/actinet",
|
|
29
|
+
author=get_string("__author__"), # Do not edit. see src/actinet/__init__.py
|
|
30
|
+
maintainer=get_string("__maintainer__"), # Do not edit. see src/actinet/__init__.py
|
|
31
|
+
maintainer_email=get_string("__maintainer_email__"), # Do not edit. See src/actinet/__init__.py
|
|
32
|
+
license=get_string("__license__"), # Do not edit. See src/actinet/__init__.py
|
|
33
|
+
|
|
34
|
+
# This is for PyPI to categorize your project. See: https://pypi.org/classifiers/
|
|
35
|
+
classifiers=[
|
|
36
|
+
"Programming Language :: Python :: 3",
|
|
37
|
+
"Topic :: Scientific/Engineering",
|
|
38
|
+
],
|
|
39
|
+
|
|
40
|
+
# Where to find the source code
|
|
41
|
+
packages=find_packages(where="src", exclude=("test", "tests")),
|
|
42
|
+
package_dir={"": "src"},
|
|
43
|
+
# What other files to include, e.g. *.class if the package uses some Java code.
|
|
44
|
+
package_data={"actinet": ["*.txt", "*.rst", "*.md"]},
|
|
45
|
+
|
|
46
|
+
# Dependencies
|
|
47
|
+
install_requires=[],
|
|
48
|
+
|
|
49
|
+
extras_require={
|
|
50
|
+
"dev": [
|
|
51
|
+
"versioneer",
|
|
52
|
+
"twine",
|
|
53
|
+
"ipdb",
|
|
54
|
+
"flake8",
|
|
55
|
+
"autopep8",
|
|
56
|
+
],
|
|
57
|
+
"docs": [
|
|
58
|
+
"sphinx>=4.2",
|
|
59
|
+
"sphinx_rtd_theme>=1.0",
|
|
60
|
+
"readthedocs-sphinx-search>=0.1",
|
|
61
|
+
"docutils<0.18",
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
# Define entry points for command-line scripts, e.g.: `$ hello --name Alice`
|
|
66
|
+
entry_points={
|
|
67
|
+
"console_scripts": [
|
|
68
|
+
"hello=actinet.main:main",
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def read(rel_path):
|
|
76
|
+
here = os.path.abspath(os.path.dirname(__file__))
|
|
77
|
+
with codecs.open(os.path.join(here, rel_path), 'r') as fp:
|
|
78
|
+
return fp.read()
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def get_string(string, rel_path="src/actinet/__init__.py"):
|
|
82
|
+
for line in read(rel_path).splitlines():
|
|
83
|
+
if line.startswith(string):
|
|
84
|
+
delim = '"' if '"' in line else "'"
|
|
85
|
+
return line.split(delim)[1]
|
|
86
|
+
else:
|
|
87
|
+
raise RuntimeError(f"Unable to find {string}.")
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
if __name__ == "__main__":
|
|
92
|
+
main()
|