Repository navigation
ENH: Support EpochsSpectrum in concatenate_epochs - #14564
Open
ishaaaan17 wants to merge 5 commits into
Open
ishaaaan17 wants to merge 5 commits into
ishaaaan17 wants to merge 5 commits into
Conversation
ishaaaan17
requested review from
agramfort,
drammock,
larsoner and
mscheltienne
as code owners
November 18, 2026 18:49
- Separate spectrum and standard epochs initialization to avoid None typing on tmax. - Guard events overflow indexing when events is None. - Credit Aman Srivastava as co-author for EpochsSpectrum concatenation in changelog. Co-authored-by: Aman Srivastava <amansri345@gmail.com>
ishaaaan17
force-pushed
the
feat/concatenate-epochs-spectrum
branch
from
November 18, 2026 21:35
5545ca8 to
c570290
Compare
This was referenced Nov 18, 2026
tsbinns
reviewed
Nov 25, 2026
ishaaaan17
force-pushed
the
feat/concatenate-epochs-spectrum
branch
from
November 26, 2026 00:03
6e3a2bc to
19df1af
Compare
tsbinns
reviewed
Nov 27, 2026
tsbinns
left a comment
Member
There was a problem hiding this comment.
Thanks for updating the test. Just two things I missed before.
| raw_sfreq = out._raw_sfreq | ||
| if spectrum: | ||
| baseline = tmin = tmax = raw_sfreq = None | ||
| shift = len(out.freqs) |
Member
There was a problem hiding this comment.
Defining a shift value for events here is tricky. I don't see a "correct" value, but in most cases this will probably be an offset of much fewer samples than the 'epoch end + 10 s' shift set for Epochs inputs. This could also lead to the first event of a concatenated object "starting" before the last one from the previous object should have ended.
I don't think there's anything in MNE that would complain about this. @drammock or @larsoner, do you think this might cause issues when working with the concatenated object, or it's irrelevant?
This branch has not been deployed
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.
Reference issue (if any)
Towards #13191. This picks up the
EpochsSpectrumwork left in #13748.What does this implement/fix?
mne.concatenate_epochs()can now combineEpochsSpectrumobjects from different runs. Events, selection, drop logs, and metadata are handled by the same logic that is already used for epochs. It also checks that the spectra match in frequencies, method, dimensions, data type, and weights before combining them.Additional information
Tests are added in the existing epochs and spectrum test files. On the final commit, those two files gave 245 passed, 5 skipped, and 3 expected failures when I ran them locally.
I used GPT-6.2 Astra in Codex for help with the implementation and the tests. I have verified the changes and the test results myself.