paradigma 1.0.3__tar.gz → 1.0.4__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.
- {paradigma-1.0.3 → paradigma-1.0.4}/LICENSE +0 -1
- {paradigma-1.0.3 → paradigma-1.0.4}/PKG-INFO +31 -29
- {paradigma-1.0.3 → paradigma-1.0.4}/README.md +27 -27
- {paradigma-1.0.3 → paradigma-1.0.4}/pyproject.toml +10 -3
- {paradigma-1.0.3 → paradigma-1.0.4}/src/paradigma/classification.py +28 -11
- {paradigma-1.0.3 → paradigma-1.0.4}/src/paradigma/config.py +157 -102
- {paradigma-1.0.3 → paradigma-1.0.4}/src/paradigma/constants.py +39 -34
- {paradigma-1.0.3 → paradigma-1.0.4}/src/paradigma/feature_extraction.py +270 -211
- {paradigma-1.0.3 → paradigma-1.0.4}/src/paradigma/pipelines/gait_pipeline.py +232 -184
- {paradigma-1.0.3 → paradigma-1.0.4}/src/paradigma/pipelines/pulse_rate_pipeline.py +202 -133
- {paradigma-1.0.3 → paradigma-1.0.4}/src/paradigma/pipelines/pulse_rate_utils.py +144 -142
- {paradigma-1.0.3 → paradigma-1.0.4}/src/paradigma/pipelines/tremor_pipeline.py +138 -85
- {paradigma-1.0.3 → paradigma-1.0.4}/src/paradigma/preprocessing.py +179 -110
- {paradigma-1.0.3 → paradigma-1.0.4}/src/paradigma/segmenting.py +138 -113
- paradigma-1.0.4/src/paradigma/testing.py +617 -0
- {paradigma-1.0.3 → paradigma-1.0.4}/src/paradigma/util.py +158 -83
- paradigma-1.0.3/src/paradigma/testing.py +0 -430
- {paradigma-1.0.3 → paradigma-1.0.4}/src/paradigma/__init__.py +0 -0
- {paradigma-1.0.3 → paradigma-1.0.4}/src/paradigma/assets/gait_detection_clf_package.pkl +0 -0
- {paradigma-1.0.3 → paradigma-1.0.4}/src/paradigma/assets/gait_filtering_clf_package.pkl +0 -0
- {paradigma-1.0.3 → paradigma-1.0.4}/src/paradigma/assets/ppg_quality_clf_package.pkl +0 -0
- {paradigma-1.0.3 → paradigma-1.0.4}/src/paradigma/assets/tremor_detection_clf_package.pkl +0 -0
- {paradigma-1.0.3 → paradigma-1.0.4}/src/paradigma/pipelines/__init__.py +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: paradigma
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.4
|
|
4
4
|
Summary: ParaDigMa - A toolbox for deriving Parkinson's disease Digital Markers from real-life wrist sensor data
|
|
5
5
|
License: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
6
7
|
Author: Erik Post
|
|
7
8
|
Author-email: erik.post@radboudumc.nl
|
|
8
9
|
Requires-Python: >=3.11,<4.0
|
|
@@ -11,6 +12,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
11
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
12
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
14
|
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
16
|
Requires-Dist: nbconvert (>=7.16.6,<8.0.0)
|
|
15
17
|
Requires-Dist: pandas (>=2.1.4,<3.0.0)
|
|
16
18
|
Requires-Dist: python-dateutil (>=2.9.0.post0,<3.0.0)
|
|
@@ -29,25 +31,25 @@ Description-Content-Type: text/markdown
|
|
|
29
31
|
| **DOI** | [](https://doi.org/10.5281/zenodo.13838392) |
|
|
30
32
|
| **Build Status** | [](https://www.python.org/downloads/) [](https://github.com/biomarkersParkinson/paradigma/actions/workflows/build-and-test.yml) [](https://github.com/biomarkersParkinson/paradigma/actions/workflows/pages/pages-build-deployment) |
|
|
31
33
|
| **License** | [](https://github.com/biomarkersparkinson/paradigma/blob/main/LICENSE) |
|
|
32
|
-
<!-- | **Fairness** | [](https://fair-software.eu) [](https://www.bestpractices.dev/projects/8083) | -->
|
|
34
|
+
<!-- | **Fairness** | [](https://fair-software.eu) [](https://www.bestpractices.dev/projects/8083) | -->
|
|
33
35
|
|
|
34
36
|
## Overview
|
|
35
37
|
The Parkinson's disease Digital Markers (ParaDigMa) toolbox is a Python
|
|
36
38
|
software package designed for processing real-life wrist sensor data
|
|
37
|
-
to extract digital measures of motor and non-motor signs of Parkinson's disease (PD).
|
|
38
|
-
|
|
39
|
-
Specifically, the toolbox is designed to process accelerometer, gyroscope and
|
|
40
|
-
photoplethysmography (PPG) signals, collected during passive monitoring in daily life.
|
|
41
|
-
It contains three data processing pipelines: (1) arm swing during gait, (2) tremor,
|
|
42
|
-
and (3) pulse rate. These pipelines are scientifically validated for their
|
|
43
|
-
use in persons with PD. Furthermore, the toolbox contains general functionalities for
|
|
44
|
-
signal processing and feature extraction, such as filtering, peak detection, and
|
|
39
|
+
to extract digital measures of motor and non-motor signs of Parkinson's disease (PD).
|
|
40
|
+
|
|
41
|
+
Specifically, the toolbox is designed to process accelerometer, gyroscope and
|
|
42
|
+
photoplethysmography (PPG) signals, collected during passive monitoring in daily life.
|
|
43
|
+
It contains three data processing pipelines: (1) arm swing during gait, (2) tremor,
|
|
44
|
+
and (3) pulse rate. These pipelines are scientifically validated for their
|
|
45
|
+
use in persons with PD. Furthermore, the toolbox contains general functionalities for
|
|
46
|
+
signal processing and feature extraction, such as filtering, peak detection, and
|
|
45
47
|
spectral analysis.
|
|
46
48
|
|
|
47
|
-
The toolbox is accompanied by a set of example scripts and notebooks for
|
|
48
|
-
each processing pipeline that demonstrate how to use the toolbox for extracting
|
|
49
|
+
The toolbox is accompanied by a set of example scripts and notebooks for
|
|
50
|
+
each processing pipeline that demonstrate how to use the toolbox for extracting
|
|
49
51
|
digital measures. In addition, the toolbox is designed to be modular, enabling
|
|
50
|
-
researchers to easily extend the toolbox with new algorithms and functionalities.
|
|
52
|
+
researchers to easily extend the toolbox with new algorithms and functionalities.
|
|
51
53
|
|
|
52
54
|
## Features
|
|
53
55
|
The components of ParaDigMa are shown in the diagram below.
|
|
@@ -60,20 +62,20 @@ ParaDigMa can best be understood by categorizing the sequential processes:
|
|
|
60
62
|
|
|
61
63
|
| Process | Description |
|
|
62
64
|
| ---- | ---- |
|
|
63
|
-
| Preprocessing | Preparing raw sensor signals for further processing |
|
|
65
|
+
| Preprocessing | Preparing raw sensor signals for further processing |
|
|
64
66
|
| Feature extraction | Extracting features based on windowed sensor signals |
|
|
65
|
-
| Classification | Detecting segments of interest using validated classifiers (e.g., gait segments) |
|
|
67
|
+
| Classification | Detecting segments of interest using validated classifiers (e.g., gait segments) |
|
|
66
68
|
| Quantification | Extracting specific measures from the detected segments (e.g., arm swing measures) |
|
|
67
69
|
| Aggregation | Aggregating the measures over a specific time period (e.g., week-level aggregates) |
|
|
68
70
|
|
|
69
71
|
<br/>
|
|
70
|
-
ParaDigMa contains the following validated processing pipelines (each using the processes described above):
|
|
72
|
+
ParaDigMa contains the following validated processing pipelines (each using the processes described above):
|
|
71
73
|
|
|
72
|
-
| Pipeline | Input | Output classification | Output quantification | Output week-level aggregation |
|
|
74
|
+
| Pipeline | Input | Output classification | Output quantification | Output week-level aggregation |
|
|
73
75
|
| ---- | ---- | ---- | ---- | ---- |
|
|
74
|
-
| **Arm swing during gait** | Wrist accelerometer and gyroscope data | Gait probability, gait without other arm activities probability | Arm swing range of motion (RoM) | Typical & maximum arm swing RoM |
|
|
75
|
-
| **Tremor** | Wrist gyroscope data | Tremor probability | Tremor power | % tremor time, typical & maximum tremor power |
|
|
76
|
-
| **Pulse rate** | Wrist PPG and accelerometer data | PPG signal quality | Pulse rate | Resting & maximum pulse rate |
|
|
76
|
+
| **Arm swing during gait** | Wrist accelerometer and gyroscope data | Gait probability, gait without other arm activities probability | Arm swing range of motion (RoM) | Typical & maximum arm swing RoM |
|
|
77
|
+
| **Tremor** | Wrist gyroscope data | Tremor probability | Tremor power | % tremor time, typical & maximum tremor power |
|
|
78
|
+
| **Pulse rate** | Wrist PPG and accelerometer data | PPG signal quality | Pulse rate | Resting & maximum pulse rate |
|
|
77
79
|
|
|
78
80
|
## Installation
|
|
79
81
|
|
|
@@ -91,9 +93,9 @@ The API reference contains detailed documentation of all toolbox modules and fun
|
|
|
91
93
|
The user guides provide additional information about specific topics (e.g. the required orientation of the wrist sensor).
|
|
92
94
|
|
|
93
95
|
### Sensor data requirements
|
|
94
|
-
The ParaDigMa toolbox is designed for the analysis of passive monitoring data collected using a wrist sensor in persons with PD.
|
|
96
|
+
The ParaDigMa toolbox is designed for the analysis of passive monitoring data collected using a wrist sensor in persons with PD.
|
|
95
97
|
|
|
96
|
-
Specific requirements include:
|
|
98
|
+
Specific requirements include:
|
|
97
99
|
| Pipeline | Sensor Configuration | Context of Use |
|
|
98
100
|
|------------------------|--------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
|
|
99
101
|
| **All** | - Sensor position: wrist-band on most or least affected side (validated for both, but different sensitivity for measuring disease progression for tremor and arm swing during gait). <br> - Sensor orientation: orientation as described in [Coordinate System](https://biomarkersparkinson.github.io/paradigma/guides/coordinate_system.html). <br> - Timeframe: contiguous, strictly increasing timestamps. | - Population: persons with PD. <br> - Data collection protocol: passive monitoring in daily life. |
|
|
@@ -101,11 +103,11 @@ Specific requirements include:
|
|
|
101
103
|
| **Tremor** | - Gyroscope: minimum sampling rate of 100 Hz, minimum range of ± 1000 degrees/sec. | - Compliance: for weekly measures: at least three compliant days (with ≥10 hours of data between 8 am and 10 pm). |
|
|
102
104
|
| **Pulse rate** | - PPG*: minimum sampling rate of 30 Hz, green LED. <br> - Accelerometer: minimum sampling rate of 100 Hz, minimum range of ± 4 g. | - Population: no rhythm disorders (e.g. atrial fibrillation, atrial flutter). <br> - Compliance: for weekly measures: minimum average of 12 hours of data per day. |
|
|
103
105
|
|
|
104
|
-
\* The processing of PPG signals is currently based on the blood volume pulse (arbitrary units) obtained from the Verily Study Watch
|
|
106
|
+
\* The processing of PPG signals is currently based on the blood volume pulse (arbitrary units) obtained from the Verily Study Watch. [This](https://biomarkersparkinson.github.io/paradigma/tutorials/_static/pulse_rate_analysis.html#step-3-signal-quality-classification) part of the PPG tutorial provides code and documentation on how to use the pipeline with other PPG devices.
|
|
105
107
|
|
|
106
108
|
> [!WARNING]
|
|
107
|
-
> While the toolbox is designed to work on any wrist sensor device which fulfills the requirements,
|
|
108
|
-
we have currently verified its performance on data from the Gait-up Physilog 4 (arm swing during gait & tremor) and the Verily Study Watch (all pipelines). Furthermore, the specifications above are the minimally validated requirements. For example, while ParaDigMa works with accelerometer and gyroscope data sampled at 50 Hz, its effect on subsequent processes has not been empirically validated.
|
|
109
|
+
> While the toolbox is designed to work on any wrist sensor device which fulfills the requirements,
|
|
110
|
+
we have currently verified its performance on data from the Gait-up Physilog 4 (arm swing during gait & tremor) and the Verily Study Watch (all pipelines). Furthermore, the specifications above are the minimally validated requirements. For example, while ParaDigMa works with accelerometer and gyroscope data sampled at 50 Hz, its effect on subsequent processes has not been empirically validated.
|
|
109
111
|
<br/>
|
|
110
112
|
|
|
111
113
|
We have included support for [TSDF](https://biomarkersparkinson.github.io/tsdf/) as format for loading and storing sensor data. TSDF enables efficient data storage with added metadata. However, ParaDigMa does not require a particular method of data storage and retrieval. Please see our tutorial [Data preparation](https://biomarkersparkinson.github.io/paradigma/tutorials/data_preparation.html) for examples of loading TSDF and other data formats into memory, and for preparing raw sensor data as input for the processing pipelines.
|
|
@@ -119,7 +121,7 @@ The pipelines were developed and validated using data from the Parkinson@Home Va
|
|
|
119
121
|
|
|
120
122
|
## Contributing
|
|
121
123
|
|
|
122
|
-
We welcome contributions! Please check out our [contributing guidelines](https://biomarkersparkinson.github.io/paradigma/contributing.html).
|
|
124
|
+
We welcome contributions! Please check out our [contributing guidelines](https://biomarkersparkinson.github.io/paradigma/contributing.html).
|
|
123
125
|
Please note that this project is released with a [Code of Conduct](https://biomarkersparkinson.github.io/paradigma/conduct.html). By contributing to this project, you agree to abide by its terms.
|
|
124
126
|
|
|
125
127
|
## License
|
|
@@ -128,8 +130,8 @@ It is licensed under the terms of the Apache License 2.0 license. See [License](
|
|
|
128
130
|
|
|
129
131
|
## Acknowledgements
|
|
130
132
|
|
|
131
|
-
The core team of ParaDigMa consists of Erik Post, Kars Veldkamp, Nienke Timmermans, Diogo Coutinho Soriano, Peter Kok, Vedran Kasalica and Luc Evers.
|
|
132
|
-
Advisors to the project are Max Little, Jordan Raykov, Twan van Laarhoven, Hayriye Cagnan, and Bas Bloem.
|
|
133
|
+
The core team of ParaDigMa consists of Erik Post, Kars Veldkamp, Nienke Timmermans, Diogo Coutinho Soriano, Peter Kok, Vedran Kasalica and Luc Evers.
|
|
134
|
+
Advisors to the project are Max Little, Jordan Raykov, Twan van Laarhoven, Hayriye Cagnan, and Bas Bloem.
|
|
133
135
|
The initial release of ParaDigMa was funded by the Michael J Fox Foundation (grant #020425) and the Dutch Research Council (grant #ASDI.2020.060 & grant #2023.010).
|
|
134
136
|
ParaDigMa was created with [`cookiecutter`](https://cookiecutter.readthedocs.io/en/latest/) and the `py-pkgs-cookiecutter` [template](https://github.com/py-pkgs/py-pkgs-cookiecutter).
|
|
135
137
|
|
|
@@ -8,25 +8,25 @@
|
|
|
8
8
|
| **DOI** | [](https://doi.org/10.5281/zenodo.13838392) |
|
|
9
9
|
| **Build Status** | [](https://www.python.org/downloads/) [](https://github.com/biomarkersParkinson/paradigma/actions/workflows/build-and-test.yml) [](https://github.com/biomarkersParkinson/paradigma/actions/workflows/pages/pages-build-deployment) |
|
|
10
10
|
| **License** | [](https://github.com/biomarkersparkinson/paradigma/blob/main/LICENSE) |
|
|
11
|
-
<!-- | **Fairness** | [](https://fair-software.eu) [](https://www.bestpractices.dev/projects/8083) | -->
|
|
11
|
+
<!-- | **Fairness** | [](https://fair-software.eu) [](https://www.bestpractices.dev/projects/8083) | -->
|
|
12
12
|
|
|
13
13
|
## Overview
|
|
14
14
|
The Parkinson's disease Digital Markers (ParaDigMa) toolbox is a Python
|
|
15
15
|
software package designed for processing real-life wrist sensor data
|
|
16
|
-
to extract digital measures of motor and non-motor signs of Parkinson's disease (PD).
|
|
17
|
-
|
|
18
|
-
Specifically, the toolbox is designed to process accelerometer, gyroscope and
|
|
19
|
-
photoplethysmography (PPG) signals, collected during passive monitoring in daily life.
|
|
20
|
-
It contains three data processing pipelines: (1) arm swing during gait, (2) tremor,
|
|
21
|
-
and (3) pulse rate. These pipelines are scientifically validated for their
|
|
22
|
-
use in persons with PD. Furthermore, the toolbox contains general functionalities for
|
|
23
|
-
signal processing and feature extraction, such as filtering, peak detection, and
|
|
16
|
+
to extract digital measures of motor and non-motor signs of Parkinson's disease (PD).
|
|
17
|
+
|
|
18
|
+
Specifically, the toolbox is designed to process accelerometer, gyroscope and
|
|
19
|
+
photoplethysmography (PPG) signals, collected during passive monitoring in daily life.
|
|
20
|
+
It contains three data processing pipelines: (1) arm swing during gait, (2) tremor,
|
|
21
|
+
and (3) pulse rate. These pipelines are scientifically validated for their
|
|
22
|
+
use in persons with PD. Furthermore, the toolbox contains general functionalities for
|
|
23
|
+
signal processing and feature extraction, such as filtering, peak detection, and
|
|
24
24
|
spectral analysis.
|
|
25
25
|
|
|
26
|
-
The toolbox is accompanied by a set of example scripts and notebooks for
|
|
27
|
-
each processing pipeline that demonstrate how to use the toolbox for extracting
|
|
26
|
+
The toolbox is accompanied by a set of example scripts and notebooks for
|
|
27
|
+
each processing pipeline that demonstrate how to use the toolbox for extracting
|
|
28
28
|
digital measures. In addition, the toolbox is designed to be modular, enabling
|
|
29
|
-
researchers to easily extend the toolbox with new algorithms and functionalities.
|
|
29
|
+
researchers to easily extend the toolbox with new algorithms and functionalities.
|
|
30
30
|
|
|
31
31
|
## Features
|
|
32
32
|
The components of ParaDigMa are shown in the diagram below.
|
|
@@ -39,20 +39,20 @@ ParaDigMa can best be understood by categorizing the sequential processes:
|
|
|
39
39
|
|
|
40
40
|
| Process | Description |
|
|
41
41
|
| ---- | ---- |
|
|
42
|
-
| Preprocessing | Preparing raw sensor signals for further processing |
|
|
42
|
+
| Preprocessing | Preparing raw sensor signals for further processing |
|
|
43
43
|
| Feature extraction | Extracting features based on windowed sensor signals |
|
|
44
|
-
| Classification | Detecting segments of interest using validated classifiers (e.g., gait segments) |
|
|
44
|
+
| Classification | Detecting segments of interest using validated classifiers (e.g., gait segments) |
|
|
45
45
|
| Quantification | Extracting specific measures from the detected segments (e.g., arm swing measures) |
|
|
46
46
|
| Aggregation | Aggregating the measures over a specific time period (e.g., week-level aggregates) |
|
|
47
47
|
|
|
48
48
|
<br/>
|
|
49
|
-
ParaDigMa contains the following validated processing pipelines (each using the processes described above):
|
|
49
|
+
ParaDigMa contains the following validated processing pipelines (each using the processes described above):
|
|
50
50
|
|
|
51
|
-
| Pipeline | Input | Output classification | Output quantification | Output week-level aggregation |
|
|
51
|
+
| Pipeline | Input | Output classification | Output quantification | Output week-level aggregation |
|
|
52
52
|
| ---- | ---- | ---- | ---- | ---- |
|
|
53
|
-
| **Arm swing during gait** | Wrist accelerometer and gyroscope data | Gait probability, gait without other arm activities probability | Arm swing range of motion (RoM) | Typical & maximum arm swing RoM |
|
|
54
|
-
| **Tremor** | Wrist gyroscope data | Tremor probability | Tremor power | % tremor time, typical & maximum tremor power |
|
|
55
|
-
| **Pulse rate** | Wrist PPG and accelerometer data | PPG signal quality | Pulse rate | Resting & maximum pulse rate |
|
|
53
|
+
| **Arm swing during gait** | Wrist accelerometer and gyroscope data | Gait probability, gait without other arm activities probability | Arm swing range of motion (RoM) | Typical & maximum arm swing RoM |
|
|
54
|
+
| **Tremor** | Wrist gyroscope data | Tremor probability | Tremor power | % tremor time, typical & maximum tremor power |
|
|
55
|
+
| **Pulse rate** | Wrist PPG and accelerometer data | PPG signal quality | Pulse rate | Resting & maximum pulse rate |
|
|
56
56
|
|
|
57
57
|
## Installation
|
|
58
58
|
|
|
@@ -70,9 +70,9 @@ The API reference contains detailed documentation of all toolbox modules and fun
|
|
|
70
70
|
The user guides provide additional information about specific topics (e.g. the required orientation of the wrist sensor).
|
|
71
71
|
|
|
72
72
|
### Sensor data requirements
|
|
73
|
-
The ParaDigMa toolbox is designed for the analysis of passive monitoring data collected using a wrist sensor in persons with PD.
|
|
73
|
+
The ParaDigMa toolbox is designed for the analysis of passive monitoring data collected using a wrist sensor in persons with PD.
|
|
74
74
|
|
|
75
|
-
Specific requirements include:
|
|
75
|
+
Specific requirements include:
|
|
76
76
|
| Pipeline | Sensor Configuration | Context of Use |
|
|
77
77
|
|------------------------|--------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
|
|
78
78
|
| **All** | - Sensor position: wrist-band on most or least affected side (validated for both, but different sensitivity for measuring disease progression for tremor and arm swing during gait). <br> - Sensor orientation: orientation as described in [Coordinate System](https://biomarkersparkinson.github.io/paradigma/guides/coordinate_system.html). <br> - Timeframe: contiguous, strictly increasing timestamps. | - Population: persons with PD. <br> - Data collection protocol: passive monitoring in daily life. |
|
|
@@ -80,11 +80,11 @@ Specific requirements include:
|
|
|
80
80
|
| **Tremor** | - Gyroscope: minimum sampling rate of 100 Hz, minimum range of ± 1000 degrees/sec. | - Compliance: for weekly measures: at least three compliant days (with ≥10 hours of data between 8 am and 10 pm). |
|
|
81
81
|
| **Pulse rate** | - PPG*: minimum sampling rate of 30 Hz, green LED. <br> - Accelerometer: minimum sampling rate of 100 Hz, minimum range of ± 4 g. | - Population: no rhythm disorders (e.g. atrial fibrillation, atrial flutter). <br> - Compliance: for weekly measures: minimum average of 12 hours of data per day. |
|
|
82
82
|
|
|
83
|
-
\* The processing of PPG signals is currently based on the blood volume pulse (arbitrary units) obtained from the Verily Study Watch
|
|
83
|
+
\* The processing of PPG signals is currently based on the blood volume pulse (arbitrary units) obtained from the Verily Study Watch. [This](https://biomarkersparkinson.github.io/paradigma/tutorials/_static/pulse_rate_analysis.html#step-3-signal-quality-classification) part of the PPG tutorial provides code and documentation on how to use the pipeline with other PPG devices.
|
|
84
84
|
|
|
85
85
|
> [!WARNING]
|
|
86
|
-
> While the toolbox is designed to work on any wrist sensor device which fulfills the requirements,
|
|
87
|
-
we have currently verified its performance on data from the Gait-up Physilog 4 (arm swing during gait & tremor) and the Verily Study Watch (all pipelines). Furthermore, the specifications above are the minimally validated requirements. For example, while ParaDigMa works with accelerometer and gyroscope data sampled at 50 Hz, its effect on subsequent processes has not been empirically validated.
|
|
86
|
+
> While the toolbox is designed to work on any wrist sensor device which fulfills the requirements,
|
|
87
|
+
we have currently verified its performance on data from the Gait-up Physilog 4 (arm swing during gait & tremor) and the Verily Study Watch (all pipelines). Furthermore, the specifications above are the minimally validated requirements. For example, while ParaDigMa works with accelerometer and gyroscope data sampled at 50 Hz, its effect on subsequent processes has not been empirically validated.
|
|
88
88
|
<br/>
|
|
89
89
|
|
|
90
90
|
We have included support for [TSDF](https://biomarkersparkinson.github.io/tsdf/) as format for loading and storing sensor data. TSDF enables efficient data storage with added metadata. However, ParaDigMa does not require a particular method of data storage and retrieval. Please see our tutorial [Data preparation](https://biomarkersparkinson.github.io/paradigma/tutorials/data_preparation.html) for examples of loading TSDF and other data formats into memory, and for preparing raw sensor data as input for the processing pipelines.
|
|
@@ -98,7 +98,7 @@ The pipelines were developed and validated using data from the Parkinson@Home Va
|
|
|
98
98
|
|
|
99
99
|
## Contributing
|
|
100
100
|
|
|
101
|
-
We welcome contributions! Please check out our [contributing guidelines](https://biomarkersparkinson.github.io/paradigma/contributing.html).
|
|
101
|
+
We welcome contributions! Please check out our [contributing guidelines](https://biomarkersparkinson.github.io/paradigma/contributing.html).
|
|
102
102
|
Please note that this project is released with a [Code of Conduct](https://biomarkersparkinson.github.io/paradigma/conduct.html). By contributing to this project, you agree to abide by its terms.
|
|
103
103
|
|
|
104
104
|
## License
|
|
@@ -107,8 +107,8 @@ It is licensed under the terms of the Apache License 2.0 license. See [License](
|
|
|
107
107
|
|
|
108
108
|
## Acknowledgements
|
|
109
109
|
|
|
110
|
-
The core team of ParaDigMa consists of Erik Post, Kars Veldkamp, Nienke Timmermans, Diogo Coutinho Soriano, Peter Kok, Vedran Kasalica and Luc Evers.
|
|
111
|
-
Advisors to the project are Max Little, Jordan Raykov, Twan van Laarhoven, Hayriye Cagnan, and Bas Bloem.
|
|
110
|
+
The core team of ParaDigMa consists of Erik Post, Kars Veldkamp, Nienke Timmermans, Diogo Coutinho Soriano, Peter Kok, Vedran Kasalica and Luc Evers.
|
|
111
|
+
Advisors to the project are Max Little, Jordan Raykov, Twan van Laarhoven, Hayriye Cagnan, and Bas Bloem.
|
|
112
112
|
The initial release of ParaDigMa was funded by the Michael J Fox Foundation (grant #020425) and the Dutch Research Council (grant #ASDI.2020.060 & grant #2023.010).
|
|
113
113
|
ParaDigMa was created with [`cookiecutter`](https://cookiecutter.readthedocs.io/en/latest/) and the `py-pkgs-cookiecutter` [template](https://github.com/py-pkgs/py-pkgs-cookiecutter).
|
|
114
114
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "paradigma"
|
|
3
|
-
version = "1.0.
|
|
3
|
+
version = "1.0.4"
|
|
4
4
|
description = "ParaDigMa - A toolbox for deriving Parkinson's disease Digital Markers from real-life wrist sensor data"
|
|
5
5
|
authors = [ "Erik Post <erik.post@radboudumc.nl>",
|
|
6
6
|
"Kars Veldkamp <kars.veldkamp@radboudumc.nl>",
|
|
@@ -19,8 +19,6 @@ pandas = "^2.1.4"
|
|
|
19
19
|
scikit-learn = ">=1.3.2,<1.6.1"
|
|
20
20
|
tsdf = "^0.5.2"
|
|
21
21
|
pytype = "^2024.4.11"
|
|
22
|
-
# for the record: pytype was installed directly with pip (in the poetry environment),
|
|
23
|
-
# because poetry didn't handle the install for different CPU architectures
|
|
24
22
|
python-dateutil = "^2.9.0.post0"
|
|
25
23
|
nbconvert = "^7.16.6"
|
|
26
24
|
|
|
@@ -44,6 +42,15 @@ nbsphinx = "^0.9.6"
|
|
|
44
42
|
pytype = "^2024.10.11"
|
|
45
43
|
notebook = "^7.4.5"
|
|
46
44
|
ipykernel = "^6.30.1"
|
|
45
|
+
pre-commit = "^4.3.0"
|
|
46
|
+
jupyter-client = "^8.6.3"
|
|
47
|
+
nbstripout = "^0.8.1"
|
|
48
|
+
nb-clean = "^4.0.1"
|
|
49
|
+
jupyter = "^1.1.1"
|
|
50
|
+
|
|
51
|
+
[tool.poetry.scripts]
|
|
52
|
+
build-docs = "scripts.build_docs:main"
|
|
53
|
+
serve-docs = "scripts.serve_docs:main"
|
|
47
54
|
|
|
48
55
|
[build-system]
|
|
49
56
|
requires = ["poetry-core>=1.0.0"]
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import numpy as np
|
|
2
1
|
import pickle
|
|
3
|
-
|
|
4
2
|
from pathlib import Path
|
|
5
|
-
from sklearn.base import BaseEstimator
|
|
6
3
|
from typing import Any, Optional
|
|
7
4
|
|
|
5
|
+
import numpy as np
|
|
6
|
+
from sklearn.base import BaseEstimator
|
|
7
|
+
from sklearn.preprocessing import StandardScaler
|
|
8
|
+
|
|
9
|
+
|
|
8
10
|
class ClassifierPackage:
|
|
9
|
-
def __init__(
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
def __init__(
|
|
12
|
+
self,
|
|
13
|
+
classifier: Optional[BaseEstimator] = None,
|
|
14
|
+
threshold: Optional[float] = None,
|
|
15
|
+
scaler: Optional[Any] = None,
|
|
16
|
+
):
|
|
12
17
|
"""
|
|
13
18
|
Initialize the ClassifierPackage with a classifier, threshold, and scaler.
|
|
14
19
|
|
|
@@ -43,6 +48,18 @@ class ClassifierPackage:
|
|
|
43
48
|
return X
|
|
44
49
|
return self.scaler.transform(X)
|
|
45
50
|
|
|
51
|
+
def update_scaler(self, x_train: np.ndarray) -> None:
|
|
52
|
+
"""
|
|
53
|
+
Update the scaler used for feature transformation.
|
|
54
|
+
|
|
55
|
+
Parameters
|
|
56
|
+
----------
|
|
57
|
+
x_train : np.ndarray
|
|
58
|
+
The training data to fit the scaler.
|
|
59
|
+
"""
|
|
60
|
+
scaler = StandardScaler()
|
|
61
|
+
self.scaler = scaler.fit(x_train)
|
|
62
|
+
|
|
46
63
|
def predict_proba(self, X) -> float:
|
|
47
64
|
"""
|
|
48
65
|
Make predictions using the classifier and apply the threshold.
|
|
@@ -61,7 +78,7 @@ class ClassifierPackage:
|
|
|
61
78
|
if not self.classifier:
|
|
62
79
|
raise ValueError("Classifier is not loaded.")
|
|
63
80
|
return self.classifier.predict_proba(X)[:, 1]
|
|
64
|
-
|
|
81
|
+
|
|
65
82
|
def predict(self, X) -> int:
|
|
66
83
|
"""
|
|
67
84
|
Make predictions using the classifier and apply the threshold.
|
|
@@ -80,7 +97,7 @@ class ClassifierPackage:
|
|
|
80
97
|
if not self.classifier:
|
|
81
98
|
raise ValueError("Classifier is not loaded.")
|
|
82
99
|
return int(self.predict_proba(X) >= self.threshold)
|
|
83
|
-
|
|
100
|
+
|
|
84
101
|
def save(self, filepath: str | Path) -> None:
|
|
85
102
|
"""
|
|
86
103
|
Save the ClassifierPackage to a file.
|
|
@@ -90,7 +107,7 @@ class ClassifierPackage:
|
|
|
90
107
|
filepath : str
|
|
91
108
|
The path to the file.
|
|
92
109
|
"""
|
|
93
|
-
with open(filepath,
|
|
110
|
+
with open(filepath, "wb") as f:
|
|
94
111
|
pickle.dump(self, f)
|
|
95
112
|
|
|
96
113
|
@classmethod
|
|
@@ -109,7 +126,7 @@ class ClassifierPackage:
|
|
|
109
126
|
The loaded classifier package.
|
|
110
127
|
"""
|
|
111
128
|
try:
|
|
112
|
-
with open(filepath,
|
|
129
|
+
with open(filepath, "rb") as f:
|
|
113
130
|
return pickle.load(f)
|
|
114
131
|
except Exception as e:
|
|
115
|
-
raise ValueError(f"Failed to load classifier package: {e}") from e
|
|
132
|
+
raise ValueError(f"Failed to load classifier package: {e}") from e
|