BUG: Cleanup cHPI filtering using smooth interpolation - #14112
Merged
Conversation
drammock
approved these changes
Jul 29, 2026
| fitting windows before subtraction. ``"hann"`` (default) smoothly interpolates, | ||
| avoiding small step discontinuities (and associated broadband spectral | ||
| leakage) produced by ``None``, which holds each window's amplitudes constant | ||
| over its central ``t_step``. ``"linear"`` interpolation is also supported. |
Member
There was a problem hiding this comment.
docstring doesn't mention cos2 interpolation, but it looks like the code supports that. Was that omission intentional?
Member
Author
There was a problem hiding this comment.
Yeah it's just an alias
larsoner
added a commit
to larsoner/mne-python
that referenced
this pull request
Aug 4, 2026
* upstream/main: (35 commits) Fix bug with coreg scaling (mne-tools#14132) MAINT: Update code credit (mne-tools#14131) Fix bugs with dark mode panels (mne-tools#14109) Improve code credit workflow (mne-tools#14120) Align _AbstractRenderer.tube with the PyVista implementation (mne-tools#14125) Assign instead of compare when marking explicit zeros in spatio_temporal_dist_adjacency (mne-tools#14124) MAINT: Update pre-commit hook versions (mne-tools#14122) MAINT: Update dependency specifiers (mne-tools#14121) fix: correct typo in comment (mne-tools#14117) [dependabot]: Bump the actions group with 2 updates (mne-tools#14123) Fix` read_raw_eyelink()` failure when recording blocks are empty or starting with empty values (mne-tools#13571) ENH: Add `event_key` parameter to `read_raw_egi` for MFF event metadata (mne-tools#14086) fix for scipy sparse deprecations (mne-tools#14118) Fix notch spectrum fit (mne-tools#14116) Speed up notch filter spectrum fit (mne-tools#14114) fix MNE-RT links and update roadmap (mne-tools#14096) Clarify `docdict["filter_length_notch"]` (mne-tools#14113) Refactor test_plot_alignment_basic() (mne-tools#13472) BUG: Cleanup cHPI filtering using smooth interpolation (mne-tools#14112) Use redirector app (mne-tools#14111) ... # Conflicts: # mne/tests/test_filter.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mne.chpi.filter_chpiis designed to match Maxfilter, but it has always had a property that bothered me -- it subtracts windows in fixed chunks, which can lead to slight discontinuities in the data. The effect is minor, but it can be removed by smoothly interpolating between windows. We have the machinery for this in_Interp2, so this PR utilizes it. I consider this a bugfix so no need for deprecation cycle (but it's debatable and I could live with doing one). This is the cHPI-subtraction equivalent of what we now do for head positions themselves in movecomp. Changes drafted with Claude Opus 4.8 but I refined and understand all code.