mne-tools / mne-python

MNE: Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python
https://mne.tools
BSD 3-Clause "New" or "Revised" License
2.7k stars 1.31k forks source link

python toolbox for connectivity #1187

Closed agramfort closed 10 years ago

agramfort commented 10 years ago

https://github.com/SCoT-dev/SCoT

might be worth looking into this to see if we can join forces

cc/ @kazemakase

both of our licenses are compatible.

agramfort commented 10 years ago

just in case I've coded up the estimation of Partial Directed Coherence and Direct Transfer Function using MVAR processes.

https://gist.github.com/agramfort/9875439

let me know if it ends up being useful.

agramfort commented 10 years ago

could be worth comparing with https://github.com/SCoT-dev/SCoT/blob/master/scot/connectivity.py

mbillingr commented 10 years ago

Sorry for replying late on account of missing the notification.

I have not worked with MNE before, but I'm definitely interested in joining forces. After all, connectevity tools by themselves are only of limited usefulness. Interoperability with other tools is something I will have to work on sooner or later :)

mbillingr commented 10 years ago

@agramfort: Both our implementations of MVAR fitting and PDC/DTF estimation yield similar results. That ought to be a good sign.

agramfort commented 10 years ago

I have not worked with MNE before, but I'm definitely interested in joining forces.

would be great !

After all, connectevity tools by themselves are only of limited usefulness. Interoperability with other tools is something I will have to work on sooner or later :)

and you could benefit from the MNE/Freesurfer machinery for source reconstruction, group realignment etc.

@agramfort: Both our implementations of MVAR fitting and PDC/DTF estimation yield similar results. That ought to be a good sign.

that's a good start :)

mbillingr commented 10 years ago

and you could benefit from the MNE/Freesurfer machinery for source reconstruction, group realignment etc.

Indeed. Serious source reconstruction will often be preferrable over the ICA flavored blind source separation that we currently have.

agramfort commented 10 years ago

we have ICA too using sklearn

maybe be worth comparing our approaches to have the best of both worlds in Python

cf.

http://martinos.org/mne/dev/auto_examples/preprocessing/plot_ica_from_raw.html#example-preprocessing-plot-ica-from-raw-py

and http://martinos.org/mne/dev/auto_examples/preprocessing/plot_ica_from_epochs.html#example-preprocessing-plot-ica-from-epochs-py

where a you in the world? can we see you in real life at HBM or Biomag this year?

mbillingr commented 10 years ago

Am I correct to assume ICA in MNE is used for pre-processing and artifact reduction?

Our current approach is to estimate connectivity between ICs, but it would be interesting to use cortical source activations obtained from MNE instead.

I am in Austria. Unfortunately, I won't be at HBM or Biomag; only at the Graz BCI Conference :)

agramfort commented 10 years ago

Am I correct to assume ICA in MNE is used for pre-processing and artifact reduction?

yes

Our current approach is to estimate connectivity between ICs, but it would be interesting to use source activations obtained from MNE instead.

worth trying indeed.

I am in Austria. Unfortunately, I won't be at HBM or Biomag; only at the Graz BCI Conference :)

we might have money to fly you to Paris in June for the MNE sprint.

would you be interested in coming?

mbillingr commented 10 years ago

I think I might be interested. What is the MNE sprint about? Google has trouble finding that information...

agramfort commented 10 years ago

https://mail.nmr.mgh.harvard.edu/pipermail//mne_analysis/2014-March/001982.html

https://github.com/mne-tools/mne-python/wiki/Coding-sprints

the topics need to be expanded / clarified based on people's interests

mbillingr commented 10 years ago

The topics sound rather vague yet, but meeting other developers in person seems like a great opportunity to get some code done and ensure compatibility between tools. The date is fine for me too. I'd only have to get the OK from my boss who might take some convincing :)

agramfort commented 10 years ago

more in projects in :

https://github.com/mne-tools/mne-python/wiki/GSOC-Ideas

https://github.com/mne-tools/mne-python/pulls

and issues :)

https://github.com/mne-tools/mne-python/issues?state=open

mbillingr commented 10 years ago

Looks like there is quite a bunch of things to do. Is the sprint related to the GSOC?

If there are plans to work on connectivity, I'm sure I can help.

agramfort commented 10 years ago

Looks like there is quite a bunch of things to do. Is the sprint related to the GSOC?

no but one student will be there and we might want to give him a hand

If there are plans to work on connectivity, I'm sure I can help

you make the plans. Ideally we work in pairs that's the only thing. update the page saying you want to work on connectivity and it's good

mluessi commented 10 years ago

Improving the connectivity code could definitely be something we could work on during the sprint. Right now we only have pairwise measures with an implementation that is quite efficient in terms of memory consumption and processing speed. Figuring out a good way to include partial measures (PDC, etc.) will definitely be interesting :).

mbillingr commented 10 years ago

MNE currently estimates connectivity from spectral densities, right? I have no experience with that approach. However, I can contribute MVAR based connectivity estimation or an interface to SCoT.

mluessi commented 10 years ago

Yes, it uses non-parameteric spectrum estimation using either windowed FFTs, DPSS multitaper, or Morlet wavelets (for time-frequency connectivity). All methods currently implemented are pairwise, i.e., the connectivity is estimated for each pair of nodes separately. We should start thinking how to best implement conditional methods (e.g. partial coherence). I think MVAR methods are well suited for this, but it would be nice to have MVAR also for pairwise methods.

mbillingr commented 10 years ago

Pairwise methods could be implemented with bivariate AR models, but I think that is not very efficient. Alternatively, spectra obtained from MVAR can serve as the basis for pairwise methods.

Here is a list of measures I have currently implemented: http://scot-dev.github.io/scot-doc/api/scot/scot.html#r1 Methods such as PLV or PLI should be straightforward.

mbillingr commented 10 years ago

I've hijacked the connectivity-spectrum example to do a quick proof-of-concept: https://gist.github.com/kazemakase/11159740

label_pdc

The mvar residuals are far from white, unless the model order is set insanely high. I'm still puzzling over that...

mbillingr commented 10 years ago

1356

agramfort commented 10 years ago

I guess I can close now