Example #1
0
# on either 2D or 3D head models

# can be applied to Cohen’s D (C as done here) or
# statistical values (statscondCluster.F_obs or F_obs_plot)
# of inter-individual brain connectivity

# defining manually bad channel for viz test
epo1.info["bads"] = ["F8", "Fp2", "Cz", "O2"]
epo2.info["bads"] = ["F7", "O1"]

# Warning, threshold='auto' must be used carefully,
# it is calculated specifically for the dyad,
# and therefore does not allow comparability between different dyads.

# Visualization of inter-brain connectivity in 2D
viz.viz_2D_topomap_inter(epo1, epo2, C, threshold='auto', steps=10, lab=True)

# Visualization of inter-brain connectivity in 3D
viz.viz_3D_inter(epo1, epo2, C, threshold='auto', steps=10, lab=False)

# Visualization of intra-brain connectivity in 2D
viz.viz_2D_topomap_intra(epo1,
                         epo2,
                         C1=result_intra[0],
                         C2=result_intra[1],
                         threshold='auto',
                         steps=2,
                         lab=False)

# Visualization of intra-brain connectivity in 3D
viz.viz_3D_intra(epo1,
# turn off x ticklabels for all but the lower axes
for ax in ax1, ax2, ax3:
    plt.setp(ax.get_xticklabels(), visible=False)

plt.show()

# Setting the average reference

cleaned_epochs_AR[0].set_eeg_reference('average')
cleaned_epochs_AR[1].set_eeg_reference('average')

# Saving cleaned epochs
#cleaned_epochs_AR[0].save('epochs_cleaned_pair003_a-epo.fif', overwrite = True)
#cleaned_epochs_AR[1].save('epochs_cleaned_pair003_b-epo.fif', overwrite = True)
'''
################# Remove from here
from collections import OrderedDict
#Defining frequency bands
freq_bands = {'Theta': [4, 7],
              'Alpha-Low': [7.5, 11],
              'Alpha-High': [11.5, 13],
              'Beta': [13.5, 29.5],
              'Gamma': [30, 48]}

freq_bands = OrderedDict(freq_bands)

sampling_rate = epo1.info['sfreq']

#Picking preproccessed epochs for each participant
preproc_S1 = cleaned_epochs_AR[0]