mne-tools / mne-bids-pipeline

Automatically process entire electrophysiological datasets using MNE-Python.
https://mne.tools/mne-bids-pipeline/
BSD 3-Clause "New" or "Revised" License
134 stars 65 forks source link

ENH: TSPCA or regress_artifact #832

Closed larsoner closed 6 months ago

larsoner commented 6 months ago

We currently don't offer any (?) reference-sensor-based preprocessing. meegkit has TSPCA for this. I haven't used it much but some collaborators with a KIT system have had good results. Any objection to me adding it as a step?

As part of this, I'd need to find a dataset that has reference sensors... not sure if we have any so far.

hoechenberger commented 6 months ago

I'm not familiar with this method, but I don't have any objections to adding it!

agramfort commented 6 months ago

I would contribute this then to mne and not add an extra dependency here

larsoner commented 6 months ago

We had some discussion of doing that in https://github.com/mne-tools/mne-python/issues/7170#issuecomment-571505186 and after some additional discussion in https://github.com/mne-tools/mne-python/pull/9302#issuecomment-1289240892 about mne-incubator vs meegkit nothing came of it.

What's the issue with making meegkit an optional dependency if you use only tsPCA for example? It seems like we should leverage existing implementations when possible. And if/when we eventually move tsPCA somewhere else, then we update the dependency. Or are you worried it's not fully vetted/tested etc.?

agramfort commented 6 months ago

hum... deps are ok https://github.com/nbara/python-meegkit/blob/master/requirements.txt but my reflex is "if this is really useful" we should offer this with mne (make it work smoothy with Epochs/Raw, different sensor types etc.)

Message ID: @.***>

larsoner commented 6 months ago

Okay it looks like for at least one dataset mne.preprocessing.regress_artifact provides very similar (identical to a quick eye check) performance on one dataset.

WDYT about adding a regress_artifact = dict(picks=None, picks_artifact=None) for example? For my dataset that would be dict(picks="meg", picks_artifact=["MISC 001", "MISC 002", "MISC 003"]) for example. I think it would be flexible enough to allow regressing other artifacts people have recorded, too (e.g., EOG if they want rather than using SSP).

agramfort commented 6 months ago

you need adding an option to support mne.preprocessing.regress_artifact here?

larsoner commented 6 months ago

Yeah that's what I'm thinking