Skip to content

DOC: Say when not to use mean_flip in extract_label_time_course - #14621

Merged
larsoner merged 2 commits into
mne-tools:mainfrom
PragnyaKhandelwal:doc-mean-flip
Dec 1, 2026
Merged

larsoner merged 2 commits into
mne-tools:mainfrom
PragnyaKhandelwal:doc-mean-flip

Conversation

@PragnyaKhandelwal

@PragnyaKhandelwal PragnyaKhandelwal commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Reference issue (if any)

Related to #14428. Forum thread: https://mne.discourse.group/t/11491

What does this implement/fix?

The mode notes for extract_label_time_course explain what mean_flip does but not when it is the wrong choice. The sign flip only makes sense for signed estimates (fixed orientation, or pick_ori="normal"). For non-negative magnitudes such as dSPM, sLORETA or eLORETA with free/loose orientation (pick_ori=None), the flipped vertices cancel the rest, so the label's sign can differ between subjects — the problem in the linked thread. This adds a few sentences saying to use mode="mean" for those, and one sentence to the auto entry noting that auto selects mean_flip for these estimates too.

The wording lives in docdict["eltc_mode_notes"]; the three docstrings in source_estimate.py were synced with tools/hooks/check_static_docs.py --fix.

Additional information

Checked with a small synthetic surface label (mixed normals, all-positive data): auto and mean_flip gave ≈0.19, mean gave ≈0.96. This came up in an MNE assistant benchmark (#14428) where none of the assistants tested gave this answer, so it seemed worth stating in the docs for human readers too.

AI disclosure: I used Claude Code (Claude Opus) to draft the docstring wording and the synthetic check; I reviewed it against the source and the forum thread and ran the check myself.

@larsoner larsoner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agree with the rewording here, thanks @PragnyaKhandelwal

@larsoner
larsoner merged commit 0f921d6 into mne-tools:main Dec 1, 2026
24 of 26 checks passed
@PragnyaKhandelwal
PragnyaKhandelwal deleted the doc-mean-flip branch December 2, 2026 07:30
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.

2 participants