Skip to content

Instantly share code, notes, and snippets.

@petervelosy
Created July 11, 2021 23:43
Show Gist options
  • Save petervelosy/bdd054a5e3e15ac909eb66a8f6ef5726 to your computer and use it in GitHub Desktop.
Save petervelosy/bdd054a5e3e15ac909eb66a8f6ef5726 to your computer and use it in GitHub Desktop.
Load the movement imagery dataset into MNE
import mne
from mne.io import RawArray
from mne.channels import make_dig_montage
events = np.vstack((dat0_mov['t_on'].astype(int), np.zeros(dat0_mov['t_on'].size).astype(int)))
events = np.vstack((events, dat0_mov['stim_id'].astype(int))).T
elec_indexes_str = [str(ch) for ch in elec_indexes]
locs_dict = dict(zip(elec_indexes_str, dat0_mov['mni_locs'] / 1000))
montage = make_dig_montage(locs_dict, coord_frame='mni_tal')
info = mne.create_info(elec_indexes_str, 1000, 'ecog')
info.set_montage(montage)
raw = RawArray(dat1['V'].T, info)
epoch_length = 2 # seconds
epochs_hand = mne.Epochs(raw, events, event_id=12,
tmin=0, tmax=2, baseline=None)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment