I’m still new in EEG, and I need advice about the strategy of working with available data. The main idea is to recognize whether a person is tired or not. My way of thinking was started from setting max and min frequency filters 8-15Hz because as I read the best for drowsiness detection is alpha waves. Then I applied ICA filters, which as personally I understood required for removing artifacts like eye blinking and so on (because we don’t have any other channels for the file only EEG). And now I’m not sure what to do then.
In the end I’m trying to understand whether a person is tired or now via EEG, so as I read from some papers I will need to classify my features of EEG, or what? Below you can see script which shows some of my results:
data_path = './'
vhdr_file_base_1 = os.path.join(data_path, 'S01_exp.vhdr')
raw = mne.io.read_raw_brainvision(vhdr_file_base_1, preload=True) # read raw data with mne
info = raw.info
raw.plot(clipping=None, scalings='auto')
raw.load_data()
montage = mne.channels.make_standard_montage("biosemi32")
for ch in range(0, 32):
mne.rename_channels(info, {info["ch_names"][ch]: montage.ch_names[ch]})
raw.set_montage('biosemi32', on_missing='ignore')
raw.filter(l_freq=1, h_freq=None) # High-pass filter above 1 Hz
raw.filter(l_freq=None, h_freq=40) # Low-pass filter below 40 Hz
raw.filter(l_freq=8, h_freq=30) # Band-pass filter between 8 and 30 Hz
raw.notch_filter(freqs=50) # Notch filter at 50 Hz (power line noise)
# The regression technique works regardless of chosen reference. However, it is
# important to choose a reference before proceeding with the analysis.
raw.set_eeg_reference("average")
# Removing slow drifts makes for more stable regression coefficients. Make sure
# to apply the same filter to both EEG and EOG channels!
raw.filter(0.3, 40)
# # set up and fit the ICA
ica = mne.preprocessing.ICA(n_components=20, random_state=97, max_iter=800)
ica.fit(raw)
ica.exclude = [1, 2] # details on how we picked these are omitted here
raw.plot()
raw.compute_psd(fmax=50).plot(picks="eeg", exclude="bads", amplitude=False)
raw.plot_psd()
raw.plot(duration=5, n_channels=30)
ica.plot_properties(raw, picks=ica.exclude)
method = 'fastica'
# Choose other parameters
n_components = 25 # if float, select n_components by explained variance of PCA
decim = 3 # we need sufficient statistics, not all time points -> saves time
random_state = 23
ica = ICA(n_components=n_components, method=method, random_state=random_state)
print(ica)
reject = dict(mag=5e-12, grad=4000e-13)
picks_meg = mne.pick_types(raw.info, meg=False, eeg=True, eog=False,
stim=False, exclude='bads')
ica.fit(raw, picks=picks_meg, decim=decim, reject=reject)
print(ica)
ica.plot_components()
ica.plot_sources(raw)
But maybe I’m wrong. In general the another idea was to convert the raw EEG data to numpy and compare with other available EEG files after the experiments, with possible analysis of alpha waves, but I’m not sure that this is very promissing direction.
It will be good when I will just have some understanding what to do next and the strategy in general, because now I’m little bit confused and also not sure whether all what I had done and think now are correct