[Mne_analysis] Return Spectral Connectivity of Each Epoch {Disarmed} {Disarmed}

Bear, Joshua JOSHUA.BEAR at cuanschutz.edu
Wed Nov 4 09:49:15 EST 2020
Search archives:

        External Email - Use Caution        

I can’t recall offhand if there is an explicit way to do this. One work around would be to loop through your epochs and send them one-by-one. In prior versions, you could need to put the epoch back into a list (of length 1) in order for the function to function. So, for example: for epoch in epochs: spectral_connectivity([epoch], …)



On Nov 4, 2020, at 7:12 AM, balandongiv at gmail.com<mailto:balandongiv at gmail.com> wrote:


        External Email - Use Caution

Dear Group,

The objective is to compute frequency connectivity measures. Say we have 70 epochs of an event with the id 1, and I would like the connectivity measures each of the epoch.
However, I noticed the spectral_connectivity() return an average connectivity measures value of all the 70 epochs (please correct this if I'm wrong).

I have checked the documentation (MailScanner has detected a possible fraud attempt from "secure-web.cisco.com" claiming to be https://secure-web.cisco.com/1ZxOB3n5tCh-_A8D-Pqf4vVFuXwl8sjl-Z8AfagLiNWuGVgtaobfzjg_lHN-d1oRS0YoVQeZtVC3EMk5PhNyijvHTRQ0uMHD-2_Bw9CBUm4HA-mfMM_KfJ45kmLXtdp46v2kPof_YGhvPTfB5akFH2h27-VTwh49rkeawM4G66rVUcMibuCvOjmEycgUofsS9ikWslfGTmXL60DbIjKmeAw/https%3A%2F%2Fmne.tools%2Fstable%2Fgenerated%2Fmne.connectivity.spectral_connectivity.html%23mne.connectivity.spectral_connectivity<https://secure-web.cisco.com/1JHYhvePBuZSfOcyruZnRTehIQyF7J9JjEGEij4dTwDwIzig9G_08JjrORapltjEh-y4IYa1s33w-ptI7jOo3n3_RHj7rLrtZrC90_5dtZDqqX_PsCW08u572k0XxLnqMinNJzvLhirSTO0_BZX-rmfuvAPv5Ex4zkP2qCA2jKsZw43bLALj7X7FWthZsRLYY-vN3d2o-WucVqmoUm1i5uA/https%3A%2F%2Fmne.tools%2Fstable%2Fgenerated%2Fmne.connectivity.spectral_connectivity.html%23mne.connectivity.spectral_connectivity>), but I did not found any related setting to return connectivity measures value of each of the epoch.
But, the accompanying documentation (MailScanner has detected a possible fraud attempt from "secure-web.cisco.com" claiming to be https://secure-web.cisco.com/1WUx7yaMNK9SKpGHalepHLnh1YzfmAGp9nwpxEaX8kGn8dQBkzLeFRSwjXAhs1If9VhOL1KITWzyQHl3oY7KBOVm7ylVvnhpt6SCmxtt1iIgs3gjCyeBYbzsxnmgt0MnByjngY9Y-PIktRFhk2MlbugRSPA_Q-HCJgiLYB1sUIYgSmnlnKziXiLL_PCU1ZjPTiiY32ZCK_UNr7hitEdNH0A/https%3A%2F%2Fgithub.com%2Fmne-tools%2Fmne-python%2Fblob%2F0e080a5a645b5934445ef4da6da744d7dfa7f68d%2Fmne%2Fconnectivity%2Fspectral.py%23L630) <https://secure-web.cisco.com/16q_3CCS_-dCdBv55zRM9Mtz76ztHmZbDKvB1V5VuuUY7wPZ6_th_XEA_MU62svsGuFO3zSFw7HGe5-eDe2cjhIMP1eGhnQpK8ie_dOyqW18dgiF4GR46UwI8NEQv17PpeJbqo4Wo5GgBtHVbFjIkrR2jfLGllQ6m9lDyPho6CwrAx533ELYGNBy5NrckURLfnKW6b4edAwKIHGsW1AXKDg/https%3A%2F%2Fgithub.com%2Fmne-tools%2Fmne-python%2Fblob%2F0e080a5a645b5934445ef4da6da744d7dfa7f68d%2Fmne%2Fconnectivity%2Fspectral.py%23L630%29>  not explicitly mention ` con` will be the average value of all epoch. This leads me to believe that the function can return the connectivity measures value of each of the epoch. Appreciate for confirmation about this issue.

Code example lead to the above observation is as below:


import mne
from mne import io
from mne.connectivity import spectral_connectivity
from mne.datasets import sample

data_path = sample.data_path()
raw_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw.fif'
event_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw-eve.fif'
raw = io.read_raw_fif(raw_fname)
events = mne.read_events(event_fname)
ch_names = raw.info<http://secure-web.cisco.com/1aFtFSijGjjMel_yKXswsCC_aPBeyZc8i-Tlqhd_dqrm7ntacmB3pF4R5TPayXofr_MA9Wop01CMVnyhbbOPanpZ7tMIPSEU1YJxS2xDprMNOkqPaQX0o6WikdIHSWfm43ic2DIa6UEnWOlj6Cdlb4gJF80fE4pm4kUDsowquzOGmUG3W4q4BV0RyN2mpJYT73PX9U9wolJBpIozSMftkNQ/http%3A%2F%2Fraw.info%2F>['ch_names']
picks = mne.pick_channels(ch_names=ch_names,include=['EEG 001','EEG 002','EEG 003'])
event_id, tmin, tmax = 1, -10, 0
epochs = mne.Epochs(raw, events, event_id, tmin, tmax, picks=picks)
fmin, fmax = (1.,5.),(4.,9.)
sfreq = raw.info<http://secure-web.cisco.com/1aFtFSijGjjMel_yKXswsCC_aPBeyZc8i-Tlqhd_dqrm7ntacmB3pF4R5TPayXofr_MA9Wop01CMVnyhbbOPanpZ7tMIPSEU1YJxS2xDprMNOkqPaQX0o6WikdIHSWfm43ic2DIa6UEnWOlj6Cdlb4gJF80fE4pm4kUDsowquzOGmUG3W4q4BV0RyN2mpJYT73PX9U9wolJBpIozSMftkNQ/http%3A%2F%2Fraw.info%2F>['sfreq']  # the sampling frequency
tmin = 0  # exclude the baseline period
tmax=2
epochs.load_data()
con, freqs, times, n_epochs, n_tapers = spectral_connectivity(
    epochs, method='pli', mode='multitaper', sfreq=sfreq, fmin=fmin, fmax=fmax,
    faverage=True, tmin=tmin, tmax=tmax,mt_adaptive=False, n_jobs=1)


Regards
Rodney
_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu<mailto:Mne_analysis at nmr.mgh.harvard.edu>
https://secure-web.cisco.com/1c4b4Bxko8iRoqpgzbYe3I-E1vUHSrzFsc738n_mp5LCiNlj7sqotCwkPJTSQZtSRGeNiNRsG1NX0oFomdh4FjsQN7RwippDDG3Ms8ujLgxyXPCss-ekzfxH54TZFEYRLtUpgCl1MWqKiLpkJv46Sys7TVFXMPYdrpsWRl7wlxTaSNyl3T6uSvuPUcjOMp5XqBN2w-2pTMG-_bO9UdGmw_g/https%3A%2F%2Fmail.nmr.mgh.harvard.edu%2Fmailman%2Flistinfo%2Fmne_analysis

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20201104/10041a60/attachment-0001.html 


More information about the Mne_analysis mailing list