Closed rythorpe closed 8 months ago
@tsbinns any idea on this?
@rythorpe Thanks for bringing this to my attention. You are not doing anything wrong, this was a mistake on my part.
@adam2392 This is something I fixed in #142. If you like, I can submit a fresh PR with a hotfix for this specific problem.
Ah I see. How close are you to something that's reviewable from the disc. we had in #142?
@rythorpe perhaps if you're comfortable you can checkout the change in #142? The support for multivariate-connectivity was recently added by @tsbinns and we're doing a refactor before we finalize this feature in v0.6.
@adam2392 I think one matter requires further discussion, so I'm not sure how quickly the fix there would be merged. I will post a more detailed update there now.
Thanks for the reply! I can just fetch the branch on #142 for now.
@rythorpe No problem! Feel free to write me again if anything is unclear.
Are there any major API changes I should know about @tsbinns? It looks like your updated docstring says something about providing nested arrays for the seeds and targets for indices
in spectral_connectivity_time
? I'm guessing that means I should now use e.g.
indices = (np.array([[0]]),
np.array([[2]]))
instead of
indices = (np.array([0]),
np.array([2]))
to specify that I want to calculate GC from the 1st to 3rd channel?
@rythorpe Exactly, the goal of #142 is to add support for computing connectivity on multiple multivar. connections in the same function call. This requires indexing seeds and targets for a given connection as a nested array. Like you say, this is correct:
indices = (np.array([[0]]),
np.array([[2]]))
My latest refactoring attempt did not yet touch spectral_connectivity_time
, so you can still use this to call the multivariate methods.
It is also now possible to compute connectivity where the number of seed channels != number of target channels, which is explained more in this example.
Got it, thanks @tsbinns!
Fixed in #142. Thanks @tsbinns!
I've been trying to use
mne_connectivity.spectral_connectivity_time
to calculate the Granger causality between two selected channels of data but got the following traceback snippet. I suspect there's something wrong with how theindices
are getting used to select data channels, but it's also possible that I'm misunderstanding what this variable does. (My intention is to calculate the GC from the 1st to 3rd channel.)Here's a MWE using the same data referenced in your Granger causality example.
Here's info about my system and MNE installation:
Platform Linux-5.15.0-87-generic-x86_64-with-glibc2.35 Python 3.9.18 (main, Sep 11 2023, 13:41:44) [GCC 11.2.0] Executable /home/ryan/anaconda3/envs/mne/bin/python CPU x86_64 (12 cores) Memory 15.5 GB
Core ├☑ mne 1.5.1 ├☑ numpy 1.26.0 (MKL 2023.1-Product with 6 threads) ├☑ scipy 1.11.3 ├☑ matplotlib 3.7.2Installed qt5 event loop hook. (backend=QtAgg) ├☑ pooch 1.7.0 └☑ jinja2 3.1.2
Numerical (optional) ├☑ sklearn 1.3.0 ├☑ pandas 2.1.1 └☐ unavailable numba, nibabel, nilearn, dipy, openmeeg, cupy
Visualization (optional) ├☑ qtpy 2.2.0 (PyQt5=5.15.2) ├☑ ipympl 0.8.7 ├☑ pyqtgraph 0.13.3 ├☑ mne-qt-browser 0.6.0 ├☑ ipywidgets 7.6.5 └☐ unavailable pyvista, pyvistaqt, vtk, trame_client, trame_server, trame_vtk, trame_vuetify
Ecosystem (optional) ├☑ mne-connectivity 0.6.0dev0 └☐ unavailable mne-bids, mne-nirs, mne-features, mne-icalabel, mne-bids-pipeline