(
    subject,
    path=None,
    force_update=False,
    update_path=None,
    base_url=BNCI_URL,
    verbose=None,
)
return sessions
Load data for 003-2015 dataset.
Load data for 003-2015 dataset.
Load data for 003 - 2015 dataset .
def _load_data_003_2015(
    subject,
    path=None,
    force_update=False,
    update_path=None,
    base_url=BNCI_URL,
    verbose=None,
):
    """Load data for 003-2015 dataset."""
    if (subject < 1) or (subject > 10):
        raise ValueError("Subject must be between 1 and 12. Got %d." % subject)

    url = "{u}003-2015/s{s:d}.mat".format(u=base_url, s=subject)
    filename = data_path(url, path, force_update, update_path)[0]

    data = loadmat(filename, struct_as_record=False, squeeze_me=True)
    data = data["s%d" % subject]
    sfreq = 256.0

    ch_names = ["Fz", "Cz", "P3", "Pz", "P4", "PO7", "Oz", "PO8", "Target", "Flash"]

    ch_types = ["eeg"] * 8 + ["stim"] * 2
    montage = make_standard_montage("standard_1005")

    info = create_info(ch_names=ch_names, ch_types=ch_types, sfreq=sfreq)

    sessions = {}
    sessions["session_0"] = {}
    for ri, run in enumerate([data.train, data.test]):
        # flash events on the channel 9
        flashs = run[9:10]
        ix_flash = flashs[0] > 0
        flashs[0, ix_flash] += 2  # add 2 to avoid overlapp on event id
        flash_code = np.unique(flashs[0, ix_flash])

        if len(flash_code) == 36:
            # char mode
            evd = {"Char%d" % ii: (ii + 2) for ii in range(1, 37)}
        else:
            # row / column mode
            evd = {"Col%d" % ii: (ii + 2) for ii in range(1, 7)}
            evd.update({"Row%d" % ii: (ii + 8) for ii in range(1, 7)})

        # target events are on channel 10
        targets = np.zeros_like(flashs)
        targets[0, ix_flash] = run[10, ix_flash] + 1

        eeg_data = np.r_[run[1:-2] * 1e-6, targets, flashs]
        raw = RawArray(data=eeg_data, info=info, verbose=verbose)
        raw.set_montage(montage)
        sessions["session_0"]["run_" + str(ri)] = raw

    return sessions
def _load_data_003_2015 ( subject , path = None , force_update = False , update_path = None , base_url = BNCI_URL , verbose = None , ) : if ( subject < 1 ) or ( subject > 10 ) : raise ValueError ( "Subject must be between 1 and 12. Got %d." % subject ) url = "{u}003-2015/s{s:d}.mat" . format ( u = base_url , s = subject ) filename = data_path ( url , path , force_update , update_path ) [ 0 ] data = loadmat ( filename , struct_as_record = False , squeeze_me = True ) data = data [ "s%d" % subject ] sfreq = 256.0 ch_names = [ "Fz" , "Cz" , "P3" , "Pz" , "P4" , "PO7" , "Oz" , "PO8" , "Target" , "Flash" ] ch_types = [ "eeg" ] * 8 + [ "stim" ] * 2 montage = make_standard_montage ( "standard_1005" ) info = create_info ( ch_names = ch_names , ch_types = ch_types , sfreq = sfreq ) sessions = { } sessions [ "session_0" ] = { } for ri , run in enumerate ( [ data . train , data . test ] ) : # flash events on the channel 9 flashs = run [ 9 : 10 ] ix_flash = flashs [ 0 ] > 0 flashs [ 0 , ix_flash ] += 2 # add 2 to avoid overlapp on event id flash_code = np . unique ( flashs [ 0 , ix_flash ] ) if len ( flash_code ) == 36 : # char mode evd = { "Char%d" % ii : ( ii + 2 ) for ii in range ( 1 , 37 ) } else : # row / column mode evd = { "Col%d" % ii : ( ii + 2 ) for ii in range ( 1 , 7 ) } evd . update ( { "Row%d" % ii : ( ii + 8 ) for ii in range ( 1 , 7 ) } ) # target events are on channel 10 targets = np . zeros_like ( flashs ) targets [ 0 , ix_flash ] = run [ 10 , ix_flash ] + 1 eeg_data = np . r_ [ run [ 1 : - 2 ] * 1e-6 , targets , flashs ] raw = RawArray ( data = eeg_data , info = info , verbose = verbose ) raw . set_montage ( montage ) sessions [ "session_0" ] [ "run_" + str ( ri ) ] = raw return sessions