Skip to content

BUG: use trial count for automatic CTPS threshold - #14279

Draft
AtomicGlance wants to merge 1 commit into
mne-tools:mainfrom
AtomicGlance:fix-ctps-trial-threshold
Draft

BUG: use trial count for automatic CTPS threshold#14279
AtomicGlance wants to merge 1 commit into
mne-tools:mainfrom
AtomicGlance:fix-ctps-trial-threshold

Conversation

@AtomicGlance

Copy link
Copy Markdown

What this changes

ICA.find_bads_ecg(threshold="auto") now derives the CTPS threshold from the number of epochs actually supplied to CTPS, rather than from the recording sampling frequency. The threshold calculation is isolated in a small validated helper, and the documentation now describes the correct input.

The regression test covers trial-count dependence, invalid counts, and verifies that the Raw/Epochs path passes the accepted epoch count through to the helper.

Tests run:

  • pytest -p pytest_cov mne/preprocessing/tests/test_ica.py -k "ctps_threshold_uses_trial_count or test_ica_additional" -q
  • pytest -p pytest_cov mne/preprocessing/tests/test_ctps.py -q
  • ruff check mne/preprocessing/ica.py mne/preprocessing/tests/test_ica.py
  • python tools/check_changelog_names.py

I used Codex to help inspect the existing implementation and draft the regression test; I reviewed the resulting diff and ran the tests above. The statistical interpretation and final patch remain my responsibility.

This is a draft while the CTPS normalization details in issue #14267 are reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant