Skip to content

Implementation of the meanlogratio for TFR - #14205

Merged
larsoner merged 15 commits into
mne-tools:mainfrom
virvw:meanlogratio
Aug 25, 2026
Merged

Implementation of the meanlogratio for TFR#14205
larsoner merged 15 commits into
mne-tools:mainfrom
virvw:meanlogratio

Conversation

@virvw

@virvw virvw commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

A recent paper advocated an alternative baselining in time-frequency analysis.

Kinley, I., Roberts, R. P., Meltzer, J. A., & Addis, D. R. (2026). Spectral change or Jensen gap? Log-ratio baseline correction for time-frequency M/EEG is negatively biased. Journal of Neuroscience Methods, 110826.

Now, whenever baselining a TFR is needed, an additional option for the mode or baseline_mode is "meanlogratio" effectively computing

baseline = (baseline_tmin, baseline_tmax)
tfr = tfr.apply_baseline(baseline, mode="logratio")
tfr = tfr.apply_baseline(baseline, mode="mean")

This was verified and replicated against the original paper on simulated and MNE sample data.

main-fig

KinleyEtAl2026_main-analysis_mne-ized_v1.py

  • Implement the computations
  • Updated the docstring
  • Modify the tutorial to reflect this new option
  • Add unit test for all baseline options
  • Add a line to what's new page

@welcome

welcome Bot commented Aug 24, 2026

Copy link
Copy Markdown

Hello! 👋 Thanks for opening your first pull request here! ❤️ We will try to get back to you soon. 🚴

@virvw
virvw marked this pull request as draft August 24, 2026 14:13
Comment thread mne/time_frequency/tfr.py Outdated
Comment thread mne/time_frequency/tfr.py Outdated

@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.

Looks good other than pedantic stuff that the docstring renderers will be unhappy about. Will commit and hopefully they come back green! Thanks in advance @virvw !

Also needs a changelog update but I'll push that quickly

Comment thread mne/utils/docs.py Outdated
Comment thread mne/utils/docs.py Outdated
Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
Introduced a new baselining mode for EpochsTFR.
@larsoner

Copy link
Copy Markdown
Member

... ahh I should have read more closely, this is draft and you're still adding stuff. Sorry about that! Feel free to git pull my changes or just force-push over them as needed

@larsoner

Copy link
Copy Markdown
Member

Okay for some reason it won't let me push to your branch despite you having ticked the "allow maintainers to make edits" box, and it's difficult to iterate in the GitHub file editor. Let me know if you want me to open a quick PR to fix the autofix.ci and pytest mne/tests/test_docstring_parameters.py failures. Otherwise feel free to look and fix!

@virvw

virvw commented Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

Just added text in "20_sensors_time_frequency"
explaining baseline correction for TFR, a paragraph for each baseline mode and a couple indicative references

@larsoner
larsoner marked this pull request as ready for review August 25, 2026 16:09

@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.

Marking for merge-when-green, thanks in advance @virvw !

@larsoner
larsoner enabled auto-merge (squash) August 25, 2026 16:10
@larsoner
larsoner merged commit ecdc498 into mne-tools:main Aug 25, 2026
39 of 40 checks passed
@welcome

welcome Bot commented Aug 25, 2026

Copy link
Copy Markdown

🎉 Congrats on merging your first pull request! 🥳 Looking forward to seeing more from you in the future! 💪

@wmvanvliet

Copy link
Copy Markdown
Contributor

Thanks, @virvw!

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants