AaltoImagingLanguage / conpy

Python package for power mapping and functional connectivity using DICS
https://aaltoimaginglanguage.github.io/conpy/
BSD 3-Clause "New" or "Revised" License
35 stars 17 forks source link

Allow computing coherence with an external reference #2

Open wmvanvliet opened 6 years ago

wmvanvliet commented 6 years ago

At the moment, conpy only supports connectivity between sensors/sources. A common use case is to compute coherence between the sensors/sources and an external sensor, for example an EMG sensor.

The API could look like this:

# Include the EMG sensors in the CSD matrix computations.
# (By default, only MEG and EEG is included)
csd_picks = mne.pick_types(epochs, meg=True, emg=True)
csd = mne.time_frequency.csd_epochs(epochs, picks=picks)

# Compute one-to-all connectivity pairs between the EMG sensor and all source vertices
pairs = conpy.sensor_to_source_pairs('EMG001', src)

# Specify during connectivity computations that the origin is not on the cortex,
# but the targets are
con = conpy.dics_connectivity(pairs, fwd, csd,
                              sources_on_cortex=False, targets_on_cortex=True)