mne-connectivity icon indicating copy to clipboard operation
mne-connectivity copied to clipboard

Phase-slope index using spectral_connectivity_time instead of spectral_connectivity_epochs?

Open seqasim opened this issue 1 year ago • 6 comments
trafficstars

Describe the problem

Currently, the function for computing phase-slope index is hard-coded to be computed over epochs to produce time-resolved PSI, and there's no option for computing the phase-slope index over time to produce PSI per epoch. This would be useful if you think the average directionality between two signals over the entire timecourse is informative. You could compute this by binning your trials into categories (i.e. good trials v. bad trials) and then computing PSI, but there's no way to compute PSI per epoch and relate it to continuous trial-level predictors. This should be possible unless I'm missing something

Describe your solution

  1. Add a _cohy function to mne_connectivity.spectral.time by removing the absolute value from _coh

  2. Mimic conditional statements for coh for cohy in _pairwise_con and _parallel_con

  3. Create a new function phase_slope_index_time that mimics phase_slope_index but utilizes our new computation of cohy using spectral_connectivity_time instead of spectral_connectivity_epochs

Does this sound reasonable or am I missing some obvious reason not to do this? If so, I'm happy to implement this and test and make a pull request.

seqasim avatar Mar 25 '24 15:03 seqasim

This seems reasonable to me. IIUC, the original PR just didn't add cohy to ere on the side of simplicity.

@tsbinns any thoughts?

adam2392 avatar Mar 25 '24 21:03 adam2392

I don't see any problems. With #163 merged spectral_connectivity_time can return complex values, would just need to list the new cohy method here alongside cacoh: https://github.com/mne-tools/mne-connectivity/blob/2af1398e7784350ec8f38c71061668e677fa27c0/mne_connectivity/spectral/time.py#L563-L569

tsbinns avatar Mar 26 '24 12:03 tsbinns

SG. Feel free to submit a PR @seqasim

adam2392 avatar Mar 26 '24 13:03 adam2392

Sorry for the delay - created a PR here: https://github.com/mne-tools/mne-connectivity/pull/210

seqasim avatar Jun 28 '24 21:06 seqasim