Example #1
0
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)
Example #2
0
path_bip_bva = base_path + "BVAAlloEgo\\EEG\\Preprocessed\\prep_bipolar_250.mat"
path_events_bva = base_path + "BVAAlloEgo\\EEG\\Preprocessed\\p83_BVA.csv"

FREQUENCY = 250

pd_montage = readeegr.read_montage(path_montage)
pd_montage_referenced = readeegr.read_montage(path_montage_referenced)

# loading BVA data
#raw_original_bva = mneprep.load_raw(path_original_bva, FREQUENCY)
raw_perhead_bva = mneprep.load_raw(path_perhead_bva,
                                   FREQUENCY,
                                   montage=pd_montage_referenced)

pd_events = mneprep.load_matlab_events(path_events_bva)
mne_events_bva, mapp_bva = mneprep.pd_to_mne_events(pd_events, FREQUENCY)

## PICKS
pick_perhead_hip = mnehelp.picks_all_localised(raw_perhead_bva,
                                               pd_montage_referenced, 'Hip')
pick_perhead_hip_names = mne.pick_info(raw_perhead_bva.info,
                                       pick_perhead_hip)['ch_names']
pick_perhead_phg = mnehelp.picks_all_localised(raw_perhead_bva,
                                               pd_montage_referenced, 'PHG')
pick_perhead_phg_names = mne.pick_info(raw_perhead_bva.info,
                                       pick_perhead_phg)['ch_names']
pick_perhead_all = mnehelp.picks_all(raw_perhead_bva)

## Epoching
epochs_perhead_bva = mne.Epochs(raw_perhead_bva,
                                mne_events_bva,