mne-bids-pipeline icon indicating copy to clipboard operation
mne-bids-pipeline copied to clipboard

WIP: ICA clean raw data

Open MerlinDumeur opened this issue 4 years ago • 6 comments

This code works for one dataset, on one subject. I will do the tests soon when I get the time.

I open this PR for feedback. Some ironing out will need to be done, this is very much still a work in progress.

MerlinDumeur avatar Apr 15 '21 20:04 MerlinDumeur

I would suggest to remove all auto reject related code here and to focus on the rest. We can add auto reject in a next PR

agramfort avatar Apr 15 '21 20:04 agramfort

If this is because the checks fail, I think it would be an easy fix, but it's probably best to keep autoreject separate for now. It work fine for me though, so it shouldn't be too hard to add later.

MerlinDumeur avatar Apr 16 '21 05:04 MerlinDumeur

I looked at how mne handles the computation of the source PSD for raw data (mne.minimum_norm.compute_source_psd), and it appears that it just creates an Epoch instance with only 1 epoch which is the length of the raw recording, and calls the mne.minimum_norm.compute_source_psd_epochs function.

We could maybe take inspiration from this? I could adapt the PR

MerlinDumeur avatar Apr 20 '21 14:04 MerlinDumeur

as soon as you have an epoch you're blocked to ignore/remove transient artifacts

agramfort avatar Apr 20 '21 15:04 agramfort

yes that's true but that will be always be a problem anyway. If I can't epoch my data because I need long recordings, then there's not much I can about it either way, unless I missed something.

It would be nice to have mne functions on raw data that ignore transient artifacts based on annotations, but I don't think that's available yet? For instance if I want the compute the PSD on raw data, it does not take into account BAD annotations

MerlinDumeur avatar Apr 20 '21 15:04 MerlinDumeur

yes that's true but that will be always be a problem anyway. If I can't epoch my data because I need long recordings, then there's not much I can about it either way, unless I missed something.

honestly I am wondering how realistic this is. If you take the full camcan data > 600 subjects how many subjects have a rest session with no artifacts beyond flux jumps?

as discussed last friday let's do one thing at a time.

first the annotate_flux_jump function in mne then a function to fix them by temporal interpolation then we see how to use this in the pipeline

agramfort avatar Apr 20 '21 15:04 agramfort

As of #840 ICA (and SSP) are now also applied to raw data and saved to disk as proc-clean

larsoner avatar Feb 06 '24 19:02 larsoner