(run, ch_names=None, ch_types=None, verbose=None)
return raw, event_id
Convert one run to raw.
Convert one run to raw.
Convert one run to raw .
def _convert_run(run, ch_names=None, ch_types=None, verbose=None):
    """Convert one run to raw."""
    # parse eeg data
    event_id = {}
    n_chan = run.X.shape[1]
    montage = make_standard_montage("standard_1005")
    eeg_data = 1e-6 * run.X
    sfreq = run.fs

    if not ch_names:
        ch_names = ["EEG%d" % ch for ch in range(1, n_chan + 1)]
        montage = None  # no montage

    if not ch_types:
        ch_types = ["eeg"] * n_chan

    trigger = np.zeros((len(eeg_data), 1))
    # some runs does not contains trials i.e baseline runs
    if len(run.trial) > 0:
        trigger[run.trial - 1, 0] = run.y
    else:
        return None, None

    eeg_data = np.c_[eeg_data, trigger]
    ch_names = ch_names + ["stim"]
    ch_types = ch_types + ["stim"]
    event_id = {ev: (ii + 1) for ii, ev in enumerate(run.classes)}
    info = create_info(ch_names=ch_names, ch_types=ch_types, sfreq=sfreq)
    raw = RawArray(data=eeg_data.T, info=info, verbose=verbose)
    raw.set_montage(montage)
    return raw, event_id
def _convert_run ( run , ch_names = None , ch_types = None , verbose = None ) : # parse eeg data event_id = { } n_chan = run . X . shape [ 1 ] montage = make_standard_montage ( "standard_1005" ) eeg_data = 1e-6 * run . X sfreq = run . fs if not ch_names : ch_names = [ "EEG%d" % ch for ch in range ( 1 , n_chan + 1 ) ] montage = None # no montage if not ch_types : ch_types = [ "eeg" ] * n_chan trigger = np . zeros ( ( len ( eeg_data ) , 1 ) ) # some runs does not contains trials i.e baseline runs if len ( run . trial ) > 0 : trigger [ run . trial - 1 , 0 ] = run . y else : return None , None eeg_data = np . c_ [ eeg_data , trigger ] ch_names = ch_names + [ "stim" ] ch_types = ch_types + [ "stim" ] event_id = { ev : ( ii + 1 ) for ii , ev in enumerate ( run . classes ) } info = create_info ( ch_names = ch_names , ch_types = ch_types , sfreq = sfreq ) raw = RawArray ( data = eeg_data . T , info = info , verbose = verbose ) raw . set_montage ( montage ) return raw , event_id