Esempio n. 1
0
 # fig_path = os.path.abspath('/media/ravinderjit/Data_Drive/Data/Figures/BindingPilot/Monaural/'+subject)
 fig_path_blinkprojs = os.path.abspath('/media/ravinderjit/Data_Drive/Data/Figures/BindingPilot/BlinkProjections')
 
 
 if EEG_type =='Active':
      data_path = os.path.join(data_loc, 'Active', subject)
 else:
      data_path = os.path.join(data_loc, 'Passive', subject)    
   
 
 fig_name = subject+'_'+EEG_type
 title_base = subject+ ' ' + EEG_type + ' '
 
 exclude = ['EXG3','EXG4','EXG5','EXG6','EXG7','EXG8']; #don't need these extra external channels that are saved
 
 data_eeg,data_evnt = EEGconcatenateFolder(data_path+'/',nchans,refchans,exclude)
 data_eeg.filter(l_freq=2,h_freq=120)
 
 
 ## blink removal
 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()
 
from anlffr.spectral import mtplv

nchans = 34
refchans = ['EXG1', 'EXG2']

data_eeg = []
data_evnt = []

#data_loc = '/media/ravinderjit/Storage2/EEGdata'
data_loc = '/media/ravinderjit/Data_Drive/Data/EEGdata/Neural_CMR'
subject = 'S211_plus12dB'
exclude = ['EXG3', 'EXG4', 'EXG5', 'EXG6', 'EXG7', 'EXG8']

datapath = os.path.join(data_loc, subject)

data_eeg, data_evnt = EEGconcatenateFolder(datapath + '/', nchans, refchans,
                                           exclude)
data_eeg.filter(l_freq=1, h_freq=300)

#%% Blink Removal
blinks = find_blinks(data_eeg,
                     ch_name=['A1'],
                     thresh=100e-6,
                     l_trans_bandwidth=0.5,
                     l_freq=1.0,
                     h_freq=10)
blink_epochs = mne.Epochs(data_eeg,
                          blinks,
                          998,
                          tmin=-0.25,
                          tmax=0.25,
                          proj=False,
           'figOut':'\\Users\\racqu\\Documents\\Research\\Purdue\\HumanData\\Figs\\'} # define directories # define directories
read_data_params = {
    'nchans': 34,
    'refchans': ['EXG1', 'EXG2'],
    'exclude': ['EXG3', 'EXG4', 'EXG5', 'EXG6', 'EXG7', 'EXG8']
}

if not op.isdir(dir_dict['figOut']):
    mkdir(dir_dict['figOut'])
allFiles = glob(dir_dict['dataIn'] + '*.bdf')
plotYes = True
saveYes = False

# Loop through directories
#    raw, eves= bs.importbdf(fileVar, refchans=read_data_params['refchans'], exclude=read_data_params['exclude'])
raw, eves= EEGconcatenateFolder(dir_dict['dataIn'], nchans=read_data_params['nchans'], fs_new=4e3, \
                                refchans=read_data_params['refchans'], exclude=read_data_params['exclude'])
#    raw= mne.io.read_raw_edf(fileVar)
#    raw.load_data()
#    eves= mne.find_events(raw, shortest_event=1, mask=255)
#    raw.filter(70, 1e3, phase='zero') # Not needed here as mtspec/mtplv have filter params
epochs = mne.Epochs(raw,
                    eves,
                    1,
                    tmin=-0.1,
                    proj=False,
                    tmax=1.2,
                    baseline=(-0.1, 0.0),
                    picks=31,
                    reject=dict(eeg=200e-6))
evoked = epochs.average()
params = dict(Fs=raw.info['sfreq'], tapers=[1, 1], fpass=[70, 1000], itc=0)
Esempio n. 4
0
Mseq_loc = '/media/ravinderjit/Data_Drive/Data/EEGdata/TemporalCoding/mseqEEG_40_4096.mat'

Mseq_dat = sio.loadmat(Mseq_loc)
mseq = Mseq_dat['mseqEEG_4096']
mseq = mseq.astype(float)

#data_loc = '/media/ravinderjit/Storage2/EEGdata/'
data_loc = '/media/ravinderjit/Data_Drive/Data/EEGdata/TemporalCoding/AMFMmseq/'
subject = 'S211'

exclude = ['EXG3', 'EXG4', 'EXG5', 'EXG6', 'EXG7', 'EXG8']
#don't need these extra external channels that are saved

datapath = os.path.join(data_loc, subject)
# datapath = '/media/ravinderjit/Data_Drive/Data/EEGdata/EFR'
data_eeg, data_evnt = EEGconcatenateFolder(datapath + '/', nchans, refchans,
                                           exclude)
data_eeg.filter(l_freq=1, h_freq=80)

#%% Blink Removal
blinks = find_blinks(data_eeg,
                     ch_name=['A1'],
                     thresh=100e-6,
                     l_trans_bandwidth=0.5,
                     l_freq=1.0)
blink_epochs = mne.Epochs(data_eeg,
                          blinks,
                          998,
                          tmin=-0.25,
                          tmax=0.25,
                          proj=False,
                          baseline=(-0.25, 0),
Esempio n. 5
0
    data_sumMasker, _ = summ(data_masker_pos, data_masker_neg)
    return evoked_pos, evoked_neg, data_sumMasker, data_masker_diff, data_prob_diff, data_adpt_diff, numtrials_adpt


########################################################################################################################################################

froot = "C:\\Users\\racqu\\Documents\\Research\\Purdue\\HumanData\\AS\\SQ50\\"
fs = 16384

topchans = [31]  #CHANGE AS NEEDED

bdfname = froot + bdf

full_raw, full_eves = EEGconcatenateFolder(froot,
                                           nchans=34,
                                           refchans=['EXG1', 'EXG2'],
                                           exclude=[],
                                           fs_new=4e3)

event_id = {'Positive': 1}

epochs = mne.Epochs(full_raw,
                    full_eves,
                    event_id,
                    tmin=0.0,
                    tmax=1.5,
                    reject_tmax=1.3,
                    picks=31,
                    reject=dict(eeg=100e-6))
epochs.load_data()
epochs_filtered = epochs.filter(70, None)
import mne
#import os
import numpy as np
import spectralAnalysis as spA
from anlffr import spectral
import scipy.io as sio

folder = 'Q394_111620'
data_loc = '/media/ravinderjit/Storage2/ChinCap/SAM_noise/' + folder + '/SAM_'
pathThing = '/'
nchans = 37
# refchans = ['A1','A2','A3','A4','A5','A6','A7','A8','A9','A10','A11','A12','A13','A14','A15','A16','A17','A18','A19',
#             'A20','A21','A22','A23','A29','A30','A31','A32']
refchans = ['EXG1', 'EXG2']
exclude = ['EXG6', 'EXG7', 'EXG8']
data_AM5, evnts_AM5 = EEGconcatenateFolder(data_loc + '4' + pathThing, nchans,
                                           refchans, exclude)
data_AM5.filter(2, 40)
data_AM5.set_channel_types({'EXG4': 'eeg', 'EXG3': 'eeg', 'EXG5': 'eeg'})
#data_eeg.notch_filter(60)

#bad_chs = [0,5,8,9,16,24,25,26,27]
bad_chs = [23, 24, 25, 26, 27]
All_chs = np.arange(32)
channels = np.delete(All_chs, bad_chs)
bad_chs = [
    'A24', 'A25', 'A26', 'A27', 'A28', 'EXG1', 'EXG2', 'EXG3', 'EXG4', 'EXG5'
]
data_AM5.drop_channels(bad_chs)
data_AM5.set_eeg_reference(ref_channels='average')

scalings = dict(eeg=20e-6, stim=1)
Esempio n. 7
0



nchans = 34;
refchans = ['EXG1','EXG2']

Subjects = ['S211_ABAB','S211_BABA']

data_loc = '/media/ravinderjit/Data_Drive/Data/EEGdata/Binding_20tones/'
exclude = ['EXG3','EXG4','EXG5','EXG6','EXG7','EXG8']; #don't need these extra external channels that are saved
   
subject = Subjects[0]
datapath = os.path.join(data_loc,subject)

data_eegAB,data_evnt = EEGconcatenateFolder(datapath+'/',nchans,refchans,exclude)
data_eegAB.filter(l_freq=1,h_freq=40)

datapath = os.path.join(data_loc,Subjects[1])
data_eegBA, data_evnt = EEGconcatenateFolder(datapath+'/',nchans,refchans,exclude)
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))
Esempio n. 8
0
def bdf2mat(froot, fs, Fs_new, hpf, t_stim, topchans, trial_name):
    full_raw, full_eves = EEGconcatenateFolder(froot,
                                               nchans=34,
                                               refchans=['EXG1', 'EXG2'],
                                               exclude=[],
                                               fs_new=Fs_new)

    event_id = {'Positive': 1}

    epochs = mne.Epochs(full_raw,
                        full_eves,
                        event_id,
                        tmin=t_stim[0],
                        tmax=t_stim[1],
                        reject_tmax=1.3,
                        picks=topchans,
                        reject=dict(eeg=100e-6))
    epochs.load_data()
    epochs_filtered = epochs.filter(hpf, None)

    pos_data = epochs_filtered.get_data()

    event_id = {'Negative': 2}

    epochs = mne.Epochs(full_raw,
                        full_eves,
                        event_id,
                        tmin=t_stim[0],
                        tmax=t_stim[1],
                        reject_tmax=1.3,
                        picks=topchans,
                        reject=dict(eeg=100e-6))
    epochs.load_data()
    epochs_filtered = epochs.filter(hpf, None)

    neg_data = epochs_filtered.get_data()

    neg_l = len(neg_data)
    pos_l = len(pos_data)

    length = (neg_l >= pos_l) * pos_l + (neg_l < pos_l) * neg_l

    tot_arr = np.zeros(2 * length, dtype=np.object)

    ind = 0

    for i in range(0, length):

        tot_arr[ind] = pos_data[i]
        tot_arr[ind + 1] = neg_data[i]
        ind = ind + 2

    os.chdir(froot)
    savemat(trial_name + '_Data_full.mat',
            {(trial_name + '_tot_arr'): tot_arr})

    ###########################PLOT SPECTROGRAM/PLV####################################

    x = np.add(neg_data[:length, :, :], pos_data[:length, :, :])

    params = dict(Fs=4e3, tapers=[1, 1], fpass=[0, 1000], itc=0)

    S_psd, N_psd, f_psd = mtspec(x, params)
    mt_plv, f_plv = mtplv(x, params)

    fig, ax = plt.subplots(num=2, figsize=(12, 8))
    ax.plot(f_psd, np.subtract(S_psd, N_psd))
    #ax.plot(f_psd, N_psd)
    ax.grid(color='k', linestyle='-', linewidth=1)
    ax.set_xlabel('Freq (Hz)', fontsize=18)
    ax.set_ylabel('PSD', fontsize=18)
    ax.set_xlim([70., 500.])
    ax.set_title('psd all')

    fig, ax = plt.subplots(num=1, figsize=(12, 8))
    ax.plot(f_plv, mt_plv)
    #ax.plot(f_psd, N_psd)
    ax.grid(color='k', linestyle='-', linewidth=1)
    ax.set_xlabel('Freq (Hz)', fontsize=18)
    ax.set_ylabel('PLV', fontsize=18)
    ax.set_xlim([70., 500.])
    ax.set_title('PLV all')
Esempio n. 9
0
#import numpy as np
#import scipy as sp
import pylab as pl
import matplotlib.pyplot as plt
import scipy.io as sio
import mne
from anlffr.preproc import find_blinks
from EEGpp import EEGconcatenateFolder
from mne.preprocessing.ssp import compute_proj_epochs

Subject = 'Rav'
nchans = 34;
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')
Esempio n. 10
0
from EEGpp import EEGconcatenateFolder
import mne
from anlffr import spectral
import os
from scipy import linalg

#data_loc = r'H:\ChinCap\090720\'
data_loc = r'H:\ChinCap\082020\\'
data_loc = '/home/ravinderjit/Documents/ChinCapData/092320/'
stim_type = 'tone_4k_'  #'click_'  tone_4k_
pathThing = '/'
nchans = 34
refchans = ['A1', 'A2']
refchans = ['EXG1']
exclude = ['EXG3', 'EXG4', 'EXG5', 'EXG6', 'EXG7', 'EXG8']
data_eeg, data_evnt = EEGconcatenateFolder(
    data_loc + stim_type + '80' + pathThing, nchans, refchans, exclude)
data_eeg.filter(300, 3000)
#data_eeg.notch_filter(60)
scalings = dict(eeg=20e-6, stim=1)
#data_eeg.plot(events = data_evnt, scalings=scalings,show_options=True)
data_eeg.plot_psd(picks=[31, 32, 33])

epochs = mne.Epochs(data_eeg, data_evnt, [255], tmin=-0.005, tmax=0.01)
evoked_80 = epochs.average()

channels = list(range(24))
channels.extend([29, 30, 31])
channels.remove(21)
channels.remove(20)
channels.remove(0)
evoked_80.plot(picks=channels, titles='80')
Esempio n. 11
0
import numpy as np
from scipy.signal import periodogram 
from anlffr import spectral
import scipy.io as sio


folder = 'Chin_CMRrandMod_anesth/'
#data_loc = '/media/ravinderjit/Storage2/ChinCap/'
data_loc  = '/media/ravinderjit/Data_Drive/Data/ChinCap/'
#data_loc = '/home/ravinderjit/Documents/ChinCapData/'
nchans = 35
# refchans = ['A1','A2','A3','A4','A5','A6','A7','A8','A9','A10','A11','A12','A13','A14','A15','A16','A17','A18','A19',
#             'A20','A21','A22','A23','A29','A30','A31','A32']
refchans = ['EXG1','EXG2']
exclude = ['EXG4','EXG5','EXG6','EXG7','EXG8']
data_eeg,evnts_eeg = EEGconcatenateFolder(data_loc + folder ,nchans,refchans,exclude)
data_eeg.filter(1,300) 
data_eeg.set_channel_types({'EXG3':'eeg'})

bad_chs = ['A1','A25','A26','A27','A28','EXG3']#,'EXG1','EXG2','A20']
data_eeg.drop_channels(bad_chs)
#data_eeg.set_eeg_reference(ref_channels='average')

scalings = dict(eeg=20e-6,stim=1)
data_eeg.plot(events = evnts_eeg, scalings=scalings,show_options=True)

epochs_all = []
for m in np.arange(4):
    epochs_m = mne.Epochs(data_eeg,evnts_eeg,[m+1],tmin=-0.50,tmax=4.5,baseline=(-0.2,0))#,reject=dict(eeg=200e-6))
    evoked_m = epochs_m.average()
    evoked_m.plot(titles = str(m+1))
Esempio n. 12
0
#Corr_inds{7} = [1,4,7,10,13,16];
#Corr_inds{8} = 3:16;

nchans = 34
refchans = ['EXG1', 'EXG2']

data_eeg = []
data_evnt = []

#direct_ = '../../../Data/EEGdata/Binding/BindingPassivePilot'
direct_ = '/media/ravinderjit/Data_Drive/Dropbox/Lab/Data/EEGdata/Binding/BindingBehPilot'

exclude = ['EXG3', 'EXG4', 'EXG5', 'EXG6', 'EXG7', 'EXG8']
#don't need these extra external channels that are saved

data_eeg, data_evnt = EEGconcatenateFolder(direct_ + '/', nchans, refchans,
                                           exclude)
data_eeg.filter(l_freq=1, h_freq=100)

## blink removal
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,
Esempio n. 13
0

nchans = 34;
refchans = ['EXG1','EXG2']

data_eeg = [];
data_evnt = [];
    
direct_ = '/media/ravinderjit/Data_Drive/EEGdata/Binding/'


exclude = ['EXG3','EXG4','EXG5','EXG6','EXG7','EXG8']; #don't need these extra external channels that are saved



data_eeg,data_evnt = EEGconcatenateFolder(direct_+'/',nchans,refchans,exclude)
data_eeg.filter(l_freq=1,h_freq=130)


## blink removal
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()
  
Esempio n. 14
0
# Mseq = decimate(Mseq,2,axis=0)
#fix issues due to filtering from downsampling ... data is sampled at 2048
# Mseq[Mseq<0] = -1
# Mseq[Mseq>0] = 1

Subjects = [
    'S001', 'S132', 'S203', 'S204', 'S205', 'S206', 'S207', 'S208', 'S211'
]
Subject = 'S211'
exclude = ['EXG1', 'EXG2', 'EXG3', 'EXG4', 'EXG5', 'EXG6', 'EXG7', 'EXG8']

#%% Load data
# with open(os.path.join(data_loc, Subject+'_DynBin.pickle'),'rb') as f:
#     IAC_epochs, ITD_epochs = pickle.load(f)

IAC_eeg, IAC_evnt = EEGconcatenateFolder(direct_IAC + Subject + '/', nchans,
                                         refchans, exclude)
ITD_eeg, ITD_evnt = EEGconcatenateFolder(direct_ITD + Subject + '/', nchans,
                                         refchans, exclude)

IAC_eeg.filter(1, 1000)
ITD_eeg.filter(1, 1000)

#%% Blink removal
blinks_IAC = find_blinks(IAC_eeg,
                         ch_name=['A1'],
                         thresh=100e-6,
                         l_trans_bandwidth=0.5,
                         l_freq=1.0)
blinks_ITD = find_blinks(ITD_eeg,
                         ch_name=['A1'],
                         thresh=100e-6,

nchans = 34;
refchans = ['EXG1','EXG2']

data_eeg = [];
data_evnt = [];
  
#data_loc = '/media/ravinderjit/Storage2/EEGdata'
data_loc = '/media/ravinderjit/Data_Drive/Data/EEGdata/'
subject = 'CMR_TempCoherence'
exclude = ['EXG3','EXG4','EXG5','EXG6','EXG7','EXG8']

datapath = os.path.join(data_loc,subject)

data_eeg,data_evnt = EEGconcatenateFolder(datapath+'/',nchans,refchans,exclude)
data_eeg.filter(l_freq=1,h_freq=150)

#%% Blink Removal
blinks = find_blinks(data_eeg,ch_name = ['A1'],thresh = 100e-6, l_trans_bandwidth = 0.5, l_freq =1.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()
data_eeg.plot(events=data_evnt)

#%% Plot Data
Esempio n. 16
0
data_evnt = []

Mseq_loc = '/media/ravinderjit/Data_Drive/Stim_Analysis/Stimuli/TemporalCoding/Stim_Dev/mseqEEG_4096.mat'
Mseq_dat = sio.loadmat(Mseq_loc)
mseq = Mseq_dat['mseqEEG_4096']
mseq = mseq.astype(float)

data_loc = '/media/ravinderjit/Data_Drive/Data/EEGdata/TemporalCoding/AMmseq'
subject = 'S233'

exclude = ['EXG3', 'EXG4', 'EXG5', 'EXG6', 'EXG7', 'EXG8']
#don't need these extra external channels that are saved

datapath = os.path.join(data_loc, subject)
# datapath = '/media/ravinderjit/Data_Drive/Data/EEGdata/EFR'
data_eeg, data_evnt = EEGconcatenateFolder(datapath + '/', nchans, refchans,
                                           exclude)
data_eeg.filter(l_freq=1, h_freq=1500)

#%% Blink Removal
blinks = find_blinks(data_eeg,
                     ch_name=['A1'],
                     thresh=100e-6,
                     l_trans_bandwidth=0.5,
                     l_freq=1.0)
blink_epochs = mne.Epochs(data_eeg,
                          blinks,
                          998,
                          tmin=-0.25,
                          tmax=0.25,
                          proj=False,
                          baseline=(-0.25, 0),
import mne
#import os
import numpy as np
from scipy.signal import periodogram
from anlffr import spectral
import scipy.io as sio

folder = 'Chin_SAM_tmtf/'
#data_loc = '/media/ravinderjit/Storage2/ChinCap/'
data_loc = '/home/ravinderjit/Documents/ChinCapData/'
nchans = 35
# refchans = ['A1','A2','A3','A4','A5','A6','A7','A8','A9','A10','A11','A12','A13','A14','A15','A16','A17','A18','A19',
#             'A20','A21','A22','A23','A29','A30','A31','A32']
refchans = ['EXG1', 'EXG2']
exclude = ['EXG4', 'EXG5', 'EXG6', 'EXG7', 'EXG8']
data_eeg, evnts_eeg = EEGconcatenateFolder(data_loc + folder, nchans, refchans,
                                           exclude)
data_eeg.filter(5, 3500)
data_eeg.set_channel_types({'EXG3': 'eeg'})

AMf = [20, 30, 40, 55, 70, 90, 110, 170, 250, 400, 600, 800, 1000, 3000]
bad_chs = [
    'A1', 'A25', 'A26', 'A27', 'A28', 'EXG3', 'EXG1', 'EXG2', 'A20', 'A21',
    'A22', 'A30'
]
data_eeg.info['bads'] = bad_chs
#data_eeg.drop_channels(bad_chs)
data_eeg.set_eeg_reference(ref_channels='average')

scalings = dict(eeg=20e-6, stim=1)
data_eeg.plot(events=evnts_eeg, scalings=scalings, show_options=True)
Esempio n. 18
0
            os.path.join(pickle_active_loc,
                         subject + '_AMmseq10bits_Active.pickle'),
            'rb') as file:
        [t, Tot_trials, Ht, Htnf, info_obj, ch_picks] = pickle.load(file)

    A_Tot_trials_act.append(Tot_trials)

num_nfs = 5

for subject in Subjects:
    print('On Subject ................... ' + subject)

    #%% Load data and filter

    datapath = os.path.join(data_loc, subject)
    data_eeg, data_evnt = EEGconcatenateFolder(datapath + '/', nchans,
                                               refchans, exclude)
    data_eeg.filter(l_freq=1, h_freq=500)

    #%% Remove bad channels

    if subject == 'S207':
        data_eeg.info['bads'].append('A15')

    #%% Blink Removal
    blinks = find_blinks(data_eeg,
                         ch_name=['A1'],
                         thresh=100e-6,
                         l_trans_bandwidth=0.5,
                         l_freq=1.0)
    blink_epochs = mne.Epochs(data_eeg,
                              blinks,
import scipy.io as sio
import os
import pickle
import mne
from anlffr.preproc import find_blinks
from EEGpp import EEGconcatenateFolder
from mne.preprocessing.ssp import compute_proj_epochs

data_loc = '/media/ravinderjit/Data_Drive/Data/EEGdata/Sentences/'
subject = 'S211'

refchans = ['EXG1', 'EXG2']
nchans = 34
exclude = ['EXG3', 'EXG4', 'EXG5', 'EXG6', 'EXG7', 'EXG8']

sentEEG, sent_evnt = EEGconcatenateFolder(data_loc + subject + '/', nchans,
                                          refchans, exclude)

sentEEG.filter(1, 75)

blinks = find_blinks(sentEEG,
                     ch_name=['A1'],
                     thresh=100e-6,
                     l_trans_bandwidth=0.5,
                     l_freq=1.0)

blink_epochs = mne.Epochs(sentEEG,
                          blinks,
                          998,
                          tmin=-0.25,
                          tmax=0.25,
                          proj=False,