from functions import paths from functions import mne_analysis as mneanalysis # from mne.time_frequency import tfr_multitaper, tfr_stockwell, tfr_morlet base_path = 'E:/OneDrive/FGU/iEEG/Data' participant = 'p136' scalings = {'seeg': 1e2, 'ecg': 1e2, 'misc': 1e2} file_paths = paths.prep_unity_alloego_files(base_path, participant) # To reduce confounding noise artifacts, we used a bipolar referencing scheme # where by we identified all pairs of immediately adjacent electrodes and # calculated the voltage difference between both contacts in the pair. # The location of these new virtual electrodes was taken to be the midpoint # between the two physical contacts(inter-electrode spacing: 10 mm). eeg, montage = loader.load_eeg(file_paths, 'bipolar') pd_events = mneprep.load_preprocessed_events(file_paths) mne_events, events_mapp = mneprep.pd_to_mne_events(pd_events, eeg.info['sfreq']) # Preprocessing # To further reduce electrical line noise, a band-stop 4th order Butterworth # filter was applied at 58–62 Hz. To eliminate events contaminated by # epileptiform activity, we excluded time periods of interest if the # kurtosis of the voltage trace exceeded a threshold of 563. This in # the exclusion of an average of 7.1% ± 1.7% of experimental events. eeg.notch_filter(50) # Additionally, clinicians at each collaborating hospital identified which
import mne from functions import mne_prepping as mneprep from functions import mne_helpers as mnehelp from functions import mne_loading as loader from functions import paths base_path = 'E:/OneDrive/FGU/iEEG/Data' participant = 'p136' scalings = {'seeg': 1e2, 'ecg': 1e2, 'misc': 1e2} file_paths = paths.prep_unity_alloego_files(base_path, participant) eeg, montage = loader.load_eeg(file_paths, 'perElectrode') pd_events = mneprep.load_preprocessed_events(file_paths) mne_events, events_mapp = mneprep.pd_to_mne_events(pd_events, eeg.info['sfreq']) # Epoching epochs = mne.Epochs(eeg, mne_events, event_id=events_mapp, tmin=-3, tmax=3) epochs.plot(scalings=scalings) # PICKS pick_hip = mnehelp.picks_all_localised(eeg, montage, 'Hi') pick_perhead_all = mnehelp.picks_all(eeg, montage) pick_perhead_hip_names = mne.pick_info(eeg.info, pick_hip)['ch_names'] # Playing eeg.plot(scalings=scalings) eeg.plot_psd(fmax=100, picks=pick_hip, average=False)
from functions import mne_prepping as mneprep from functions import mne_loading as loader from functions import paths from mne.time_frequency import tfr_morlet # %% Setup base_path = 'E:/OneDrive/FGU/iEEG/Data' participant = 'p136' scalings = {'seeg': 5e2, 'ecg': 1e2, 'misc': 1e2} FULL_EPOCH_TIME = (-1.5, 1.5) file_paths = paths.prep_unity_alloego_files(base_path, participant) EEG_TYPE = 'perElectrode' # %% Raw eeg loading eeg, montage = loader.load_eeg(file_paths, EEG_TYPE) eeg.notch_filter(50) # %% Epoching pd_events = mneprep.load_preprocessed_events(file_paths) mne_events, events_mapp = mneprep.pd_to_mne_events(pd_events, eeg.info['sfreq']) epochs = mne.Epochs(eeg, mne_events, event_id=events_mapp, tmin=-5, tmax=5) # %% epoch visualisation and bad epoch removal epochs.plot(n_epochs=10, n_channels=25, scalings=scalings) append = '-' + EEG_TYPE mneprep.write_bad_epochs(epochs, file_paths, append=append) # %% Loading already selected