envelope correlation

External Email - Use Caution

Hi,
I have sources calculated using the following example code.
https://martinos.org/mne/stable/auto_examples/datasets/plot_opm_rest_data.html#sphx-glr-auto-examples-datasets-plot-opm-rest-data-py
I wanted to compute envelope correlation in source space.
So, I'm using this function: "corr =
mne.connectivity.envelope_correlation(label_ts, combine='mean')" to
compute, but I'm getting the following error.
ValueError: Each entry in data must be 2D, got shape (181,)
Any suggestions?

External Email - Use Caution

what is label_ts ? what is its shape?

does it respect the API documented here:

https://mne-tools.github.io/dev/generated/mne.connectivity.envelope_correlation.html

?

Alex

External Email - Use Caution

label_ts is: label_ts = mne.extract_label_time_course(stc_psd, labels,
inv['src'], return_generator=True)
and the shape is (68, 181)

External Email - Use Caution

then you have your answer. It is written:

data: array_like, shape=(n_epochs, n_signals, n_times)

so you miss one dimension

A

External Email - Use Caution

I mean how can I have this.
If I have sources calculated using "
https://martinos.org/mne/stable/auto_examples/datasets/plot_opm_rest_data.html#sphx-glr-auto-examples-datasets-plot-opm-rest-data-py"
this example. So how should I proceed to compute envelope correlation in
this calculated source space.

External Email - Use Caution

Hi,
Can we compute envelope correlation using source data obtained from
using mne.minimum_norm.compute_source_psd function.

External Email - Use Caution

Hi Vivek,

No this is not convenient as the PSD function gives you a power spectrum and not a time course.

You really want to use apply_inverse_epochs: https://mne.tools/dev/generated/mne.minimum_norm.apply_inverse_epochs.html#mne.minimum_norm.apply_inverse_epochs

We then compute the analytic signal https://en.wikipedia.org/wiki/Analytic_signal#Envelope_and_instantaneous_phase using the Hilbert transform.

If you do not do that by hand, the envelope_correlation function will take care of it internally as in this example:
https://mne.tools/dev/auto_examples/connectivity/plot_mne_inverse_envelope_correlation.html#sphx-glr-auto-examples-connectivity-plot-mne-inverse-envelope-correlation-py

Best regards,
Denis

External Email - Use Caution

Thanks Denis.