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 IO RAW Decimate #10791

Open
umair-hassan opened this issue Jun 20, 2022 · 13 comments
Open

MNE IO RAW Decimate #10791

umair-hassan opened this issue Jun 20, 2022 · 13 comments

Comments

@umair-hassan
Copy link

Dear MNE Maintainers,

I am trying to decimate the raw data (loaded using raw.io), I do not care about the antialiasing and filters. I just need the decimated date (downsampled ratio basically). I am not sure if I can create epoch easily for the whole data and then downsample it, therefore I think inside resample (there could be an option to switch off the filters) or there could be a generic decimate method for raw io object as well.

Happy to help implementing it though.

Best, Umair

@welcome
Copy link

welcome bot commented Jun 20, 2022

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

@agramfort
Copy link
Member

@umair-hassan look at the decim parameter in mne.Epochs class

close the issue if it fixes your issue

@umair-hassan
Copy link
Author

umair-hassan commented Jun 21, 2022

I understand that there exist a decim param in Epochs, but I do not want to Epoch the data at the continous raw stage when I am planning to decimate. Basically just loading the data using mne.io.raw method and just directly apply decimation. I also understand that it will impact my events, but I do not care about that at this stage of processing.

@cbrnr
Copy link
Contributor

cbrnr commented Jun 21, 2022

Why do you want to decimate raw (continuous) data without an anti-alias filter? Do you take care of that yourself? You can resample with raw.resample(), which does apply a suitable anti-aliasing filter though.

@umair-hassan
Copy link
Author

umair-hassan commented Jun 21, 2022

I need it for a concurrent EEG fMRI artefact correction step. I cannot just apply antialiasing in the presence of huge gradient artefacts. The data was sampled at exceptionally high Fs therefore downsampling it to a reasonable Fs is also necessary. I will take care of anti-aliasing myself.

I think generally speaking for all brain stimulation, neuromodulation, TMS-EEG analysis too, this would be quite desirable.

@cbrnr
Copy link
Contributor

cbrnr commented Jun 21, 2022

You can always grab the continuous data with raw.get_data() and then decimate the NumPy array yourself. Would that work?

@umair-hassan
Copy link
Author

Yes in principle.

@cbrnr
Copy link
Contributor

cbrnr commented Jun 21, 2022

We might consider adding a new parameter antialias=True to Raw.resample(), but I'd rather not unless it would be helpful for a larger group of users. So if you can live with the proposed workaround LMK, otherwise we'll wait for other devs to chime in.

@umair-hassan
Copy link
Author

Thanks!

@larsoner
Copy link
Member

People do ask for this from time to time. Because this keeps coming up (and since we have a non-antialiased .decimate for epochs+evoked), I'm okay with adding one that just takes every Nth sample as long as we state clearly that bad things can happen when you do this.

@larsoner larsoner reopened this Jun 21, 2022
@cbrnr
Copy link
Contributor

cbrnr commented Jun 21, 2022

OK! Then instead of adding a parameter to resample(), it is better to add a new decimate() method as you suggested.

@umair-hassan
Copy link
Author

Ping, just checking for an update here.

@jasmainak
Copy link
Member

see related issue: #10447

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

No branches or pull requests

6 participants