Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNE Epochs notch_filter feature request (re: #12092) #12398

Open
ikarabinas opened this issue Jan 30, 2024 · 3 comments · May be fixed by #12403
Open

MNE Epochs notch_filter feature request (re: #12092) #12398

ikarabinas opened this issue Jan 30, 2024 · 3 comments · May be fixed by #12403
Labels

Comments

@ikarabinas
Copy link

Describe the new feature or enhancement

Currently, notch_filter can be applied to raw objects but does not have the functionality to filter epochs, as brought up previously by user hyphenzhao in request #12092. With the way I set up my pipeline, I epoch the data early on to apply other cleaning steps and am intentionally applying the notch filter at a later step. It would be very useful to be able to apply notch_filter to epoched data, in my case to avoid converting epochs back into a raw object in order to apply the notch filter.

Describe your proposed implementation

User hyphenzhao described this nicely in their post. Briefly, my understanding is that each epoch could be treated as a separate record, and the width of the notch filter could be adjusted partly based on the epoch length.

Describe possible alternatives

The alternative is to reconstruct a raw object from the epoched data by concatenating the epochs into a continuous numpy array, then using mne.io.RawArray to create a new raw object. This is what I am doing now in order to use the notch filter, but I'm worried it may introduce edge artifacts. How would you recommend handling possible edge artifacts introduced by the conversion back into a raw object?

Additional context

No response

@ikarabinas ikarabinas added the ENH label Jan 30, 2024
Copy link

welcome bot commented Jan 30, 2024

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

@larsoner
Copy link
Member

@ikarabinas in principle I think this should be doable by moving notch_filter from this class:

def notch_filter(

to this class

class FilterMixin:

Would you be up for trying a PR to make this change?

@ikarabinas ikarabinas linked a pull request Jan 31, 2024 that will close this issue
@ikarabinas
Copy link
Author

@larsoner Great! I hope this works. Let me know if the edits I made in my PR reflect the changes you were referring to.

@cbrnr cbrnr changed the title MNE Epochs notch_filter feature request (re: #12092) MNE Epochs notch_filter feature request (re: #12092) Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants