Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate physutils - Physio object usage #54

Merged
merged 40 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
2536086
Add physutils dependency placeholder
maestroque Jun 12, 2024
f047587
Initial Physio object integration in cardiac.py
maestroque Jun 12, 2024
c7fc2eb
Style fixes
maestroque Jun 12, 2024
ec8a3de
Minor cardiac.py physio initialization fix
maestroque Jun 12, 2024
67c4d21
Integrate Physio object for respiratory and multimodal metrics
maestroque Jun 12, 2024
2ffa465
Add sample support for object and function oriented usage of metric f…
maestroque Jun 12, 2024
9fa3467
Make metric functions operations
maestroque Jun 24, 2024
380ab65
Add Physio and non-Physio compatibility to cardiac.py
maestroque Jun 24, 2024
59ee6c8
Add Physio and non-Physio compatibility to chest_belt.py
maestroque Jun 24, 2024
56abb72
Add Physio and non-Physio compatibility to retroicor
maestroque Jun 24, 2024
2c19a65
Fix CRF, iCRF and RRF calculation
maestroque Jun 24, 2024
c28914c
Fix cardiac_phase test, return Physio object and metric to update his…
maestroque Jun 24, 2024
625d45f
Fix chest_belt tests, return Physio object and metric to update histo…
maestroque Jun 24, 2024
acf960d
Update RVT test
maestroque Jun 24, 2024
62e4b6f
Fix respiratory_phase_smoke test
maestroque Jun 24, 2024
e60d49e
Return physio in retroicor and specify raised error type in test_mirr…
maestroque Jun 24, 2024
3dbf656
Add loguru as a dependency
maestroque Jun 24, 2024
f7d7811
Add Physio object use cardiac phase unit test
maestroque Jun 25, 2024
907faba
Remove test log
maestroque Jun 25, 2024
2d9fd75
Add physutils dependency and peakdet version
maestroque Jul 18, 2024
366175a
Update peakdet dependency
maestroque Jul 19, 2024
533c80e
Minor fix
maestroque Jul 22, 2024
3fba78c
circleci: python version upgrade
maestroque Jul 22, 2024
43576d0
circleci: python version migration to 3.8 and 3.12
maestroque Jul 22, 2024
e2f2241
Minor CI fix
maestroque Jul 22, 2024
9efbf5f
CI: Change minimum python version to 3.9
maestroque Jul 22, 2024
ba5dcbc
CI: Test for python 3.9 and 3.11
maestroque Jul 22, 2024
9f5e162
Store computed metrics inside the Physio object
maestroque Jul 22, 2024
696d29c
Merge branch 'physiopy:master' into integrate-physutils
maestroque Jul 23, 2024
daaed9c
Update .all-contributorsrc
maestroque Jul 23, 2024
00b0f56
Merge branch 'physiopy:master' into integrate-physutils
maestroque Aug 9, 2024
bc300f0
Add wrapper to determine whether to return a metric or a physio object
maestroque Aug 10, 2024
9883ce2
[deps] Cap numpy to <2.0
maestroque Aug 10, 2024
181304f
[docs]: Update computing metrics
maestroque Aug 10, 2024
43107db
Metric or Physio returning optimization
maestroque Aug 11, 2024
b0f4110
Add Metric class for easier properties accessing
maestroque Aug 11, 2024
10509bd
More unit tests, physio/metric wrapper optimization, doc fixes
maestroque Aug 21, 2024
612c616
Minor fix
maestroque Aug 21, 2024
e528d21
[test] Fix failing warning assertion
maestroque Aug 25, 2024
6266b6f
Add updated physutils version
maestroque Aug 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,20 @@
"review",
"userTesting"
]
},
{
"login": "maestroque",
"name": "George Kikas",
"avatar_url": "https://avatars.githubusercontent.com/u/74024609?v=4",
"profile": "https://github.com/maestroque",
"contributions": [
"code",
"ideas",
maestroque marked this conversation as resolved.
Show resolved Hide resolved
"infra",
"docs",
"bug",
"review"
]
}
],
"contributorsPerLine": 8,
Expand Down
28 changes: 14 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ orbs:
# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:
test37: # This is the name of the job, feel free to change it to better match what you're trying to do!
test39: # This is the name of the job, feel free to change it to better match what you're trying to do!
# These next lines defines a Docker executors: https://circleci.com/docs/2.0/executor-types/
# You can specify an image from Dockerhub or use one of the convenience images from CircleCI's Developer Hub
# A list of available CircleCI Docker convenience images are available here: https://circleci.com/developer/images/image/cimg/python
# The executor is the environment in which the steps below will be executed - below will use a python 3.6.14 container
# Change the version below to your required version of python
docker:
- image: cimg/python:3.7
- image: cimg/python:3.9
working_directory: /tmp/src/phys2denoise
resource_class: medium
# Checkout the code as the first step. This is a dedicated CircleCI step.
Expand All @@ -46,7 +46,7 @@ jobs:
command: |
pytest --cov=./phys2denoise
mkdir /tmp/src/coverage
mv ./.coverage /tmp/src/coverage/.coverage.py37
mv ./.coverage /tmp/src/coverage/.coverage.py39
- store_artifacts:
path: /tmp/src/coverage
# Persist the specified paths (workspace/echo-output) into the workspace for use in downstream job.
Expand All @@ -56,11 +56,11 @@ jobs:
root: /tmp
# Must be relative path from root
paths:
- src/coverage/.coverage.py37
- src/coverage/.coverage.py39

test310:
test311:
docker:
- image: cimg/python:3.10
- image: cimg/python:3.11
working_directory: /tmp/src/phys2denoise
resource_class: medium
steps:
Expand All @@ -75,17 +75,17 @@ jobs:
command: |
pytest --cov=./phys2denoise
mkdir /tmp/src/coverage
mv ./.coverage /tmp/src/coverage/.coverage.py310
mv ./.coverage /tmp/src/coverage/.coverage.py311
- store_artifacts:
path: /tmp/src/coverage
- persist_to_workspace:
root: /tmp
paths:
- src/coverage/.coverage.py310
- src/coverage/.coverage.py311

style_check:
docker:
- image: cimg/python:3.7
- image: cimg/python:3.9
working_directory: /tmp/src/phys2denoise
resource_class: small
steps:
Expand All @@ -105,7 +105,7 @@ jobs:
merge_coverage:
working_directory: /tmp/src/phys2denoise
docker:
- image: cimg/python:3.10
- image: cimg/python:3.11
resource_class: small
steps:
- attach_workspace:
Expand Down Expand Up @@ -133,13 +133,13 @@ workflows:
# Inside the workflow, you define the jobs you want to run.
jobs:
- style_check
- test37:
- test39:
requires:
- style_check
- test310:
- test311:
requires:
- style_check
- merge_coverage:
requires:
- test37
- test310
- test39
- test311
8 changes: 6 additions & 2 deletions docs/user_guide/metrics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ example shows how to compute the heart rate and the heart rate variability using

from phys2denoise.metrics.chest_belt import respiratory_variance_time

# Given that the respiratory signal is stored in `data`, the peaks in `peaks`, the troughs in `troughs`
# Given that the respiratory signal is stored in `data` (which is not a physio.Physio instance), the peaks in `peaks`, the troughs in `troughs`
# and the sample rate in `sample_rate`
_, rvt = respiratory_variance_time(data, peaks, troughs, sample_rate)
rvt = respiratory_variance_time(data, peaks, troughs, sample_rate)

The computed respiratory variance time is stored in the variable ``rvt``. An internal check is performed to verify if the input data is a Physio object or not
determining the appropriate output format. If the input is not a ``Physio`` object, the output will be a numpy array only containing the computed metric. Otherwise,
the output will be a tuple with the updated Physio object and the computed metric.
Loading