Skip to content

Some limitations of EpochsTFRs: creating via raws, concatenating #13191

@mcfreund

Description

@mcfreund

Describe the new feature or enhancement

My pipeline involves cropping raws into blocks of trials, time-frequency transforming these cropped raws, then epoching them into trials. Transforming raws rather than epochs is desirable as it avoids creating edge artifacts around every trial. Under this workflow, it would be convenient if EpochsTFRArray could accept RawTFR objects and epoch them, as Epochs can do with Raws.

Another limitation of working with EpochsTFRs is concatenation. I've constructed EpochsTFRs from multiple different blocks/sessions and would like to concatenate them. I had expected concatenate_epochs to accept EpochsTFR but unfortunately it does not. see also https://mne.discourse.group/t/concatenating-epochstfr-objects/8463

Describe your proposed implementation

Either modification of concatenate_epochs and EpochsTFRArray, or new functions/classes analogous to time-domain counterparts.

Describe possible alternatives

As a work-around, I am flattening the time-frequency data arrays, concatenating channels and frequencies, then working with them as Epochs objects (epoching, concatenating). But the Epochs class is ill suited for handling time-frequency data.

Additional context

No response

Activity

welcome

welcome commented on Apr 5, 2025

@welcome

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

drammock

drammock commented on Apr 6, 2025

@drammock
Member

it would be convenient if EpochsTFRArray could accept RawTFR objects and epoch them, as Epochs can do with Raws.

For parity with the time domain classes, shouldn't it be EpochsTFR (not EpochsTFRArray) that did that?

I had expected concatenate_epochs to accept EpochsTFR but unfortunately it does not.

I agree that it should. Are you up for making a PR to add this?

I'd guess that concatenation will be easier than the other change, and I'd suggest tackling these in separate PRs

mcfreund

mcfreund commented on Apr 10, 2025

@mcfreund
Author

Happy to give it a shot!

drammock

drammock commented on Apr 10, 2025

@drammock
Member

I noticed yesterday on a dataset that I'm working on that concatenate_epochs also does not work with EpochsSpectrum objects. If it's not too much extra work, would be great if support for that were added at the same time as EpochsTFR support.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Some limitations of EpochsTFRs: creating via raws, concatenating · Issue #13191 · mne-tools/mne-python