예제 #1
0
                dat2use = deepcopy(data)
            elif stat == 'tstat':
                dat2use = deepcopy(data_t)
        else:
            if stat == 'beta':
                dat2use = deepcopy(data_baselined)
            elif stat == 'tstat':
                dat2use = deepcopy(data_baselined_t)

        dat2plot = deepcopy(dat2use)

        gave = mne.grand_average(dat2plot[contrast])

        plot_t = True
        if plot_t:
            gave.data = toverparam(dat2plot[contrast])

#        gave.plot_joint(title = '%s, stat = %s'%(contrast, stat),
#                        timefreqs = timefreqs_alpha,
#                        vmin = topovmin['tstat'], vmax = topovmin['tstat']*-1,
#                        topomap_args = dict(outlines='head',
#                                            extrapolate='head',
#                                            contours=0,
#                                            vmin = topovmin['tstat'],
#                                            vmax = topovmin['tstat']*-1))

#run cluster test
#get data into dataframe first, for the channels we want
        if 'right' in contrast or contrast == 'crvsn':
            contrachans = visleftchans
            ipsichans = visrightchans
예제 #2
0
    for mask in masks_incorr:
        ax.hlines(
            y=-3.2e-4,
            xmin=np.min(clutimes[mask[1]]),
            xmax=np.max(clutimes[mask[1]]),
            lw=5,
            color='#e41a1c',
            alpha=.5)  #plot significance timepoints for difference effect
    for mask in masks_corr:
        ax.hlines(
            y=-3.4e-4,
            xmin=np.min(clutimes[mask[1]]),
            xmax=np.max(clutimes[mask[1]]),
            lw=5,
            color='#4daf4a',
            alpha=.5)  #plot significance timepoints for difference effect
#    fig.savefig(fname = op.join(figpath, 'error_x_diffwave_20subs_channel_'+channel+'_'+ stat +'.eps'), format = 'eps', dpi = 300)
#    fig.savefig(fname = op.join(figpath, 'error_x_diffwave_20subs_channel_'+channel+'_'+ stat +'.pdf'), format = 'pdf', dpi = 300)
#
#    plt.close()
#%%
plotvmin = dict()
plotvmin['beta'] = -3e-6
plotvmin['tstat'] = -6
gave = mne.grand_average(dat2use['errorcorrect'])
if stat == 'tstat':
    gave.data = toverparam(dat2use['errorcorrect'])
gave.plot_joint(topomap_args=dict(outlines='head', extrapolate='head'),
                times=np.arange(.1, .7, .1))
예제 #3
0
                                  topomap_args=dict(outlines='head',
                                                    contours=0))

flipped_gave_lvsr_norm.data = np.subtract(gave_lvsr_norm.data,
                                          flipped_gave_lvsr_norm.data)
flipped_gave_lvsr_norm.plot_joint(timefreqs=timefreqs_alpha,
                                  topomap_args=dict(outlines='head',
                                                    contours=0))

#for example looking across all channels at motor selection

#really just f*****g around at this point because not sure quite how to get it to work,
gave_gmean = mne.grand_average(alldata_gmean)
flipped_gmean = mne.grand_average(alldata_gmean)

gave_gmean.data = toverparam(alldata_gmean)
flipped_gmean.data = toverparam(alldata_gmean)
renaming_mapping = dict()
for i in range(len(chnames)):
    renaming_mapping[chnames[i]] = flippednames[i]
#mne.rename_channels(flipped_gmean.info, renaming_mapping)
import copy
cvsi = copy.deepcopy(gave_gmean)

flipped_gmean.reorder_channels(flippednames)
cvsi.data = np.subtract(gave_gmean.data, flipped_gmean.data)
cvsi.drop_channels(['RM'])
cvsi.plot(picks=['C4'], baseline=(
    None, None
))  #C4  is contra to the left hand, which presses space bar to start response
cvsi.plot_joint(baseline=(-0.5, -0.3),
plot_sub = True
for isub in range(subs.size):
    if plot_sub:
        #fig = data_t['clvsr'][isub].plot_joint(topomap_args = dict(outlines='skirt', contours = 0, vmin=-2,vmax=2),timefreqs = timefreqs_alpha)
        data_t['clvsr'][isub].plot_joint(topomap_args=dict(outlines='skirt',
                                                           contours=0,
                                                           vmin=-2,
                                                           vmax=2),
                                         timefreqs=timefreqs_alpha,
                                         title='sub %02d' % (subs[isub]))
#        data['clvsr'][isub].plot_joint(topomap_args = dict(outlines='skirt', contours = 0),timefreqs = timefreqs_alpha, title = 'sub %02d'%(subs[isub]))
#%%
contrast = 'cuedvsneut'
gave = mne.grand_average(data_t[contrast])
gave.data = toverparam(data_t[contrast])
gave.plot_joint(
    topomap_args=dict(
        outlines='skirt', contours=0
    ),  #baseline = (-1.75,-1.25), title ='baselined',#vmin=-4,vmax=4),
    timefreqs=timefreqs_alpha)  #, vmin=-3, vmax=3)

flip_plot = False
if flip_plot:
    chnames = np.array([
        'FP1', 'FPZ', 'FP2', 'AF7', 'AF3', 'AFZ', 'AF4', 'AF8', 'F7', 'F5',
        'F3', 'F1', 'FZ', 'F2', 'F4', 'F6', 'F8', 'FT7', 'FC5', 'FC3', 'FC1',
        'FCZ', 'FC2', 'FC4', 'FC6', 'FT8', 'T7', 'C5', 'C3', 'C1', 'CZ', 'C2',
        'C4', 'C6', 'T8', 'TP7', 'CP5', 'CP3', 'CP1', 'CPZ', 'CP2', 'CP4',
        'CP6', 'TP8', 'P7', 'P5', 'P3', 'P1', 'PZ', 'P2', 'P4', 'P6', 'P8',
        'PO7', 'PO3', 'POZ', 'PO4', 'PO8', 'O1', 'OZ', 'O2'
    52,
    53,
    54,
    55,
    57,
    58,
    59,
    61,
])
chans_no_midline = np.subtract(chans_no_midline, 1)
chnames_no_midline = np.array(alldata_grandmean[0].ch_names)[chans_no_midline]
#%%
alldata_cuedlvsr_t.pop(6)

gave_clvsr = mne.grand_average(alldata_cuedlvsr_t)
gave_clvsr.data = toverparam(alldata_cuedlvsr_t)

times, freqs = gave_clvsr.times, gave_clvsr.freqs

fig = plt.figure()
ax = fig.subplots(2, 1)
ax[0].contourf(times,
               freqs,
               np.nanmean(
                   deepcopy(gave_clvsr).pick_channels(visrightchans).data, 0),
               levels=100,
               cmap='RdBu_r',
               vmin=-2,
               vmax=2,
               antialiased=False)
ax[1].contourf(times,
예제 #6
0
                 (-0.8, 10):(.4, 4),
                 (-0.6, 10):(.4, 4)}

visleftchans  = ['PO3', 'PO7', 'O1']

visrightchans = ['PO4','PO8','O2']

motrightchans = ['C2', 'C4']  #channels contra to the left hand (space bar)
motleftchans = ['C1', 'C3']   #channels contra to the right hand (mouse)

topoargs = dict(outlines= 'head', contours = 0)
topoargs_t = dict(outlines = 'head', contours = 0, vmin=-2, vmax = 2)
#%%

gave_cleft = mne.grand_average(data_baselined_t['cuedleft'])
gave_cleft.data = toverparam(data_baselined_t['cuedleft']); gave_cleft.drop_channels(['RM'])
gave_cleft.plot_joint(topomap_args = dict(outlines='head', contours=0, vmin=-4, vmax=4),
                      timefreqs = timefreqs_cue, title = 'cued left '+ model+ ' t over tstats')

cleft_vrchans = np.subtract(np.nanmean(deepcopy(gave_cleft).pick_channels(visrightchans).data,0),0) #np.nanmean(deepcopy(gave_cleft).pick_channels(visleftchans).data,0))

times, freqs = deepcopy(gave_cleft).crop(tmin=-2, tmax=0).times, gave_cleft.freqs
-
fig = plt.figure()
ax = fig.add_subplot(111)
#ax.pcolormesh(gave_dtlvsr.times, gave_dtlvsr.freqs, cvsi_dtlvsr, cmap = 'RdBu_r', antialiased = False, vmin = -2, vmax = 2)
ax.imshow(cleft_vrchans, cmap = 'RdBu_r', aspect = 'auto', vmin = -2, vmax = 2, interpolation = 'none', origin = 'lower', extent = (np.min(times), np.max(times), np.min(freqs), np.max(freqs)))
ax.vlines([0, -1.5], linestyle = 'dashed', lw = .75, ymin=1, ymax = 39)
ax.set_ylim(1,39)
ax.set_title('contra-ipsi to cued left')
        dat2use = deepcopy(data)
    else:
        dat2use = deepcopy(data_t)
else:
    if stat == 'beta':
        dat2use = deepcopy(data_baselined)
    else:
        dat2use = deepcopy(data_baselined_t)


gave = mne.grand_average(dat2use[contrast])

plot_t=False
if plot_t:
    stat = 'tstat'
    gave.data = toverparam(dat2use[contrast])

gave.plot_joint(timefreqs = timefreqs_alpha, vmin=topovmin[stat], vmax = topovmin[stat]*-1,
                topomap_args = dict(contours = 0,
                                    vmin = topovmin[stat],
                                    vmax = topovmin[stat]*-1))
#%%

#contrast = 'err_pright_neutral'
stat = 'tstat'
if 'vs' in contrast:
    if stat == 'beta':
        dat2use = deepcopy(data)
    else:
        dat2use = deepcopy(data_t)
else:
예제 #8
0
    (.9, 10): (.4, 4)
}

visleftchans = ['PO3', 'PO7', 'O1']

visrightchans = ['PO4', 'PO8', 'O2']

motrightchans = ['C2', 'C4']  #channels contra to the left hand (space bar)
motleftchans = ['C1', 'C3']  #channels contra to the right hand (mouse)

topoargs = dict(outlines='head', contours=0)
topoargs_t = dict(outlines='head', contours=0, vmin=-2, vmax=2)

#%%
gave_gmean = mne.grand_average(data_baselined_t['grandmean'])
gave_gmean.data = toverparam(data_baselined_t['grandmean'])
gave_gmean.drop_channels(['RM'])
#gave_gmean.plot_joint(title = 'grandmean, t over tstats', timefreqs = timefreqs_cue,
#                      topomap_args = dict(outlines = 'head', contours = 0, vmin = -5, vmax = 5))

times = gave_gmean.times
timesrel2cue = np.add(times, 1.5)  #this sets zero to be the cue onset time
allfreqs = gave_gmean.freqs

#%%

for i in data_baselined_t['cued']:
    i.times = timesrel2cue
gave_cued = mne.grand_average(data_baselined_t['cued'])
gave_cued.data = toverparam(data_baselined_t['cued'])
gave_cued.drop_channels(['RM'])
for isub in range(subs.size):
    if plot_sub:
        #fig = data_t['clvsr'][isub].plot_joint(topomap_args = dict(outlines='skirt', contours = 0, vmin=-2,vmax=2),timefreqs = timefreqs_alpha)
        data_t['clvsr'][isub].plot_joint(topomap_args=dict(outlines='skirt',
                                                           contours=0,
                                                           vmin=-2,
                                                           vmax=2),
                                         timefreqs=timefreqs_alpha,
                                         title='sub %02d' % (subs[isub]))
#        data['clvsr'][isub].plot_joint(topomap_args = dict(outlines='skirt', contours = 0),timefreqs = timefreqs_alpha, title = 'sub %02d'%(subs[isub]))
#%%
vmin = -4
vmax = -1 * vmin
contrast = 'clvsr_belowvsabove'
gave = mne.grand_average(data_t[contrast])
gave.data = toverparam(data_t[contrast])
gave.plot_joint(
    topomap_args=dict(
        outlines='skirt', contours=0, vmin=vmin, vmax=vmax
    ),  #,vmin=-3,vmax=3), #baseline = (-1.75,-1.25), title ='baselined',#vmin=-4,vmax=4),
    timefreqs=timefreqs_alpha,
    vmin=vmin,
    vmax=vmax)  #, vmin=-3, vmax=3)

plot_c3 = False
if plot_c3:
    c3 = np.squeeze(deepcopy(gave).pick_channels(['C3']).data)
    fig, ax = plt.subplots()
    ax.imshow(c3,
              cmap='RdBu_r',
              aspect='auto',
예제 #10
0
    (.9, 10): (.4, 4)
}

visleftchans = ['PO3', 'PO7', 'O1']

visrightchans = ['PO4', 'PO8', 'O2']

motrightchans = ['C2', 'C4']  #channels contra to the left hand (space bar)
motleftchans = ['C1', 'C3']  #channels contra to the right hand (mouse)

topoargs = dict(outlines='head', contours=0)
topoargs_t = dict(outlines='head', contours=0, vmin=-2, vmax=2)

#%%
gave_gmean = mne.grand_average(data_baselined_t['grandmean'])
gave_gmean.data = toverparam(data_baselined_t['grandmean'])
gave_gmean.drop_channels(['RM'])
#gave_gmean.plot_joint(title = 'grandmean, t over tstats', timefreqs = timefreqs_cue,
#                      topomap_args = dict(outlines = 'head', contours = 0, vmin = -5, vmax = 5))

times = gave_gmean.times
timesrel2cue = np.add(times, 1.5)  #this sets zero to be the cue onset time
allfreqs = gave_gmean.freqs

#%%
#for i in data_baselined_t['pleft_cued']:
#    i.times = timesrel2cue

gave_pleft_cued = mne.grand_average(data_baselined_t['pleft_cued'])
gave_pleft_cued.data = toverparam(data_baselined_t['pleft_cued'])
gave_pleft_cued.drop_channels(['RM'])
예제 #11
0
    else:
        baselined = False

    if stat == 'beta' and not baselined:
        dat2use = deepcopy(data[contrast])
    elif stat == 'beta' and baselined:
        dat2use = deepcopy(data_baselined[contrast])
    elif stat == 'tstat' and not baselined:
        dat2use = deepcopy(data_t[contrast])
    elif stat == 'tstat' and baselined:
        dat2use = deepcopy(data_baselined_t[contrast])

    gave = mne.grand_average(dat2use)

    if stat == 'tstat':
        gave.data = toverparam(dat2use)

    #if you're using betas, remember that the scale is still in the same scale as the initial data input (e.g. the values of time frequency)
    if stat != 'tstat':
        vmin = -2e-11
        vmax = np.multiply(vmin, -1)
    elif stat == 'tstat':
        vmin = -5
        vmax = np.multiply(vmin, -1)

    #get the subject wise difference between right and left visual channels
    lvsrdata = np.empty(shape=(subs.size, allfreqs.size, alltimes.size))
    for i in range(subs.size):
        lvsrdata[i, :, :] = np.subtract(
            np.nanmean(deepcopy(dat2use[i]).pick_channels(visrightchans).data,
                       axis=0),
예제 #12
0
                  lw=5, color = '#4292c6', alpha = .5) #plot significance timepoints for difference effect
              
              
#this will plot these significant times as an overlay onto the plot_joint image
#requires finding the right axis within the subplot thats drawn in order to draw them on properly              
fig1 = gave.plot_joint(picks = 'eeg', topomap_args = dict(contours=0, outlines='head', vmin = -4, vmax = 4),
                       times = np.arange(0.1, 0.7, .1))
ax1 = fig1.axes[0]
for mask in range(len(masks_ern)):
    ax1.hlines(y = -3.5,
              xmin = np.min(clutimes[masks_ern[mask][1]]),
              xmax = np.max(clutimes[masks_ern[mask][1]]),
              lw=5, color = '#4292c6', alpha = .5) #plot significance timepoints for difference effect

#%%
gave_errorcorr = mne.grand_average(data['errorcorrect']); gave_errorcorr.data = toverparam(data['errorcorrect'])
gave_errorcorr.plot_joint(picks = 'eeg', topomap_args = dict(outlines = 'head', contours = 0), times = np.arange(0.1,0.7,0.05), ts_args=dict(scalings = dict(eeg = 1)),
                          title = 'error regressor correct trials')

gave_errorincorr = mne.grand_average(data['errorincorrect']);  gave_errorincorr.data = toverparam(data['errorincorrect'])
gave_errorincorr.plot_joint(picks = 'eeg', topomap_args = dict(outlines = 'head', contours = 0), times = np.arange(0.1,0.7,0.05), ts_args=dict(scalings = dict(eeg = 1)),
                            title = 'error regressor incorrect trials')

gave_errorivsc = mne.grand_average(data['errorincorrvscorr']); gave_errorivsc.data = toverparam(data['errorincorrvscorr'])
gave_errorivsc.plot_joint(picks = 'eeg', topomap_args = dict(outlines = 'head', contours = 0), times = np.arange(0.1,0.7,0.05), ts_args=dict(scalings = dict(eeg = 1)),
                            title = 'error regressor incorrect vs correct trials')



#%%
gave_confcorr   = mne.grand_average(data['confcorrect']);   gave_confcorr.data = toverparam(data['confcorrect'])
예제 #13
0
    (.8, 22): (.4, 14)
}
timefreqs_theta = {(.4, 6): (.4, 3), (.6, 6): (.4, 3), (.8, 6): (.4, 3)}

visleftchans = ['PO3', 'PO7', 'O1']
visrightchans = ['PO4', 'PO8', 'O2']
motrightchans = ['C2', 'C4']  #channels contra to the left hand (space bar)
motleftchans = ['C1', 'C3']  #channels contra to the right hand (mouse)
frontal_chans = ['CZ', 'FCZ', 'FZ', 'FC1', 'FC2']
ftheta_chans = ['FPZ', 'AFZ', 'FZ', 'AF3', 'AF4']

topoargs = dict(outlines='head', contours=0)
topoargs_t = dict(outlines='head', contours=0, vmin=-2, vmax=2)
#%%
gave_gmean = mne.grand_average(data['grandmean'])
gave_gmean.data = toverparam(data['grandmean'])
#gave_gmean.plot_joint(title = 'grandmean, t over tstats', timefreqs = timefreqs_cue,
#                      topomap_args = dict(outlines = 'head', contours = 0, vmin = -5, vmax = 5))

times = gave_gmean.times
allfreqs = gave_gmean.freqs
del (gave_gmean)

#%%
#is there anything lateralised in the visual response, relative to the location of the probed item?
#gave_pside = mne.grand_average(data['pside']); gave_pside.data = toverparam(data['pside'])
#gave_pside.plot_joint(title = 'probed item left vs right', timefreqs = timefreqs, topomap_args = topoargs_t, picks = 'eeg')
#%%
#firstly lets just visualise the ERN if we can: this is incorr vs corr
#this is a contrast so we can take the non-baselined data
예제 #14
0
for contrast in ['grandmean', 'update']:
    if 'vs' in contrast:
        baselined = False

    if stat == 'beta' and not baselined:
        dat2use = deepcopy(data)
    elif stat == 'beta' and baselined:
        dat2use = deepcopy(data_baselined)
    elif stat == 'tstat' and not baselined:
        dat2use = deepcopy(data_t)
    elif stat == 'tstat' and baselined:
        dat2use = deepcopy(data_baselined_t)

    gave = mne.grand_average(dat2use[contrast])

    if plot_t:
        gave.data = toverparam(dat2use[contrast])

    gave.plot_joint(topomap_args=dict(contours=0,
                                      vmin=vmin['tstat'],
                                      vmax=vmin['tstat'] * -1),
                    title=contrast,
                    timefreqs=timefreqs_theta,
                    vmin=vmin['tstat'],
                    vmax=vmin['tstat'] * -1)
#channels to focus on for theta: FCz, FC1, FC2, Cz, Fz

for channel in ['FCz', 'Cz', 'Fz']:
    gave.plot(picks=channel, vmin=-3, vmax=3)
gave_gmean.plot_joint(
    title='all trials response to array, average betas, preglm baseline',
    timefreqs=timefreqs,
    topomap_args=dict(outlines='head', contours=0))
plot_singlesubs = False
from copy import deepcopy
if plot_singlesubs:
    for i in range(len(alldata_grandmean)):
        tmp = deepcopy(alldata_grandmean[i])
        tmp = tmp.drop_channels(['RM'])
        tmp.plot_joint(title='ave response, betas, subject %d' % subs[i],
                       timefreqs=timefreqs,
                       topomap_args=dict(outlines='head', contours=0))

gave_gmean = mne.grand_average(alldata_grandmean)
gave_gmean.data = toverparam(alldata_grandmean)
gave_gmean.drop_channels(['RM'])
gave_gmean.plot_joint(
    title='all trials response to array, t over betas, preglm baseline',
    timefreqs=timefreqs,
    topomap_args=dict(outlines='head', contours=0, vmin=-4, vmax=+4))

gave_gmean_t = mne.grand_average(alldata_grandmean_t)
gave_gmean_t.data = toverparam(alldata_grandmean_t)
gave_gmean_t.drop_channels(['RM'])
gave_gmean_t.plot_joint(
    title='all trials response to array, t over tstats, preglm baseline',
    timefreqs=timefreqs,
    topomap_args=dict(outlines='head', contours=0, vmin=-4, vmax=4))

gave_error_t = mne.grand_average(alldata_error_t)
예제 #16
0
for contrast in ['error',
                 'conf']:  #, 'errorincorrvscorr', 'confincorrvscorr']:
    if 'vs' in contrast:
        baselined = False
    else:
        baselined = True

    if stat == 'tstat' and baselined:
        dat2use = deepcopy(data_baselined_t)
    elif stat == 'tstat' and not baselined:
        dat2use = deepcopy(data_t)

    gave = mne.grand_average(dat2use[contrast])
    if plot_t:
        gave.data = toverparam(dat2use[contrast])

#    gave.plot_joint(timefreqs = timefreqs_alpha, topomap_args = dict(contours = 0, vmin = -2.8, vmax = 2.8), vmin = -2.8, vmax = 2.8, title = contrast)

    gave.plot(picks='FCz',
              title=contrast + ' at FCz, stat =' + stat,
              vmin=-2.8,
              vmax=2.8)

#%%

contrast = 'errorcorrect'
channel = ['FCz']
stat = 'tstat'
tmin = 0
tmax = 1.5
    (1., 10): (.4, 4)
}
visleftchans = ['PO3', 'PO7', 'O1']

visrightchans = ['PO4', 'PO8', 'O2']

motrightchans = ['C2', 'C4']  #channels contra to the left hand (space bar)
motleftchans = ['C1', 'C3']  #channels contra to the right hand (mouse)

topoargs = dict(outlines='head', contours=0)
topoargs_t = dict(outlines='head', contours=0, vmin=-2, vmax=2)

#%%

gave_clvsr = mne.grand_average(alldata_cuedlvsr_t)
gave_clvsr.data = toverparam(alldata_cuedlvsr_t)
gave_clvsr.drop_channels(['RM'])
gave_clvsr.plot_joint(topomap_args=topoargs_t, timefreqs=timefreqs_alpha)

times, freqs = gave_clvsr.times, gave_clvsr.freqs

cvsn_vis = np.subtract(
    np.nanmean(deepcopy(gave_clvsr).pick_channels(visrightchans).data, 0),
    np.nanmean(deepcopy(gave_clvsr).pick_channels(visleftchans).data, 0))
cvsn_mouse = np.subtract(
    np.nanmean(deepcopy(gave_clvsr).pick_channels(motleftchans).data, 0),
    np.nanmean(deepcopy(gave_clvsr).pick_channels(motrightchans).data, 0))
cvsn_space = np.subtract(
    np.nanmean(deepcopy(gave_clvsr).pick_channels(motrightchans).data, 0),
    np.nanmean(deepcopy(gave_clvsr).pick_channels(motleftchans).data, 0))
예제 #18
0
    (.7, 22): (.2, 16),
    (.8, 22): (.2, 16),
    (.9, 22): (.2, 16)
}

#going to visualise these regressors now just to look at effects

gave_gmean = mne.grand_average(alldata_grandmean)
gave_gmean.drop_channels(['RM'])
gave_gmean.plot_joint(
    title='average feedback evoked response, average betas, preglm baseline',
    timefreqs=timefreqs_alpha,
    topomap_args=dict(outlines='head', contours=0))

gave_gmean = mne.grand_average(alldata_grandmean)
gave_gmean.data = toverparam(alldata_grandmean)
gave_gmean.drop_channels(['RM'])
gave_gmean.plot_joint(
    title='average feedback evoked response, t over betas, preglm baseline',
    timefreqs=timefreqs_alpha,
    topomap_args=dict(outlines='head', contours=0, vmin=-4, vmax=4))

gave_gmean_t = mne.grand_average(alldata_grandmean_t)
gave_gmean_t.data = toverparam(alldata_grandmean_t)
gave_gmean_t.drop_channels(['RM'])
gave_gmean_t.plot_joint(
    title='average feedback evoked response, t over tstats, preglm baselined',
    timefreqs=timefreqs_alpha,
    topomap_args=dict(outlines='head', contours=0, vmin=-2, vmax=2))

plot_subs = True
visleftchans  = ['PO4','PO8','O2']
visrightchans = ['PO3', 'PO7', 'O1']

#%% Question 1 -- Do cues facilitate selection of an item from WM in our task?
#analysis needed:
# -- cued vs neutral (i.e. do visual responses look different in the two?)
# -- cued left vs cued right (do things lateralise in a way that suggests selection)

#just plot the average for all neutral trials first
gave_neutral = mne.grand_average(alldata_neutral_baselined); gave_neutral.drop_channels(['RM'])
gave_neutral.plot_joint(title = 'evoked response to neutral cues, average betas',
                        timefreqs = timefreqs_alpha,
                        topomap_args = dict(outlines = 'head', contours = 0))

gave_neutral = mne.grand_average(alldata_neutral_baselined); gave_neutral.data = toverparam(alldata_neutral_baselined);
gave_neutral.drop_channels(['RM'])
gave_neutral.plot_joint(title     = 'evoked response to neutral cues, t over betas',
                        timefreqs = timefreqs_alpha, 
                        topomap_args = dict(outlines = 'head', contours = 0),
                        vmin = -2, vmax = 2)

gave_neutral_t = mne.grand_average(alldata_neutral_baselined_t); gave_neutral_t.drop_channels(['RM'])
gave_neutral_t.plot_joint(title = 'evoked response to neutral cues, average tstats',
                          timefreqs = timefreqs_alpha,
                          topomap_args = dict(outlines = 'head', contours = 0))

gave_neutral_t = mne.grand_average(alldata_neutral_baselined_t); gave_neutral_t.drop_channels(['RM'])
gave_neutral_t.plot_joint(title = 'evoked response to neutral cues, average tstats',
                          timefreqs = timefreqs_alpha,
                          topomap_args = dict(outlines = 'head', contours = 0))
예제 #20
0
                          44, 43, 42, 41, 40, 39, 38, 37, 36,
                          53, 52, 51, 50, 49, 48, 47, 46, 45,
                                  58, 57, 56, 55, 54,
                                      61, 60, 59,
                                          62
                                          ])
flipids = np.subtract(flipids,1)
flippednames = chnames[flipids]

#for example looking across all channels at motor selection

#really just f*****g around at this point because not sure quite how to get it to work,
gave_gmean    = mne.grand_average(alldata_gmean)
flipped_gmean = mne.grand_average(alldata_gmean);

gave_gmean.data = toverparam(alldata_gmean)
flipped_gmean.data = toverparam(alldata_gmean)
renaming_mapping = dict()
for i in range(len(chnames)):
    renaming_mapping[chnames[i]] = flippednames[i]
#mne.rename_channels(flipped_gmean.info, renaming_mapping)
import copy
cvsi = copy.deepcopy(gave_gmean)

flipped_gmean.reorder_channels(flippednames)
cvsi.data = np.subtract(gave_gmean.data, flipped_gmean.data)
cvsi.drop_channels(['RM'])
cvsi.plot(picks=['C4'], baseline = (None, None)) #C4  is contra to the left hand, which presses space bar to start response
cvsi.plot_joint(baseline = (-0.5, -0.3), topomap_args = dict(outlines='head', contours=0, vmin=-.5, vmax=.5),
                timefreqs = {(0,23):(.4, 14)})