Repository navigation
BUG: use fixed normalized CTPS cutoff for automatic ECG detection - #14279
Conversation
larsoner
left a comment
There was a problem hiding this comment.
Can you check the units of _prob_kuiper vs the threshold? I think _prob_kuiper tends toward V**2 and thresold V.
I think it might be worth trying to make the threshold based on effect size, which I think might have been what we were trying to do before the logic changes in #7819
Are you up for looking into these? If not I could try and push
This part I think is still not done, this uses significance still right? Significance is going to be driven by trial count I think, so for example having 20 trials you might get no components but at 1000 trials you might get a dozen, etc. Does that make sense? |
|
See for example the plain threshold on |
|
Thanks, that makes sense. The update in a482858 uses a fixed 0.3 cutoff on the maximum normalized CTPS score, as in the JuMEG example you linked. The significance-based threshold calculation is removed. Tests compare |
AtomicGlance
left a comment
There was a problem hiding this comment.
I think I took care of things
|
The Windows prerelease failure appears separate from the CTPS change. In Azure build 39927, all four The affected readers and The focused ICA/CTPS tests also pass locally (6 passed, optional Picard case skipped), with all three added CTPS implementation lines covered. Both Codecov checks are passing; the targets in Could a maintainer take a look at the XML import failure and approve the pending GitHub workflows? No additional code changes have been added to this PR for it. |
larsoner
left a comment
There was a problem hiding this comment.
Pushed a commit to fix the defusedxml issue and touch the ICA example so it runs in CIs. Will mark for merge-when-green once I double check the example output. Thanks in advance @AtomicGlance !
|
🎉 Congrats on merging your first pull request! 🥳 Looking forward to seeing more from you in the future! 💪 |
…rain_signed * upstream/main: (251 commits) Coregistration GUI modernisation (phase 4) (mne-tools#14285) Dipole GUI interactivity and visual enhancements (phase 2) (mne-tools#14291) Width [circle deploy] [skip azp] [skip actions] Post-release deprecations (mne-tools#14290) FIX: Come on [circle deploy] [skip azp] [skip actions] PyVista try again [circle deploy] [skip azp] [skip actions] FIX: PyVista [circle deploy] [skip azp] [skip actions] FIX: Really [circle deploy] [skip azp] [skip actions] FIX: Doc Release commit [circle deploy] MAINT: Update code credit (mne-tools#14289) MAINT: Update pre-commit hook versions (mne-tools#14288) BUG: use fixed normalized CTPS cutoff for automatic ECG detection (mne-tools#14279) Move toward docstacks [circle deploy] [skip azp] [skip actions] Fix tfce (mne-tools#14286) FIX: Improve channel name rendering in `plot_alignment` (mne-tools#13773) Don't shift placeholder proc_history dates in anonymize_info (mne-tools#14248) MRG: Avoid pytest 10 warnings in sklearn estimator checks (mne-tools#14283) MAINT: Update pre-commit hook versions (mne-tools#14282) DOC: Add osl-dynamics to related software list (mne-tools#14268) ...
* upstream/main: (75 commits) Brain GUI modernization (Phase 7) (mne-tools#14270) Fix bug with SciPy 1.18.0 EEGLAB reading (mne-tools#14293) remove plotting abs as the defauls for plotting volumetric (mne-tools#13989) Coregistration GUI modernisation (phase 4) (mne-tools#14285) Dipole GUI interactivity and visual enhancements (phase 2) (mne-tools#14291) Width [circle deploy] [skip azp] [skip actions] Post-release deprecations (mne-tools#14290) FIX: Come on [circle deploy] [skip azp] [skip actions] PyVista try again [circle deploy] [skip azp] [skip actions] FIX: PyVista [circle deploy] [skip azp] [skip actions] FIX: Really [circle deploy] [skip azp] [skip actions] FIX: Doc Release commit [circle deploy] MAINT: Update code credit (mne-tools#14289) MAINT: Update pre-commit hook versions (mne-tools#14288) BUG: use fixed normalized CTPS cutoff for automatic ECG detection (mne-tools#14279) Move toward docstacks [circle deploy] [skip azp] [skip actions] Fix tfce (mne-tools#14286) FIX: Improve channel name rendering in `plot_alignment` (mne-tools#13773) Don't shift placeholder proc_history dates in anonymize_info (mne-tools#14248) ... # Conflicts: # mne/io/edf/tests/test_edf.py
* upstream/main: (22 commits) fix EDF round-trip (mne-tools#14296) Brain GUI modernization (Phase 7) (mne-tools#14270) Fix bug with SciPy 1.18.0 EEGLAB reading (mne-tools#14293) remove plotting abs as the defauls for plotting volumetric (mne-tools#13989) Coregistration GUI modernisation (phase 4) (mne-tools#14285) Dipole GUI interactivity and visual enhancements (phase 2) (mne-tools#14291) Width [circle deploy] [skip azp] [skip actions] Post-release deprecations (mne-tools#14290) FIX: Come on [circle deploy] [skip azp] [skip actions] PyVista try again [circle deploy] [skip azp] [skip actions] FIX: PyVista [circle deploy] [skip azp] [skip actions] FIX: Really [circle deploy] [skip azp] [skip actions] FIX: Doc Release commit [circle deploy] MAINT: Update code credit (mne-tools#14289) MAINT: Update pre-commit hook versions (mne-tools#14288) BUG: use fixed normalized CTPS cutoff for automatic ECG detection (mne-tools#14279) Move toward docstacks [circle deploy] [skip azp] [skip actions] Fix tfce (mne-tools#14286) FIX: Improve channel name rendering in `plot_alignment` (mne-tools#13773) ... # Conflicts: # mne/viz/backends/tests/test_renderer.py
* upstream/main: (25 commits) ENH: add the JupyterLite notebook setup cell (JupyterLite split 4/5) (mne-tools#14150) FIX: Ver [circle deploy] [skip azp] [skip actions] Hotfix fix EDF round-trip (mne-tools#14296) Brain GUI modernization (Phase 7) (mne-tools#14270) Fix bug with SciPy 1.18.0 EEGLAB reading (mne-tools#14293) remove plotting abs as the defauls for plotting volumetric (mne-tools#13989) Coregistration GUI modernisation (phase 4) (mne-tools#14285) Dipole GUI interactivity and visual enhancements (phase 2) (mne-tools#14291) Width [circle deploy] [skip azp] [skip actions] Post-release deprecations (mne-tools#14290) FIX: Come on [circle deploy] [skip azp] [skip actions] PyVista try again [circle deploy] [skip azp] [skip actions] FIX: PyVista [circle deploy] [skip azp] [skip actions] FIX: Really [circle deploy] [skip azp] [skip actions] FIX: Doc Release commit [circle deploy] MAINT: Update code credit (mne-tools#14289) MAINT: Update pre-commit hook versions (mne-tools#14288) BUG: use fixed normalized CTPS cutoff for automatic ECG detection (mne-tools#14279) ...
ICA.find_bads_ecg(method="ctps", threshold="auto")now uses a fixed cutoff of 0.3 on the maximum normalized Kuiper score, following the JuMEG example linked in the review. The cutoff no longer depends on sampling frequency or trial count. The normalized scores themselves can still vary with the input data; this does not introduce an effect-size statistic.Removed the threshold-calculation helpers and updated the docstring and changelog. Regression tests compare automatic detection with an explicit
threshold=0.3across trial counts and sampling rates, with coverage for both Raw and Epochs inputs.Local validation: 6 tests passed; the optional Picard case was skipped because Picard is not installed. Ruff lint, formatting, and changelog-name checks passed.
AI assistance: Codex assisted with implementation and regression tests, including the revision to the fixed cutoff.