mne-tools / mne-connectivity

Connectivity algorithms that leverage the MNE-Python API.
https://mne.tools/mne-connectivity/dev/index.html
BSD 3-Clause "New" or "Revised" License
66 stars 34 forks source link

ITC on continuous data #106

Open agramfort opened 1 year ago

agramfort commented 1 year ago

I was asked this many times and I had now a few minutes to do a proof of concept.

See:

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

it computes phase synchrony (ITC?) by averaging overtime in a raw object. So it does not average over epochs to look for fixed phase.

hope this will help some.

Disclaimer this is not tested. It's just a 30 mins hack to help a former student...

turanskt commented 1 year ago

My bad for the imprecision. By ITC I meant inter-trial coherence, so it's just a time-frequency computation in a short. The issue is that all time-frequency methods I found (e.g tfr_morlet) take epochs as inputs and not raw objects. And the issue is that I don't have any STIM channel or event at all to create epochs with. I tried to create one big epoch of shape (1, nb_channel, timepoints) but I'm not sure at all if it is the way to go.

Concerning the phase synchrony computation that you provided, it was very helpful as it helped me to solve another issue I was facing so thank you !

agramfort commented 1 year ago

inter-trial means then inter-epochs coherence. You cannot get ITC without trials/epoch as the principle to average over epochs/trials to get coherence.

turanskt commented 1 year ago

Got it ! Thank you for the details.