paradigma 0.3.2__tar.gz → 0.4.1__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.
Files changed (127) hide show
  1. paradigma-0.4.1/PKG-INFO +138 -0
  2. paradigma-0.4.1/README.md +118 -0
  3. {paradigma-0.3.2 → paradigma-0.4.1}/pyproject.toml +16 -9
  4. paradigma-0.4.1/src/paradigma/assets/gait_detection_clf_package.pkl +0 -0
  5. paradigma-0.4.1/src/paradigma/assets/gait_filtering_clf_package.pkl +0 -0
  6. paradigma-0.4.1/src/paradigma/assets/ppg_quality_clf_package.pkl +0 -0
  7. paradigma-0.4.1/src/paradigma/assets/tremor_detection_clf_package.pkl +0 -0
  8. paradigma-0.4.1/src/paradigma/classification.py +115 -0
  9. paradigma-0.4.1/src/paradigma/config.py +314 -0
  10. paradigma-0.4.1/src/paradigma/constants.py +106 -0
  11. paradigma-0.4.1/src/paradigma/feature_extraction.py +967 -0
  12. paradigma-0.4.1/src/paradigma/pipelines/__init__.py +0 -0
  13. paradigma-0.4.1/src/paradigma/pipelines/gait_pipeline.py +727 -0
  14. paradigma-0.4.1/src/paradigma/pipelines/heart_rate_pipeline.py +426 -0
  15. paradigma-0.4.1/src/paradigma/pipelines/heart_rate_utils.py +780 -0
  16. paradigma-0.4.1/src/paradigma/pipelines/tremor_pipeline.py +299 -0
  17. paradigma-0.4.1/src/paradigma/preprocessing.py +363 -0
  18. paradigma-0.4.1/src/paradigma/segmenting.py +396 -0
  19. paradigma-0.4.1/src/paradigma/testing.py +416 -0
  20. paradigma-0.4.1/src/paradigma/util.py +427 -0
  21. paradigma-0.3.2/PKG-INFO +0 -79
  22. paradigma-0.3.2/README.md +0 -59
  23. paradigma-0.3.2/src/paradigma/constants.py +0 -65
  24. paradigma-0.3.2/src/paradigma/feature_extraction.py +0 -703
  25. paradigma-0.3.2/src/paradigma/gait_analysis.py +0 -415
  26. paradigma-0.3.2/src/paradigma/gait_analysis_config.py +0 -266
  27. paradigma-0.3.2/src/paradigma/heart_rate_analysis.py +0 -127
  28. paradigma-0.3.2/src/paradigma/heart_rate_analysis_config.py +0 -9
  29. paradigma-0.3.2/src/paradigma/heart_rate_util.py +0 -173
  30. paradigma-0.3.2/src/paradigma/imu_preprocessing.py +0 -232
  31. paradigma-0.3.2/src/paradigma/ppg/classifier/LR_PPG_quality.pkl +0 -0
  32. paradigma-0.3.2/src/paradigma/ppg/classifier/LR_model.mat +0 -0
  33. paradigma-0.3.2/src/paradigma/ppg/feat_extraction/acc_feature.m +0 -20
  34. paradigma-0.3.2/src/paradigma/ppg/feat_extraction/peakdet.m +0 -64
  35. paradigma-0.3.2/src/paradigma/ppg/feat_extraction/ppg_features.m +0 -53
  36. paradigma-0.3.2/src/paradigma/ppg/glob_functions/extract_hr_segments.m +0 -37
  37. paradigma-0.3.2/src/paradigma/ppg/glob_functions/extract_overlapping_segments.m +0 -23
  38. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/AUTHORS.txt +0 -41
  39. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/ChangeLog.txt +0 -74
  40. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/LICENSE_BSD.txt +0 -25
  41. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/LICENSE_GPLv3.txt +0 -699
  42. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/README.txt +0 -394
  43. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/examples/.svn/entries +0 -368
  44. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/demo_jsonlab_basic.m.svn-base +0 -180
  45. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/demo_ubjson_basic.m.svn-base +0 -180
  46. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example1.json.svn-base +0 -23
  47. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example2.json.svn-base +0 -22
  48. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example3.json.svn-base +0 -11
  49. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example4.json.svn-base +0 -34
  50. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_basictest.matlab.svn-base +0 -662
  51. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_selftest.m.svn-base +0 -27
  52. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_selftest.matlab.svn-base +0 -144
  53. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_speedtest.m.svn-base +0 -21
  54. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/examples/demo_jsonlab_basic.m +0 -180
  55. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/examples/demo_ubjson_basic.m +0 -180
  56. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/examples/example1.json +0 -23
  57. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/examples/example2.json +0 -22
  58. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/examples/example3.json +0 -11
  59. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/examples/example4.json +0 -34
  60. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_basictest.matlab +0 -662
  61. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_selftest.m +0 -27
  62. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_selftest.matlab +0 -144
  63. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_speedtest.m +0 -21
  64. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/jsonopt.m +0 -32
  65. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/loadjson.m +0 -566
  66. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/loadubjson.m +0 -528
  67. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/mergestruct.m +0 -33
  68. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/savejson.m +0 -475
  69. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/saveubjson.m +0 -504
  70. paradigma-0.3.2/src/paradigma/ppg/glob_functions/jsonlab/varargin2struct.m +0 -40
  71. paradigma-0.3.2/src/paradigma/ppg/glob_functions/sample_prob_final.m +0 -49
  72. paradigma-0.3.2/src/paradigma/ppg/glob_functions/synchronization.m +0 -76
  73. paradigma-0.3.2/src/paradigma/ppg/glob_functions/tsdf_scan_meta.m +0 -22
  74. paradigma-0.3.2/src/paradigma/ppg/hr_functions/Long_TFD_JOT.m +0 -37
  75. paradigma-0.3.2/src/paradigma/ppg/hr_functions/PPG_TFD_HR.m +0 -59
  76. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/.gitignore +0 -4
  77. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/CHANGELOG.md +0 -23
  78. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/LICENCE.md +0 -27
  79. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/README.md +0 -251
  80. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/README.pdf +0 -0
  81. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/common/gen_Doppler_kern.m +0 -142
  82. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/common/gen_Doppler_lag_kern.m +0 -314
  83. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/common/gen_lag_kern.m +0 -123
  84. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/dec_tfd.m +0 -154
  85. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_di_gdtfd.m +0 -194
  86. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_li_gdtfd.m +0 -200
  87. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_nonsep_gdtfd.m +0 -229
  88. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_sep_gdtfd.m +0 -241
  89. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/di_gdtfd.m +0 -157
  90. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/li_gdtfd.m +0 -190
  91. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/nonsep_gdtfd.m +0 -196
  92. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/sep_gdtfd.m +0 -199
  93. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/full_tfd.m +0 -144
  94. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/load_curdir.m +0 -13
  95. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/pics/decimated_TFDs_examples.png +0 -0
  96. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/pics/full_TFDs_examples.png +0 -0
  97. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/check_dec_params_seq.m +0 -79
  98. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/dispEE.m +0 -9
  99. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/dispVars.m +0 -26
  100. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/disp_bytes.m +0 -25
  101. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/fold_vector_full.m +0 -40
  102. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/fold_vector_half.m +0 -34
  103. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/gen_LFM.m +0 -29
  104. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/get_analytic_signal.m +0 -76
  105. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/get_window.m +0 -176
  106. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/isreal_fn.m +0 -11
  107. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/padWin.m +0 -97
  108. paradigma-0.3.2/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/vtfd.m +0 -149
  109. paradigma-0.3.2/src/paradigma/ppg/preprocessing/preprocessing_imu.m +0 -15
  110. paradigma-0.3.2/src/paradigma/ppg/preprocessing/preprocessing_ppg.m +0 -13
  111. paradigma-0.3.2/src/paradigma/ppg_preprocessing.py +0 -313
  112. paradigma-0.3.2/src/paradigma/preprocessing_config.py +0 -69
  113. paradigma-0.3.2/src/paradigma/quantification.py +0 -58
  114. paradigma-0.3.2/src/paradigma/tremor/TremorFeaturesAndClassification.m +0 -345
  115. paradigma-0.3.2/src/paradigma/tremor/feat_extraction/DerivativesExtract.m +0 -22
  116. paradigma-0.3.2/src/paradigma/tremor/feat_extraction/ExtractBandSignalsRMS.m +0 -72
  117. paradigma-0.3.2/src/paradigma/tremor/feat_extraction/MFCCExtract.m +0 -100
  118. paradigma-0.3.2/src/paradigma/tremor/feat_extraction/PSDBandPower.m +0 -52
  119. paradigma-0.3.2/src/paradigma/tremor/feat_extraction/PSDEst.m +0 -63
  120. paradigma-0.3.2/src/paradigma/tremor/feat_extraction/PSDExtrAxis.m +0 -88
  121. paradigma-0.3.2/src/paradigma/tremor/feat_extraction/PSDExtrOpt.m +0 -95
  122. paradigma-0.3.2/src/paradigma/tremor/preprocessing/InterpData.m +0 -32
  123. paradigma-0.3.2/src/paradigma/tremor/weekly_aggregates/WeeklyAggregates.m +0 -295
  124. paradigma-0.3.2/src/paradigma/util.py +0 -50
  125. paradigma-0.3.2/src/paradigma/windowing.py +0 -219
  126. {paradigma-0.3.2 → paradigma-0.4.1}/LICENSE +0 -0
  127. {paradigma-0.3.2 → paradigma-0.4.1}/src/paradigma/__init__.py +0 -0
@@ -0,0 +1,138 @@
1
+ Metadata-Version: 2.3
2
+ Name: paradigma
3
+ Version: 0.4.1
4
+ Summary: Paradigma - a toolbox for Digital Biomarkers for Parkinson's Disease
5
+ License: Apache-2.0
6
+ Author: Erik Post
7
+ Author-email: erik.post@radboudumc.nl
8
+ Requires-Python: >=3.11,<4.0
9
+ Classifier: License :: OSI Approved :: Apache Software License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Requires-Dist: pandas (>=2.1.4,<3.0.0)
15
+ Requires-Dist: python-dateutil (>=2.9.0.post0,<3.0.0)
16
+ Requires-Dist: pytype (>=2024.4.11,<2025.0.0)
17
+ Requires-Dist: scikit-learn (>=1.3.2,<1.6.1)
18
+ Requires-Dist: tsdf (>=0.5.2,<0.6.0)
19
+ Description-Content-Type: text/markdown
20
+
21
+ <p align="center">
22
+ <img src="https://raw.githubusercontent.com/biomarkersParkinson/paradigma/main/docs/source/_static/img/paradigma-logo-banner.png" alt="ParaDigMa logo"/>
23
+ </p>
24
+
25
+ | Badges | |
26
+ |:----:|----|
27
+ | **Packages and Releases** | [![Latest release](https://img.shields.io/github/release/biomarkersparkinson/paradigma.svg)](https://github.com/biomarkersparkinson/paradigma/releases/latest) [![PyPI](https://img.shields.io/pypi/v/paradigma.svg)](https://pypi.python.org/pypi/paradigma/) [![Static Badge](https://img.shields.io/badge/RSD-paradigma-lib)](https://research-software-directory.org/software/paradigma) |
28
+ | **DOI** | [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.13838392.svg)](https://doi.org/10.5281/zenodo.13838392) |
29
+ | **Build Status** | [![](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/) [![Build and test](https://github.com/biomarkersParkinson/paradigma/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/biomarkersParkinson/paradigma/actions/workflows/build-and-test.yml) [![pages-build-deployment](https://github.com/biomarkersParkinson/paradigma/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/biomarkersParkinson/paradigma/actions/workflows/pages/pages-build-deployment) |
30
+ | **License** | [![GitHub license](https://img.shields.io/github/license/biomarkersParkinson/paradigma)](https://github.com/biomarkersparkinson/paradigma/blob/main/LICENSE) |
31
+ <!-- | **Fairness** | [![fair-software.eu](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F-green)](https://fair-software.eu) [![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/8083/badge)](https://www.bestpractices.dev/projects/8083) | -->
32
+
33
+ ## Introduction
34
+ The Parkinsons Disease Digital Markers (ParaDigMa) toolbox is a Python
35
+ software package designed for processing passively collected wrist
36
+ sensor data to extract digital measures of motor and non-motor signs
37
+ of Parkinson's disease (PD).
38
+
39
+ Specifically, the toolbox contains three data processing pipelines:
40
+ (1) arm swing during gait, (2) tremor, and (3) heart rate analysis.
41
+ Furthermore, the toolbox contains general functionalities for signal
42
+ processing and feature extraction, such as filtering, peak detection,
43
+ and spectral analysis. The toolbox is designed to be user-friendly and
44
+ modular, enabling researchers to easily extend the toolbox with new
45
+ algorithms and functionalities. The toolbox is accompanied by a set of
46
+ example scripts and notebooks for each domain that demonstrate how to use
47
+ the toolbox for processing sensor data and extracting digital measures.
48
+
49
+ It contains functionalities for processing the following sensor types:
50
+
51
+ - Inertial Measurement Units (accelerometer, gyroscope)
52
+ - Photoplethysmogram (PPG)
53
+
54
+ ## More about ParaDigMa
55
+ The components of ParaDigMa are visually shown in the diagram below.
56
+
57
+ <p align="center">
58
+ <img src="https://raw.githubusercontent.com/biomarkersParkinson/paradigma/main/docs/source/_static/img/pipeline-architecture.png" alt="Pipeline architeecture"/>
59
+ </p>
60
+
61
+ #### Processes
62
+ ParaDigMa can best be understood by categorizing the sequential processes:
63
+
64
+ | Process | Description |
65
+ | ---- | ---- |
66
+ | Preprocessing | Ensuring that the sensor data is ready for further processing |
67
+ | Feature extraction | Creating features based on windowed views of the timestamps |
68
+ | Classification | Making predictions using developed and validated classifiers |
69
+ | Quantification | Selecting specific features of interest |
70
+ | Aggregation | Aggregating the features at a specified time-level |
71
+
72
+ #### Domain requirements
73
+ ParaDigMa can be used to extract aggregations related to a single or multiple domain(s). Each domain has its specific data requirements. Strict requirements for the domain are marked by X, soft requirements (for some additional functionalities) are marked by O.
74
+
75
+ | | Gait | Tremor | Heart Rate |
76
+ |----------|:-----------:|:-----------:|:-----------:|
77
+ | **Accelerometer** | X | | O |
78
+ | **Gyroscope** | X | X | |
79
+ | **PPG** | | | X |
80
+
81
+
82
+
83
+ ## Installation
84
+
85
+ The package is available in PyPi and requires [Python 3.10](https://www.python.org/downloads/) or higher. It can be installed using:
86
+
87
+ ```bash
88
+ pip install paradigma
89
+ ```
90
+
91
+ ## Usage
92
+
93
+ See our [extended documentation](https://biomarkersparkinson.github.io/paradigma/).
94
+
95
+ ## Development
96
+
97
+ ### Installation
98
+
99
+ The package requires Python 3.11 or higher. Use [Poetry](https://python-poetry.org/docs/#installation) to set up the environment and install the dependencies:
100
+
101
+ ```bash
102
+ poetry install
103
+ ```
104
+
105
+ ### Testing
106
+
107
+ ```bash
108
+ poetry run pytest
109
+ ```
110
+
111
+ ### Type checking
112
+
113
+ ```bash
114
+ poetry run pytype .
115
+ ```
116
+
117
+ ### Building documentation
118
+
119
+ ```bash
120
+ poetry run make html --directory docs/
121
+ ```
122
+
123
+ ## Contributing
124
+
125
+ Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.
126
+
127
+ ## License
128
+
129
+ The core team of ParaDigMa consists of Erik Post, Kars Veldkamp, Nienke Timmermans, Diogo Coutinho Soriano, Luc Evers,
130
+ Peter Kok and Vedran Kasalica. Advisors to the project are Max Little, Jordan Raykov, Twan van Laarhoven, Hayriye Cagnan, and Bas Bloem. It is licensed under the terms of the Apache License 2.0 license.
131
+
132
+ ## Credits
133
+
134
+ 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
+
136
+ ## Contact
137
+
138
+ For more information or questions about ParaDigMa, please reach out to erik.post@radboudumc.nl.
@@ -0,0 +1,118 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/biomarkersParkinson/paradigma/main/docs/source/_static/img/paradigma-logo-banner.png" alt="ParaDigMa logo"/>
3
+ </p>
4
+
5
+ | Badges | |
6
+ |:----:|----|
7
+ | **Packages and Releases** | [![Latest release](https://img.shields.io/github/release/biomarkersparkinson/paradigma.svg)](https://github.com/biomarkersparkinson/paradigma/releases/latest) [![PyPI](https://img.shields.io/pypi/v/paradigma.svg)](https://pypi.python.org/pypi/paradigma/) [![Static Badge](https://img.shields.io/badge/RSD-paradigma-lib)](https://research-software-directory.org/software/paradigma) |
8
+ | **DOI** | [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.13838392.svg)](https://doi.org/10.5281/zenodo.13838392) |
9
+ | **Build Status** | [![](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/) [![Build and test](https://github.com/biomarkersParkinson/paradigma/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/biomarkersParkinson/paradigma/actions/workflows/build-and-test.yml) [![pages-build-deployment](https://github.com/biomarkersParkinson/paradigma/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/biomarkersParkinson/paradigma/actions/workflows/pages/pages-build-deployment) |
10
+ | **License** | [![GitHub license](https://img.shields.io/github/license/biomarkersParkinson/paradigma)](https://github.com/biomarkersparkinson/paradigma/blob/main/LICENSE) |
11
+ <!-- | **Fairness** | [![fair-software.eu](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F-green)](https://fair-software.eu) [![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/8083/badge)](https://www.bestpractices.dev/projects/8083) | -->
12
+
13
+ ## Introduction
14
+ The Parkinsons Disease Digital Markers (ParaDigMa) toolbox is a Python
15
+ software package designed for processing passively collected wrist
16
+ sensor data to extract digital measures of motor and non-motor signs
17
+ of Parkinson's disease (PD).
18
+
19
+ Specifically, the toolbox contains three data processing pipelines:
20
+ (1) arm swing during gait, (2) tremor, and (3) heart rate analysis.
21
+ Furthermore, the toolbox contains general functionalities for signal
22
+ processing and feature extraction, such as filtering, peak detection,
23
+ and spectral analysis. The toolbox is designed to be user-friendly and
24
+ modular, enabling researchers to easily extend the toolbox with new
25
+ algorithms and functionalities. The toolbox is accompanied by a set of
26
+ example scripts and notebooks for each domain that demonstrate how to use
27
+ the toolbox for processing sensor data and extracting digital measures.
28
+
29
+ It contains functionalities for processing the following sensor types:
30
+
31
+ - Inertial Measurement Units (accelerometer, gyroscope)
32
+ - Photoplethysmogram (PPG)
33
+
34
+ ## More about ParaDigMa
35
+ The components of ParaDigMa are visually shown in the diagram below.
36
+
37
+ <p align="center">
38
+ <img src="https://raw.githubusercontent.com/biomarkersParkinson/paradigma/main/docs/source/_static/img/pipeline-architecture.png" alt="Pipeline architeecture"/>
39
+ </p>
40
+
41
+ #### Processes
42
+ ParaDigMa can best be understood by categorizing the sequential processes:
43
+
44
+ | Process | Description |
45
+ | ---- | ---- |
46
+ | Preprocessing | Ensuring that the sensor data is ready for further processing |
47
+ | Feature extraction | Creating features based on windowed views of the timestamps |
48
+ | Classification | Making predictions using developed and validated classifiers |
49
+ | Quantification | Selecting specific features of interest |
50
+ | Aggregation | Aggregating the features at a specified time-level |
51
+
52
+ #### Domain requirements
53
+ ParaDigMa can be used to extract aggregations related to a single or multiple domain(s). Each domain has its specific data requirements. Strict requirements for the domain are marked by X, soft requirements (for some additional functionalities) are marked by O.
54
+
55
+ | | Gait | Tremor | Heart Rate |
56
+ |----------|:-----------:|:-----------:|:-----------:|
57
+ | **Accelerometer** | X | | O |
58
+ | **Gyroscope** | X | X | |
59
+ | **PPG** | | | X |
60
+
61
+
62
+
63
+ ## Installation
64
+
65
+ The package is available in PyPi and requires [Python 3.10](https://www.python.org/downloads/) or higher. It can be installed using:
66
+
67
+ ```bash
68
+ pip install paradigma
69
+ ```
70
+
71
+ ## Usage
72
+
73
+ See our [extended documentation](https://biomarkersparkinson.github.io/paradigma/).
74
+
75
+ ## Development
76
+
77
+ ### Installation
78
+
79
+ The package requires Python 3.11 or higher. Use [Poetry](https://python-poetry.org/docs/#installation) to set up the environment and install the dependencies:
80
+
81
+ ```bash
82
+ poetry install
83
+ ```
84
+
85
+ ### Testing
86
+
87
+ ```bash
88
+ poetry run pytest
89
+ ```
90
+
91
+ ### Type checking
92
+
93
+ ```bash
94
+ poetry run pytype .
95
+ ```
96
+
97
+ ### Building documentation
98
+
99
+ ```bash
100
+ poetry run make html --directory docs/
101
+ ```
102
+
103
+ ## Contributing
104
+
105
+ Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.
106
+
107
+ ## License
108
+
109
+ The core team of ParaDigMa consists of Erik Post, Kars Veldkamp, Nienke Timmermans, Diogo Coutinho Soriano, Luc Evers,
110
+ Peter Kok and Vedran Kasalica. Advisors to the project are Max Little, Jordan Raykov, Twan van Laarhoven, Hayriye Cagnan, and Bas Bloem. It is licensed under the terms of the Apache License 2.0 license.
111
+
112
+ ## Credits
113
+
114
+ 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).
115
+
116
+ ## Contact
117
+
118
+ For more information or questions about ParaDigMa, please reach out to erik.post@radboudumc.nl.
@@ -1,25 +1,27 @@
1
1
  [tool.poetry]
2
2
  name = "paradigma"
3
- version = "0.3.2"
3
+ version = "0.4.1"
4
4
  description = "Paradigma - a toolbox for Digital Biomarkers for Parkinson's Disease"
5
- authors = [ "Peter Kok <p.kok@esciencecenter.nl>",
5
+ authors = [ "Erik Post <erik.post@radboudumc.nl>",
6
+ "Kars Veldkamp <kars.veldkamp@radboudumc.nl>",
7
+ "Nienke Timmermans <nienke.timmermans@radboudumc.nl>",
8
+ "Diogo Soriano",
6
9
  "Vedran Kasalica <v.kaslica@esciencecenter.nl>",
7
- "Erik Post",
8
- "Kars Veldkamp",
9
- "Nienke Timmermans",
10
- "Diogo Coutinho Soriano",
11
- "Luc Evers" ]
10
+ "Peter Kok <p.kok@esciencecenter.nl>",
11
+ "Luc Evers <luc.evers@radboudumc.nl>",
12
+ ]
12
13
  license = "Apache License 2.0"
13
14
  readme = "README.md"
14
15
 
15
16
  [tool.poetry.dependencies]
16
- python = "^3.10"
17
+ python = "^3.11"
17
18
  pandas = "^2.1.4"
18
- scikit-learn = "^1.3.2"
19
+ scikit-learn = ">=1.3.2,<1.6.1"
19
20
  tsdf = "^0.5.2"
20
21
  pytype = "^2024.4.11"
21
22
  # for the record: pytype was installed directly with pip (in the poetry environment),
22
23
  # because poetry didn't handle the install for different CPU architectures
24
+ python-dateutil = "^2.9.0.post0"
23
25
 
24
26
  [tool.poetry.group.testing.dependencies]
25
27
  ipykernel = "^6.27.1"
@@ -34,6 +36,11 @@ myst-nb = "^1.1.0"
34
36
  sphinx-autoapi = "^3.0.0"
35
37
  sphinx-rtd-theme = "^2.0.0"
36
38
  sphinx-serve = "^1.0.1"
39
+ myst-parser = "^4.0.0"
40
+ nbsphinx = "^0.9.6"
41
+
42
+ [tool.poetry.group.dev.dependencies]
43
+ pytype = "^2024.10.11"
37
44
 
38
45
  [build-system]
39
46
  requires = ["poetry-core>=1.0.0"]
@@ -0,0 +1,115 @@
1
+ import numpy as np
2
+ import pickle
3
+
4
+ from pathlib import Path
5
+ from sklearn.base import BaseEstimator
6
+ from typing import Any, Optional
7
+
8
+ class ClassifierPackage:
9
+ def __init__(self, classifier: Optional[BaseEstimator] = None,
10
+ threshold: Optional[float] = None,
11
+ scaler: Optional[Any] = None):
12
+ """
13
+ Initialize the ClassifierPackage with a classifier, threshold, and scaler.
14
+
15
+ Parameters
16
+ ----------
17
+ classifier
18
+ The trained classifier.
19
+ threshold : float
20
+ The classification threshold.
21
+ scaler
22
+ The trained scaler (e.g., StandardScaler or MinMaxScaler).
23
+ """
24
+ self.classifier = classifier
25
+ self.threshold = threshold
26
+ self.scaler = scaler
27
+
28
+ def transform_features(self, X) -> np.ndarray:
29
+ """
30
+ Transform the input features using the scaler.
31
+
32
+ Parameters
33
+ ----------
34
+ X : np.ndarray
35
+ The input features.
36
+
37
+ Return
38
+ ------
39
+ np.ndarray
40
+ The transformed features.
41
+ """
42
+ if not self.scaler:
43
+ return X
44
+ return self.scaler.transform(X)
45
+
46
+ def predict_proba(self, X) -> float:
47
+ """
48
+ Make predictions using the classifier and apply the threshold.
49
+
50
+ Parameters
51
+ ----------
52
+ X : np.ndarray
53
+ The input features.
54
+
55
+ Return
56
+ ------
57
+ float
58
+ The predicted probability.
59
+
60
+ """
61
+ if not self.classifier:
62
+ raise ValueError("Classifier is not loaded.")
63
+ return self.classifier.predict_proba(X)[:, 1]
64
+
65
+ def predict(self, X) -> int:
66
+ """
67
+ Make predictions using the classifier and apply the threshold.
68
+
69
+ Parameters
70
+ ----------
71
+ X : np.ndarray
72
+ The input features.
73
+
74
+ Return
75
+ ------
76
+ int
77
+ The predicted class.
78
+
79
+ """
80
+ if not self.classifier:
81
+ raise ValueError("Classifier is not loaded.")
82
+ return int(self.predict_proba(X) >= self.threshold)
83
+
84
+ def save(self, filepath: str | Path) -> None:
85
+ """
86
+ Save the ClassifierPackage to a file.
87
+
88
+ Parameters
89
+ ----------
90
+ filepath : str
91
+ The path to the file.
92
+ """
93
+ with open(filepath, 'wb') as f:
94
+ pickle.dump(self, f)
95
+
96
+ @classmethod
97
+ def load(cls, filepath: str | Path):
98
+ """
99
+ Load a ClassifierPackage from a file.
100
+
101
+ Parameters
102
+ ----------
103
+ filepath : str
104
+ The path to the file.
105
+
106
+ Return
107
+ ------
108
+ ClassifierPackage
109
+ The loaded classifier package.
110
+ """
111
+ try:
112
+ with open(filepath, 'rb') as f:
113
+ return pickle.load(f)
114
+ except Exception as e:
115
+ raise ValueError(f"Failed to load classifier package: {e}") from e