Skip to content

Commit 54db93f

Browse files
authored
Sync main to release (#233)
* Incorporate modal tremor power in aggregate function * Add tolerance for contiguous data to config * Add pre-commit hooks and add Poetry scripts for simplifying dev process * Remove segment categorization (set to legacy) * Adjust pipelines to flexible column names and config updates * Add info on scale sensitivity and make accelerometer optional * Clarify installing pre-commit
1 parent e4222a0 commit 54db93f

87 files changed

Lines changed: 4249 additions & 7030 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,9 @@ PPG_segment0001_values.bin filter=lfs diff=lfs merge=lfs -text
1111
PPG_segment0002_meta.json filter=lfs diff=lfs merge=lfs -text
1212
PPG_segment0002_time.bin filter=lfs diff=lfs merge=lfs -text
1313
PPG_segment0002_values.bin filter=lfs diff=lfs merge=lfs -text
14+
15+
# Normalize line endings
16+
*.py text eol=lf
17+
*.ipynb text eol=lf
18+
*.ipynb filter=nb-clean
19+
*.ipynb filter=nbstripout
Lines changed: 53 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3-
41
name: Build and test
52

63
on:
74
push:
85
branches: [ main ]
96
pull_request:
10-
branches: [ main ]
7+
branches: [ '**' ]
118
workflow_call:
129
outputs:
1310
version:
@@ -16,7 +13,6 @@ on:
1613

1714
jobs:
1815
build-and-test:
19-
2016
runs-on: ubuntu-latest
2117
strategy:
2218
matrix:
@@ -25,61 +21,62 @@ jobs:
2521
version: ${{ steps.get_version.outputs.version }}
2622

2723
steps:
28-
- uses: actions/checkout@v4
29-
with:
30-
fetch-depth: 0
31-
lfs: false # Enable Git LFS support
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Set up Python ${{ matrix.python-version }}
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
33+
# Get the version from pyproject.toml
34+
# This will be used to tag the release in the publishing workflow
35+
- name: Install toml package
36+
run: pip install toml
37+
- name: Get version from pyproject.toml
38+
id: get_version
39+
run: |
40+
VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['tool']['poetry']['version'])")
41+
echo Version: $VERSION
42+
echo "version=$VERSION" >> $GITHUB_OUTPUT
43+
44+
# Install project dependencies
45+
- name: Install dependencies
46+
run: |
47+
python -m pip install poetry
48+
poetry install
3249
33-
- name: Set up Python ${{ matrix.python-version }}
34-
uses: actions/setup-python@v5
35-
with:
36-
python-version: ${{ matrix.python-version }}
50+
# Run pre-commit hooks (formatting, linting, YAML checks, etc.)
51+
- name: Run pre-commit hooks
52+
run: poetry run pre-commit run --all-files --show-diff-on-failure
3753

38-
# Get the version from pyproject.toml
39-
# This will be used to tag the release in the publishing workflow
40-
- name: Install toml package
41-
run: pip install toml
42-
- name: Get version from pyproject.toml
43-
id: get_version
44-
run: |
45-
VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['tool']['poetry']['version'])")
46-
echo Version: $VERSION
47-
echo "version=$VERSION" >> $GITHUB_OUTPUT
54+
# Run tests
55+
- name: Run pytest
56+
run: poetry run pytest --maxfail=1 --disable-warnings -q
4857

49-
# Install project dependencies
50-
- name: Install dependencies
51-
run: |
52-
python -m pip install poetry
53-
poetry install
58+
# Static type checks
59+
- name: Type check with pytype
60+
run: poetry run pytype .
5461

55-
# Install the Paradigma Jupyter kernel for notebooks
56-
- name: Install Paradigma kernel
57-
run: |
58-
poetry run python -m ipykernel install --user --name=paradigma --display-name "paradigma (Poetry)"
62+
# Build the package
63+
- name: Build package
64+
run: poetry build
5965

60-
# Testing and checking
61-
- name: Test with pytest
62-
run: poetry run pytest
63-
- name: Type check
64-
run: poetry run pytype .
66+
- name: Archive build artifacts
67+
uses: actions/upload-artifact@v4
68+
if: github.ref == 'refs/heads/release'
69+
with:
70+
name: build-artifacts
71+
path: dist/
6572

66-
# Build the package
67-
- name: Build the package
68-
run: poetry build
69-
- name: Archive build artifacts
70-
uses: actions/upload-artifact@v4
71-
if: github.ref == 'refs/heads/release'
72-
with:
73-
name: build-artifacts
74-
path: dist/
73+
# Build and archive documentation
74+
- name: Build documentation
75+
run: poetry run make html --directory docs
7576

76-
# Build the docs
77-
- name: Build the docs
78-
run: poetry run make html --directory docs
79-
80-
- name: Archive documentation
81-
uses: actions/upload-artifact@v4
82-
if: github.ref == 'refs/heads/release'
83-
with:
84-
name: docs-html
85-
path: docs/build/html/
77+
- name: Archive documentation
78+
uses: actions/upload-artifact@v4
79+
if: github.ref == 'refs/heads/release'
80+
with:
81+
name: docs-html
82+
path: docs/build/html/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ ipython_config.py
9393
# =========================
9494
.python-version # pyenv
9595
__pypackages__/ # PEP 582
96+
.ruff*
9697

9798
# =========================
9899
# Web frameworks

.pre-commit-config.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
repos:
2+
- repo: https://github.com/kynan/nbstripout
3+
rev: 0.8.1
4+
hooks:
5+
- id: nbstripout
6+
7+
- repo: https://github.com/srstevenson/nb-clean
8+
rev: 4.0.1
9+
hooks:
10+
- id: nb-clean
11+
args:
12+
- --remove-empty-cells
13+
- --remove-all-notebook-metadata
14+
15+
- repo: https://github.com/psf/black
16+
rev: 25.9.0
17+
hooks:
18+
- id: black
19+
pass_filenames: true
20+
types: [python]
21+
22+
- repo: https://github.com/PyCQA/isort
23+
rev: 6.1.0
24+
hooks:
25+
- id: isort
26+
args: ["--profile", "black"]
27+
types: [python]
28+
29+
- repo: https://github.com/astral-sh/ruff-pre-commit
30+
rev: v0.14.0
31+
hooks:
32+
- id: ruff
33+
args: ["--fix"]
34+
35+
- repo: https://github.com/pre-commit/pre-commit-hooks
36+
rev: v6.0.0
37+
hooks:
38+
- id: check-yaml
39+
- id: end-of-file-fixer
40+
- id: trailing-whitespace
41+
- id: check-added-large-files
42+
args: ["--maxkb=5000"]

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
- Improved handling of constants in configuration files.
2929
- Refactored gait configuration files and enhanced constraints.
3030
- Bumped Python version to 3.10 for compatibility.
31-
- Tested `Enum` usage for constraints, but reverted to `str` due to the lack of flexibility.
31+
- Tested `Enum` usage for constraints, but reverted to `str` due to the lack of flexibility.
3232
- Fixed typing issues
3333
- Added project badges and citation file.
3434
- Updated project naming and authors in citation file.
@@ -45,4 +45,3 @@
4545
## v0.1.0 (15/08/2024)
4646
- First pre-release of `paradigma`!
4747
- Initial implementation of gait and PPG feature extraction.
48-

CITATION.cff

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,21 @@ authors:
9191
repository-code: 'https://github.com/biomarkersParkinson/paradigma'
9292
url: 'https://biomarkersparkinson.github.io/paradigma/'
9393
abstract: >-
94-
The Parkinson's disease Digital Markers (ParaDigMa) toolbox is a Python software
95-
package designed for processing and analyzing real-life wrist sensor data to
96-
extract digital measures of motor and non-motor signs of Parkinson's disease (PD).
94+
The Parkinson's disease Digital Markers (ParaDigMa) toolbox is a Python software
95+
package designed for processing and analyzing real-life wrist sensor data to
96+
extract digital measures of motor and non-motor signs of Parkinson's disease (PD).
9797
98-
Specifically, the toolbox is designed to process accelerometer, gyroscope and
99-
photoplethysmography signals, collected during passive monitoring in daily life.
100-
It contains three data processing pipelines: (1) arm swing during gait, (2) tremor,
101-
and (3) pulse rate analysis. These pipelines are scientifically validated for their
102-
use in persons with PD. Furthermore, the toolbox contains general functionalities
103-
for signal processing and feature extraction, such as filtering, peak detection, and
104-
spectral analysis.
98+
Specifically, the toolbox is designed to process accelerometer, gyroscope and
99+
photoplethysmography signals, collected during passive monitoring in daily life.
100+
It contains three data processing pipelines: (1) arm swing during gait, (2) tremor,
101+
and (3) pulse rate analysis. These pipelines are scientifically validated for their
102+
use in persons with PD. Furthermore, the toolbox contains general functionalities
103+
for signal processing and feature extraction, such as filtering, peak detection, and
104+
spectral analysis.
105105
106-
The toolbox is accompanied by a set of example scripts and notebooks for each
107-
processing pipeline that demonstrate how to use the toolbox for extracting digital
108-
measures. In addition, the toolbox is designed to be modular, enabling researchers
106+
The toolbox is accompanied by a set of example scripts and notebooks for each
107+
processing pipeline that demonstrate how to use the toolbox for extracting digital
108+
measures. In addition, the toolbox is designed to be modular, enabling researchers
109109
to easily extend the toolbox with new algorithms and functionalities.
110110
111111
keywords:

CONTRIBUTING.md

Lines changed: 70 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,49 @@ helps, and credit will always be given.
99

1010
If you are reporting a bug, please include:
1111

12-
* Your operating system name and version.
13-
* Any details about your local setup that might be helpful in troubleshooting.
14-
* Detailed steps to reproduce the bug.
12+
* Your operating system name and version
13+
* Python version
14+
* Any details about your local setup that might be helpful in troubleshooting
15+
* Detailed steps to reproduce the bug
1516

1617
### Fix Bugs
1718

18-
Look through the GitHub issues for bugs. Anything tagged with "bug" and "help
19-
wanted" is open to whoever wants to implement it.
19+
Look through the [GitHub issues](https://github.com/biomarkersParkinson/paradigma/issues) for bugs.
20+
Anything tagged with `bug` or `help wanted` is open to whoever wants to implement it.
2021

2122
### Implement Features
2223

23-
Look through the GitHub issues for features. Anything tagged with "enhancement"
24-
and "help wanted" is open to whoever wants to implement it.
24+
Look through the [GitHub issues](https://github.com/biomarkersParkinson/paradigma/issues) for features.
25+
Anything tagged with `enhancement` or `help wanted` is open to whoever wants to implement it.
2526

2627
### Write Documentation
2728

28-
You can never have enough documentation! Please feel free to contribute to any
29-
part of the documentation, such as the official docs, docstrings, or even
30-
on the web in blog posts, articles, and such.
29+
Documentation contributions are always welcome! You can contribute to:
30+
* Official docs: Located in `docs/`
31+
* Tutorial notebooks: `docs/tutorials/`
32+
* Docstrings: In Python modules
33+
* Articles or blog posts
34+
35+
#### Workflow for notebooks and docs:
36+
1. Run and export notebooks:
37+
38+
```bash
39+
poetry run build-docs
40+
```
41+
42+
This will:
43+
* Execute all notebooks in `docs/tutorials/`
44+
* Export them to Markdown in `docs/tutorials/_static/`
45+
* Strip outputs
46+
* Build the HTML documentation
47+
48+
2. Serve documentation locally:
49+
50+
```bash
51+
poetry run serve-docs
52+
```
53+
54+
This will serve the built HTML at `http://localhost:8000`.
3155

3256
### Submit Feedback
3357

@@ -36,28 +60,49 @@ If you are proposing a feature:
3660
* Explain in detail how it would work.
3761
* Keep the scope as narrow as possible, to make it easier to implement.
3862
* Remember that this is a volunteer-driven project, and that contributions
39-
are welcome :)
63+
are welcome!
4064

4165
## Get Started!
4266

43-
Ready to contribute? Here's how to set up `paradigma` for local development.
67+
Ready to contribute? Here's how to set up `paradigma` locally:
68+
1. Clone the repository:
69+
70+
```bash
71+
git clone https://github.com/biomarkersParkinson/paradigma.git
72+
cd paradigma
73+
```
74+
75+
2. Install dependencies via Poetry:
76+
77+
```bash
78+
poetry install
79+
```
80+
81+
3. Create a new branch for your work:
82+
83+
```bash
84+
git checkout -b name-of-your-bugfix-or-feature
85+
```
4486

45-
1. Download a copy of `paradigma` locally.
46-
2. Install `paradigma` using `poetry`:
87+
4. Make your changes and run the pre-commit hooks:
4788

48-
```console
49-
$ poetry install
50-
```
89+
```bash
90+
pip install pre-commit
91+
pre-commit install
92+
pre-commit run --all-files
93+
```
5194

52-
3. Use `git` (or similar) to create a branch for local development and make your changes:
95+
This ensures code formatting (`black`), import sorting (`isort`), stripping notebook outputs, and other checks.
96+
These pre-commit hooks also run for changed and staged files when committing.
5397

54-
```console
55-
$ git checkout -b name-of-your-bugfix-or-feature
56-
```
98+
5. If contributing to docs, build and serve them locally to verify:
5799

58-
4. When you're done making changes, check that your changes conform to any code formatting requirements and pass any tests.
100+
```bash
101+
poetry run build-docs
102+
poetry run serve-docs
103+
```
59104

60-
5. Commit your changes and open a pull request.
105+
6. Commit your changes and open a pull request.
61106

62107
## Pull Request Guidelines
63108

@@ -70,4 +115,5 @@ Before you submit a pull request, check that it meets these guidelines:
70115
## Code of Conduct
71116

72117
Please note that the `paradigma` project is released with a
73-
Code of Conduct. By contributing to this project you agree to abide by its terms.
118+
[Code of Conduct](https://biomarkersparkinson.github.io/paradigma/conduct.html).
119+
By contributing to this project you agree to abide by its terms.

LICENSE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,3 @@ distributed under the License is distributed on an "AS IS" BASIS,
189189
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190190
See the License for the specific language governing permissions and
191191
limitations under the License.
192-

0 commit comments

Comments
 (0)