Exemplo n.º 1
0
    elif subject == 'S236':
        ocular_projs = [Projs[0]]
    elif subject == 'S238':
        ocular_projs = [Projs[0], Projs[2]]
    elif subject == 'S239':
        ocular_projs = [Projs[0], Projs[2]]
    elif subject == 'S246':
        ocular_projs = [Projs[0], Projs[2]]
    elif subject == 'S247':  #S247 looks sleepy ... lot of alpha
        ocular_projs = [Projs[0], Projs[2]]
    elif subject == 'S250':
        ocular_projs = [Projs[0], Projs[1]]

    #ocular_projs = Projs

    data_eeg.add_proj(ocular_projs)
    data_eeg.plot_projs_topomap()
    #data_eeg.plot(events=blinks,show_options=True)

    del blinks, blink_epochs, Projs, ocular_projs

    #%% Plot data
    fs = data_eeg.info['sfreq']
    reject = dict(eeg=1000e-6)
    epochs = mne.Epochs(data_eeg,
                        data_evnt,
                        1,
                        tmin=-0.3,
                        tmax=np.ceil(mseq.size / fs) + 0.4,
                        reject=reject,
                        baseline=(-0.3, 0.))
Exemplo n.º 2
0
    eye_projsIAC = [Projs_IAC[0], Projs_IAC[1]]
    eye_projsITD = [Projs_ITD[0], Projs_ITD[1]]
elif Subject == 'S207':
    eye_projsIAC = [Projs_IAC[0]]  #,Projs_IAC[2]]
    eye_projsITD = [Projs_ITD[0]]  #,Projs_ITD[2]]
elif Subject == 'S205':
    eye_projsIAC = [Projs_IAC[0], Projs_IAC[2]]
    eye_projsITD = [Projs_ITD[0], Projs_ITD[2]]
elif Subject == 'S001':
    eye_projsIAC = [Projs_IAC[0], Projs_IAC[2]]
    eye_projsITD = [Projs_ITD[0], Projs_ITD[2]]
elif Subject == 'S208':
    eye_projsIAC = [Projs_IAC[0], Projs_IAC[2]]
    eye_projsITD = [Projs_ITD[0], Projs_ITD[2]]

IAC_eeg.add_proj(eye_projsIAC)
IAC_eeg.plot_projs_topomap()
# IAC_eeg.plot(events=blinks_IAC,scalings=scalings,show_options=True,title = 'IACt')
ITD_eeg.add_proj(eye_projsITD)
ITD_eeg.plot_projs_topomap()

#%% Epoch

rand_IAC_pts = np.zeros((300, 3), dtype=int)
rand_ITD_pts = np.zeros((300, 3), dtype=int)
for r in np.arange(295):
    rand_IAC_pts[r, :] = [
        int(random.randint(IAC_evnt[0, 0], int(IAC_evnt[-1, 0]))),
        int(0),
        int(2)
    ]
Exemplo n.º 3
0
blink_epochs = mne.Epochs(data_eeg,
                          blinks,
                          998,
                          tmin=-0.25,
                          tmax=0.25,
                          proj=False,
                          baseline=(-0.25, 0),
                          reject=dict(eeg=500e-6))
Projs = compute_proj_epochs(blink_epochs,
                            n_grad=0,
                            n_mag=0,
                            n_eeg=8,
                            verbose='DEBUG')
blink_proj = Projs[0]

data_eeg.add_proj(blink_proj)
data_eeg.plot_projs_topomap()

#%% Plot data

epoch_data = mne.Epochs(data_eeg,
                        data_evnt, [1],
                        tmin=-0.3,
                        tmax=2.3,
                        reject=None,
                        baseline=(-0.2, 0.))
evkd_data = epoch_data.average()
evkd_data.plot(picks=[31], titles='AMmseq')

#%% Plot PSD
data_eeg.plot_psd(fmin=0,
Exemplo n.º 4
0
 blinks_eeg = find_blinks(data_eeg, ch_name = ['A1'], thresh = 100e-6,  l_trans_bandwidth=0.5, l_freq = 1.0) 
 scalings = dict(eeg=40e-6,stim=0.1)
 
 blink_epochs = mne.Epochs(data_eeg,blinks_eeg,998,tmin=-0.25,tmax=0.25,proj=False,
                       baseline=(-0.25,0),reject=dict(eeg=500e-6))
 
 Projs_data = compute_proj_epochs(blink_epochs, n_grad=0,n_mag=0,n_eeg=8,verbose='DEBUG')
 
 # data_eeg.add_proj(Projs_data)   
 # data_eeg.plot_projs_topomap()
 
 # if subject == 'S132':
 eye_projs = Projs_data[0]
 
 
 data_eeg.add_proj(eye_projs)
 data_eeg.plot_projs_topomap()
 plt.savefig(os.path.join(fig_path_blinkprojs,fig_name+'_blinkproj'),format=fig_format)
 if close_plots: plt.close()
 
 # data_eeg.plot(events=blinks_eeg,scalings=scalings,show_options=True)
 
 del Projs_data, blink_epochs, blinks_eeg, eye_projs
 
 # channels = [30,31,26,5,4,27]
 # channels = [25,23]
 channels = [30,31]
 vis_channels = [15,17]
 ylim_vals = [-3.5, 5]
 ts = -0.5
 te = 5
Exemplo n.º 5
0
data_eegBA.filter(l_freq=1,h_freq=40)

data_eegAB.info['bads'].append('A23')
data_eegBA.info['bads'].append('A23')


#%% Remove Blinks

blinks = find_blinks(data_eegAB,ch_name = ['A1'],thresh = 100e-6, l_trans_bandwidth = 0.5, l_freq =1.0)
blink_epochs = mne.Epochs(data_eegAB,blinks,998,tmin=-0.25,tmax=0.25,proj=False,
                              baseline=(-0.25,0),reject=dict(eeg=500e-6))
Projs = compute_proj_epochs(blink_epochs,n_grad=0,n_mag=0,n_eeg=8,verbose='DEBUG')

ocular_projs = [Projs[0]]

data_eegAB.add_proj(ocular_projs)
data_eegAB.plot_projs_topomap()
data_eegAB.plot(events=blinks,show_options=True)

blinks = find_blinks(data_eegBA,ch_name = ['A1'],thresh = 100e-6, l_trans_bandwidth = 0.5, l_freq =1.0)
blink_epochs = mne.Epochs(data_eegBA,blinks,998,tmin=-0.25,tmax=0.25,proj=False,
                              baseline=(-0.25,0),reject=dict(eeg=500e-6))
Projs = compute_proj_epochs(blink_epochs,n_grad=0,n_mag=0,n_eeg=8,verbose='DEBUG')

ocular_projs = [Projs[0]]

data_eegBA.add_proj(ocular_projs)
data_eegBA.plot_projs_topomap()
data_eegBA.plot(events=blinks,show_options=True)

#%% Plot Data
Exemplo n.º 6
0
refchans = ['EXG1','EXG2']
direct_IPDITD = '/media/ravinderjit/Data_Drive/EEGdata/Binaural/IPD_ITD/'

Bin_eeg, Bin_evnt = EEGconcatenateFolder(direct_IPDITD+Subject+'/',nchans,refchans)
Bin_eeg.filter(70,1500)

blinks = find_blinks(Bin_eeg, ch_name = ['A1'], thresh = 100e-6, l_trans_bandwidth=0.5,l_freq=1.0)
scalings = dict(eeg=40e-6)
blink_epochs = mne.Epochs(Bin_eeg,blinks,998,tmin=-0.25,tmax=0.25,proj=False,
                          baseline=(-0.25,0),reject=dict(eeg=500e-6))
Proj = compute_proj_epochs(blink_epochs,n_grad=0,n_mag=0,n_eeg=8,verbose='DEBUG')
#Bin_eeg.add_proj(Proj)
#Bin_eeg.plot_projs_topomap()

eye_projs = [Proj[0],Proj[2]]
Bin_eeg.add_proj(eye_projs)
Bin_eeg.plot_projs_topomap()
Bin_eeg.plot(events=blinks,scalings=scalings,show_options=True,title = 'IPD ITD')

channels = [31]

stimITD = mne.Epochs(Bin_eeg,Bin_evnt,1,tmin=-0.5,tmax=2.0)
stimITD = stimITD.average()
stimITD.plot(picks=channels,titles = 'ITD')

stimIPD =mne.Epochs(Bin_eeg,Bin_evnt,2,tmin=-0.5,tmax=2.0)
stimIPD = stimIPD.average()
stimIPD.plot(picks=channels,titles= 'IPD')

stimITD2 =mne.Epochs(Bin_eeg,Bin_evnt,3,tmin=-0.5,tmax=2.0)
stimITD2 = stimITD2.average()
IAC_eeg,IAC_evnt = EEGconcatenateFolder(direct_IAC+Subject+'/',nchans,refchans,exclude)
IAC_eeg.filter(1,1000)
IAC_eeg.info['bads'].append('A27')

#%% blink removal
blinks_IAC = find_blinks(IAC_eeg, ch_name = ['A1'], thresh = 100e-6,  l_trans_bandwidth=0.5, l_freq = 1.0) 
scalings = dict(eeg=40e-6)

blinkIAC_epochs = mne.Epochs(IAC_eeg,blinks_IAC,998,tmin=-0.25,tmax=0.25,proj=False,
                          baseline=(-0.25,0),reject=dict(eeg=500e-6))
Projs_IAC = compute_proj_epochs(blinkIAC_epochs, n_grad=0,n_mag=0,n_eeg=8,verbose='DEBUG')


eye_projsIAC = [Projs_IAC[0],Projs_IAC[1]]
IAC_eeg.add_proj(eye_projsIAC)

IAC_eeg.plot_projs_topomap()
IAC_eeg.plot(show_options=True)

#%% epoch

IAC_epochs = mne.Epochs(IAC_eeg,IAC_evnt,1,tmin=-0.5,tmax=14,proj=True,baseline=(-0.2, 0.),reject=None)
IAC_evoked = IAC_epochs.average()
IAC_evoked.plot(titles ='IACt_evoked')

#%% Extract epochs when stim is on
t = IAC_epochs.times
fs = IAC_epochs.info['sfreq']
t1 = np.where(t>=0)[0][0]
t2 = t1 + Mseq.size + int(np.round(0.4*fs))
Exemplo n.º 8
0
                          tmin=-0.25,
                          tmax=0.25,
                          proj=False,
                          baseline=(-0.25, 0),
                          reject=dict(eeg=500e-6))

_Projs = compute_proj_epochs(blink_epochs,
                             n_grad=0,
                             n_mag=0,
                             n_eeg=8,
                             verbose='DEBUG')

ocular_projs = [_Projs[0], _Projs[2]]

scalings = dict(eeg=40e-6)
sentEEG.add_proj(ocular_projs)
sentEEG.plot_projs_topomap()
sentEEG.plot(events=blinks, scalings=scalings, show_options=True)

#%% evoked responses

evkd = []

epochs1 = mne.Epochs(sentEEG,
                     sent_evnt,
                     1,
                     tmin=-0.5,
                     tmax=2.5,
                     reject=dict(eeg=150e-6))
epochs2 = mne.Epochs(sentEEG,
                     sent_evnt,