-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnew_eog_regression.py
More file actions
32 lines (25 loc) · 1003 Bytes
/
new_eog_regression.py
File metadata and controls
32 lines (25 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import mne
from mne.preprocessing import EOGRegression
base_dir = '/Users/scottmcelroy/smm_code/A1_scz/A1_raw_data/organized_data/cond_D/TI001C40.bdf'
raw = mne.io.read_raw_bdf(base_dir)
raw.load_data()
# maybe use
raw.set_channel_types({'HEO1': 'eog', 'HEO2': 'eog', 'VEO1': 'eog', 'VEO2': 'eog',
'NOSE': 'misc', 'M1': 'misc', 'M2': 'misc', 'EXG8': 'misc'})
raw.set_eeg_reference(['NOSE'])
std_montage = mne.channels.make_standard_montage('biosemi64')
raw = raw.set_montage(std_montage, on_missing='warn')
n_time_samps = raw.n_times
time_secs = raw.times
ch_names = raw.ch_names
n_chan = len(ch_names)
raw.resample(1000)
# Bandpass and notch filtering data
filt = raw.copy().filter(1, 100)
filtered = filt.notch_filter(60)
filtered.plot_psd(fmax=100)
eog_evoked = mne.preprocessing.create_eog_epochs(raw).average(picks='all')
eog_evoked.apply_baseline((None, None))
eog_evoked.plot_joint()
projs, events = mne.preprocessing.compute_proj_eog(raw, average=True)
print(projs)