Preprocessing of EEG data

to analyze the EEG data, we want to use the MNE template

import numpy as np
import mne
from mne.channels import make_standard_montage
from mne.io import read_raw_edf
from mne.viz import plot_events 
from mne import find_events
#check mne info
mne.sys_info()
#define path to data files
fname = "/mnt/c/Users/anna-/Desktop/HC"
#check general data attributes, here "s01" as example
data = read_raw_edf(fname + "/s01.edf")
data.info
#show electrode arrangement of gathered eeg data -> 19 electrodes according to 10-20-system
montage = make_standard_montage(kind="standard_1020")
data.set_montage(montage)
data.plot_sensors();
#show complete data of "s01", power for all frequencies over the whole time
data.plot_psd(average=True);
#show data of "s01" but only until 50 Hz 
data.plot_psd(average=True,fmax=50);
#show data of "s01" until 50 Hz but not as average but the signal for every single electrode 
data.plot_psd(average=False, fmax=50);
#show detailed signal for every channel over the whole time
%matplotlib notebook
data.plot(n_channels=19, scalings=dict(eeg=1e-4));
#filter data with bandpass filter between 0.5 and 45 Hz
raw = data
raw.load_data()
raw.filter(l_freq=0.5,h_freq=45.0,
filter_length='auto',
l_trans_bandwidth='auto',
h_trans_bandwidth='auto',
method='fir',
phase='zero',
fir_window='hamming',
fir_design='firwin')