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

DRAFT PR - Add cardiac and respiratory quality metrics (from the OHBM 2024 hackathon) #44

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

bbfrederick
Copy link

Closes #

This PR adds in the quality metric code that I wrote at the OHBM 2024

Proposed Changes

  • metrics/cardiac.py is now fully fleshed out out from a stub.
  • metrics/chest_belt.py is now fully fleshed out out from a stub.
  • There are two test scripts and some test data at the root level of the package (they don't belong there, but I wasn't sure where they should live). They exercise the preprocessing and quality metric processing for respiratory and cardiac data.
  • metrics/utils.py has several filtering support routines added.

Change Type

  • bugfix (+0.0.1)
  • [x ] minor (+0.1.0)
  • major (+1.0.0)
  • refactoring (no version update)
  • test (no version update)
  • infrastructure (no version update)
  • documentation (no version update)
  • other

Checklist before review

  • I added everything I wanted to add to this PR.
  • [Code or tests only] I wrote/updated the necessary docstrings.
  • [x ] [Code or tests only] I ran and passed tests locally.
  • [Documentation only] I built the docs locally.
  • [x ] My contribution is harmonious with the rest of the code: I'm not introducing repetitions.
  • My code respects the adopted style, especially linting conventions.
  • The title of this PR is explanatory on its own, enough to be understood as part of a changelog.
  • I added or indicated the right labels.
  • I added information regarding the timeline of completion for this PR.
  • Please, comment on my PR while it's a draft and give me feedback on the development!

@github-actions github-actions bot added the Internal Changes affect the internal API. It doesn't increase the version, but produces a changelog label Jan 19, 2025
@smoia
Copy link
Member

smoia commented Jan 20, 2025

@me-pic do you want to have a look at this one?

@me-pic
Copy link
Contributor

me-pic commented Jan 20, 2025

@smoia Can try to have a look at it by the end of the month !

@bbfrederick Thanks a lot for getting the ball rolling on that 🥳

@me-pic me-pic self-requested a review January 20, 2025 21:02
Copy link
Contributor

@me-pic me-pic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much @bbfrederick for opening that PR ! It is a big push for the development of physioqc. Super exciting 🤩

I quickly went through the changes, and left a few comments to discuss. Will take a closer in the next week or two. Happy to help wherever I can !

physioqc/metrics/utils.py Show resolved Hide resolved
return signal.sosfiltfilt(sos, inputdata).real


def readbidstsv(inputfilename, colspec=None, warn=True, debug=False):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really happy to see physioqc supporting BIDS dataset !!! 😸

I'm wondering if there is a reason not to add pybids as a dependency, which might facilitate the loading data from a bids dataset part

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can check that out - I just pulled in a routine I wrote a while back to use in one of my packages to read BIDS files, but I can use a standard routine.

return thefit


def detrend(inputdata, order=1, demean=False):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smoia What do you think about the idea of integrating that function in the peakdet operations module instead ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Detrend? Sure. When I went to fork peakdet, I saw that the description says "Former toolbox for physiological peak detection analyses. Deprecated in favour of prep4phys". So should I be using that instead?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question ! @smoia @m-miedema WDYT ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say let's keep working on peakdet and we'll project the changes to prep4phys. I'm surprised peakdet didn't have detrending options before!

return heartbeatlist


def plotheartbeatqualities(heartbeatlist, totaltime=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if all the plotting functions (or just lines related to plotting in general) should not be integrated in the visualizations script ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Internal Changes affect the internal API. It doesn't increase the version, but produces a changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants