Skip to content

Commit efc8561

Browse files
committed
Merge branch 'main' into paper/JOSS-submission
2 parents 4f635c7 + 91587a6 commit efc8561

27 files changed

Lines changed: 18628 additions & 480 deletions

README.md

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The package currently supports the following formats:
2525
| BIN | GENEActiv | GENEActiv ||
2626

2727
**Special Note**
28-
The `idle_sleep_mode` for Actigraph watches will lead to uneven sampling rates during periods of no motion (read about this [here](https://actigraphcorp.my.site.com/support/s/article/Idle-Sleep-Mode-Explained)). Consequently, this causes issues when implementing wristpy's non-wear and sleep detection. As of this moment, we fill in the missing acceleration data with the assumption that the watch is perfeclty idle in the face-up position (Acceleration vector = [0, 0, -1]). The data is filled in at the same sampling rate as the raw acceleration data. In the special circumstance when acceleration samples are not evenly spaced, the data is resampled to the highest effective sampling rate to ensure linearly sampled data.
28+
The `idle_sleep_mode` for Actigraph watches will lead to uneven sampling rates during periods of no motion (read about this [here](https://actigraphcorp.my.site.com/support/s/article/Idle-Sleep-Mode-Explained)). Consequently, this causes issues when implementing wristpy's non-wear and sleep detection. As of this moment, we fill in the missing acceleration data with the assumption that the watch is perfectly idle in the face-up position (Acceleration vector = [0, 0, -1]). The data is filled in at the same sampling rate as the raw acceleration data. In the special circumstance when acceleration samples are not evenly spaced, the data is resampled to the highest effective sampling rate to ensure linearly sampled data.
2929

3030
## Processing pipeline implementation
3131

@@ -37,12 +37,21 @@ The main processing pipeline of the wristpy module can be described as follows:
3737
- **Metrics Calculation**: Calculates various metrics on the calibrated data, namely ENMO (Euclidean norm , minus one) and angle-Z (angle of acceleration relative to the *x-y* axis).
3838
- **Non-wear detection**: We find periods of non-wear based on the acceleration data. Specifically, the standard deviation of the acceleration values in a given time window, along each axis, is used as a threshold to decide `wear` or `not wear`.
3939
- **Sleep Detection**: Using the HDCZ<sup>1</sup> and HSPT<sup>2</sup> algorithms to analyze changes in arm angle we are able to find periods of sleep. We find the sleep onset-wakeup times for all sleep windows detected.
40-
- **Physical activity levels**: Using the enmo data (aggreagated into epoch 1 time bins, 5 second default) we compute activity levels into the following categories: inactivity, light activity, moderate activity, vigorous activity. The default threshold values have been chosen based on the values presented in the Hildenbrand 2014 study<sup>3</sup>.
40+
- **Physical activity levels**: Using the enmo data (aggregated into epoch 1 time bins, 5 second default) we compute activity levels into the following categories: inactivity, light activity, moderate activity, vigorous activity. The default threshold values have been chosen based on the values presented in the Hildenbrand 2014 study<sup>3</sup>.
4141

4242

4343
## Installation
4444

45-
Install this package from PyPI via :
45+
> ### ⚠️ Important Note for macOS Users
46+
>
47+
> **wristpy** depends on `libomp`, a system-level dependency that is not always installed by default on macOS. Install it via:
48+
>
49+
> ```bash
50+
> brew install libomp
51+
> ```
52+
53+
54+
Install the `wristpy` package from PyPI via:
4655
4756
```sh
4857
pip install wristpy
@@ -63,6 +72,12 @@ wristpy /input/file/path.gt3x -o /save/path/file_name.csv -c gradient
6372
wristpy /path/to/files/input_dir -o /path/to/files/output_dir -c gradient -O .csv
6473
```
6574

75+
#### For a full list of command line arguments:
76+
```sh
77+
wristpy --help
78+
```
79+
80+
6681
### Using Wristpy through a python script or notebook:
6782

6883
#### Running single files:
@@ -83,7 +98,7 @@ results = orchestrator.run(
8398
)
8499

85100
#Data available in results object
86-
enmo = results.enmo
101+
physical_activity_metric = results.physical_activity_metric
87102
anglez = results.anglez
88103
physical_activity_levels = results.physical_activity_levels
89104
nonwear_array = results.nonwear_epoch
@@ -109,10 +124,10 @@ results_dict = orchestrator.run(
109124
)
110125

111126

112-
#Data available in dictionry of results.
127+
#Data available in dictionary of results.
113128
subject1 = results_dict['subject1']
114129

115-
enmo = subject1.enmo
130+
physical_activity_metric = subject1.physical_activity_metric
116131
anglez = subject1.anglez
117132
physical_activity_levels = subject1.physical_activity_levels
118133
nonwear_array = subject1.nonwear_epoch
@@ -134,7 +149,7 @@ sleep_windows = subject1.sleep_windows_epoch
134149
docker run -it --rm \
135150
-v "/local/path/to/data:/data" \
136151
-v "/local/path/to/output:/output" \
137-
cmidair/wristpy
152+
cmidair/wristpy:main
138153
```
139154
Replace `/local/path/to/data` with the path to your input data directory and `/local/path/to/output` with where you want results saved.
140155

@@ -143,7 +158,7 @@ sleep_windows = subject1.sleep_windows_epoch
143158
docker run -it --rm \
144159
-v "/local/path/to/data/file.bin:/data/file.bin" \
145160
-v "/local/path/to/output:/output" \
146-
cmidair/wristpy
161+
cmidair/wristpy:main
147162
```
148163

149164
### Customizing the Pipeline:
@@ -154,7 +169,7 @@ The Docker image supports multiple input variables to customize processing. You
154169
docker run -it --rm \
155170
-v "/local/path/to/data/file.bin:/data/file.bin" \
156171
-v "/local/path/to/output:/output" \
157-
cmidair/wristpy /data --output /output --epoch-length 5 --nonwear-algorithm ggir --nonwear-algorithm detach --thresholds 0.1 0.2 0.4
172+
cmidair/wristpy:main /data --output /output --epoch-length 5 --nonwear-algorithm ggir --nonwear-algorithm detach --thresholds 0.1 0.2 0.4
158173
```
159174

160175

0 commit comments

Comments
 (0)