[Mne_analysis] How to get coherence between stc files?

Maria Hakonen maria.hakonen at gmail.com
Thu Jun 15 11:53:10 EDT 2017
Search archives:

Dear mne experts,

In an example “Compute coherence in source space using a MNE inverse
solution” mne.connectivity.spectral_connectivity is used to compute the
coherence between a seed in the left auditory cortex and the rest of the
brain based on single-trial MNE-dSPM inverse solutions. However, I would
like to use mne.connectivity.spectral_connectivity to compute the coherence
between two stc files measured in two different conditions.

I have tried to do this as follows:
stcs=np.concatenate((stc_1.data,stc_2.data),axis=0)
stcs=stcs.tolist()
indices=(np.arange(1,20484),np.arange(20485,40968)) (I would like to get
the coherence between each vertex in stc1 and the corresponding vertices in
stc2)
coh, freqs, times, n_epochs, n_tapers = spectral_connectivity(
    stcs, method='coh', mode='fourier', indices=indices,
    sfreq=sfreq, fmin=fmin, fmax=fmax, faverage=True, n_jobs=1)

However, I get:

Connectivity computation...
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-40-139613d5f602> in <module>()
      1 coh, freqs, times, n_epochs, n_tapers = spectral_connectivity(
      2     stcs, method='coh', mode='fourier', indices=indices,
----> 3     sfreq=sfreq, fmin=fmin, fmax=fmax, faverage=True, n_jobs=1)

/share/apps/mne/mne-python/python2.7/lib/python2.7/site-packages/mne-0.11.dev0-py2.7.egg/mne/connectivity/spectral.pyc
in spectral_connectivity(data, method, indices, sfreq, mode, fmin, fmax,
fskip, faverage, tmin, tmax, mt_bandwidth, mt_adaptive, mt_low_bias,
cwt_frequencies, cwt_n_cycles, block_size, n_jobs, verbose)

/share/apps/mne/mne-python/python2.7/lib/python2.7/site-packages/mne-0.11.dev0-py2.7.egg/mne/utils.pyc
in verbose(function, *args, **kwargs)
    549         finally:
    550             set_log_level(old_level)
--> 551     return function(*args, **kwargs)
    552
    553

/share/apps/mne/mne-python/python2.7/lib/python2.7/site-packages/mne-0.11.dev0-py2.7.egg/mne/connectivity/spectral.pyc
in spectral_connectivity(data, method, indices, sfreq, mode, fmin, fmax,
fskip, faverage, tmin, tmax, mt_bandwidth, mt_adaptive, mt_low_bias,
cwt_frequencies, cwt_n_cycles, block_size, n_jobs, verbose)
    772             # get the data size and time scale
    773             n_signals, n_times_in, times_in = \
--> 774                 _get_and_verify_data_sizes(first_epoch)
    775
    776             if times_in is None:

/share/apps/mne/mne-python/python2.7/lib/python2.7/site-packages/mne-0.11.dev0-py2.7.egg/mne/connectivity/spectral.pyc
in _get_and_verify_data_sizes(data, n_signals, n_times, times)
    479     n_signals_tot = 0
    480     for this_data in data:
--> 481         this_n_signals, this_n_times = this_data.shape
    482         if n_times is not None:
    483             if this_n_times != n_times:

AttributeError: 'float' object has no attribute 'shape'

Could someone please let me know what I am doing wrong?

Best,
Maria
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20170615/3329bd22/attachment-0001.html 


More information about the Mne_analysis mailing list