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

[Feature] Add signal_flatintervals function for flatline detection #940

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from

Conversation

jchromik
Copy link
Contributor

Description

This PR aims at adding the function signal_flatintervals. The function can identify flatline intervals in signals and if modelled after signal_flatline. We discussed this feature in #823. It is one step towards making NeuroKit able to process long-term ECGs with bad or unprocessable intervals.

Possible Next Step

A possible next step could be to a bad_intervals keyword argument to the peak detection functions to that the peak detector does not need to process the whole signal but only the good (non-flatline parts).

Limitations / Concerns

  • The function signal_flatintervals needs two "magic" parameters threshold and tolerance. threshold is the same as in signal_flatline with a default values of 0.01 (1% percent of the largest spike in the signal). tolerance says how long the flatline interval needs to be to be recognised as such default is 60 seconds.
  • The test uses ecg_simulate and is therefore quite slow (approx. 10s). I am open to suggestions on how to speed this up.

Checklist

  • I have read the CONTRIBUTING file.
  • My PR is targeted at the dev branch (and not towards the master branch).
  • I ran the CODE CHECKS on the files I added or modified and fixed the errors. --> I did not correct complains in code that I did not touch
  • I have added the newly added features to News.rst (if applicable) --> not applicable

@codecov-commenter
Copy link

codecov-commenter commented Dec 18, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (87c8c60) 54.82% compared to head (59d0c83) 54.88%.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #940      +/-   ##
==========================================
+ Coverage   54.82%   54.88%   +0.05%     
==========================================
  Files         304      305       +1     
  Lines       14269    14287      +18     
==========================================
+ Hits         7823     7841      +18     
  Misses       6446     6446              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jchromik
Copy link
Contributor Author

@DominiqueMakowski
I renamed the parameter tolerance to duration_min. All checks pass now. Code cov is complete for all my changes.
(I'm still open for feedback and critique, though ;-) )

Copy link

stale bot commented Mar 17, 2024

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the wontfix This will not be worked on label Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants