brainda.datasets package

Submodules

brainda.datasets.alex_mi module

brainda.datasets.base module

Basic elements to describe a BCI dataset.

Modified from https://github.com/NeuroTechX/moabb

class brainda.datasets.base.BaseDataset(dataset_code: str, subjects: List[Union[int, str]], events: Dict[str, Tuple[Union[int, str], Tuple[float, float]]], channels: List[str], srate: Union[float, int], paradigm: str)

Bases: object

BaseDataset for all datasets.

abstract data_path(subject: Union[str, int], path: Optional[Union[str, Path]] = None, force_update: bool = False, update_path: Optional[bool] = None, proxies: Optional[Dict[str, str]] = None, verbose: Optional[Union[bool, str, int]] = None) List[List[Union[str, Path]]]

Get path to local copy of a subject data.

Parameters:
  • subject (Union[str, int]) – subject id

  • path (Optional[Union[str, Path]], optional) – Location of where to look for the data storing location. If None, the environment variable or config parameter MNE_DATASETS_(dataset_code)_PATH is used. If it doesn’t exist, the “~/mne_data” directory is used. If the dataset is not found under the given path, the data will be automatically downloaded to the specified folder, by default None

  • force_update (bool, optional) – force update of the dataset even if a local copy exists, by default False

  • update_path (Optional[bool], optional) – If True, set the MNE_DATASETS_(dataset)_PATH in mne-python config to the given path. If None, the user is prompted, by default None

  • proxies (Optional[Union[bool, str, int]], optional) – proxies if needed

  • verbose (Optional[Union[bool, str, int]], optional) – [description], by default None

Returns:

local path of a subject data, the first list is session and the second list is run

Return type:

List[List[Union[str, Path]]]

download_all(path: Optional[Union[str, Path]] = None, force_update: bool = False, proxies: Optional[Dict[str, str]] = None, verbose: Optional[Union[bool, str, int]] = None)

Download all files.

Parameters:
  • path (Optional[Union[str, Path]], optional) – Location of where to look for the data storing location. If None, the environment variable or config parameter MNE_DATASETS_(dataset_code)_PATH is used. If it doesn’t exist, the “~/mne_data” directory is used. If the dataset is not found under the given path, the data will be automatically downloaded to the specified folder, by default None

  • force_update (bool, optional) – force update of the dataset even if a local copy exists, by default False

  • proxies (Optional[Union[bool, str, int]], optional) – proxies if needed

  • verbose (Optional[Union[bool, str, int]], optional) – [description], by default None

get_data(subjects: List[Union[int, str]], verbose: Optional[Union[bool, str, int]] = None) Dict[Union[int, str], Dict[str, Dict[str, Raw]]]

Get raw data.

Parameters:

subjects (List[Union[int, str]]) – subjects whose data should be returned

Returns:

returned raw ata, structured as {

subject_id: {‘sessio_id’: {‘run_id’: Raw}}

}

Return type:

Dict[Union[int, str], Dict[str, Dict[str, Raw]]]

Raises:

ValueError – raise error if a subject is not valid

brainda.datasets.bnci module

Brain/Neuro Computer Interface (BNCI) datasets.

class brainda.datasets.bnci.BNCI2014001

Bases: BaseDataset

BNCI 2014-001 Motor Imagery dataset.

Dataset IIa from BCI Competition 4 [1]_.

Dataset Description

This data set consists of EEG data from 9 subjects. The cue-based BCI paradigm consisted of four different motor imagery tasks, namely the imag- ination of movement of the left hand (class 1), right hand (class 2), both feet (class 3), and tongue (class 4). Two sessions on different days were recorded for each subject. Each session is comprised of 6 runs separated by short breaks. One run consists of 48 trials (12 for each of the four possible classes), yielding a total of 288 trials per session.

The subjects were sitting in a comfortable armchair in front of a computer screen. At the beginning of a trial ( t = 0 s), a fixation cross appeared on the black screen. In addition, a short acoustic warning tone was presented. After two seconds ( t = 2 s), a cue in the form of an arrow pointing either to the left, right, down or up (corresponding to one of the four classes left hand, right hand, foot or tongue) appeared and stayed on the screen for 1.25 s. This prompted the subjects to perform the desired motor imagery task. No feedback was provided. The subjects were ask to carry out the motor imagery task until the fixation cross disappeared from the screen at t = 6 s.

Twenty-two Ag/AgCl electrodes (with inter-electrode distances of 3.5 cm) were used to record the EEG; the montage is shown in Figure 3 left. All signals were recorded monopolarly with the left mastoid serving as reference and the right mastoid as ground. The signals were sampled with. 250 Hz and bandpass-filtered between 0.5 Hz and 100 Hz. The sensitivity of the amplifier was set to 100 μV . An additional 50 Hz notch filter was enabled to suppress line noise

References

data_path(subject: Union[str, int], path: Optional[Union[str, Path]] = None, force_update: bool = False, update_path: Optional[bool] = None, proxies: Optional[Dict[str, str]] = None, verbose: Optional[Union[bool, str, int]] = None) List[List[Union[str, Path]]]

Get path to local copy of a subject data.

Parameters:
  • subject (Union[str, int]) – subject id

  • path (Optional[Union[str, Path]], optional) – Location of where to look for the data storing location. If None, the environment variable or config parameter MNE_DATASETS_(dataset_code)_PATH is used. If it doesn’t exist, the “~/mne_data” directory is used. If the dataset is not found under the given path, the data will be automatically downloaded to the specified folder, by default None

  • force_update (bool, optional) – force update of the dataset even if a local copy exists, by default False

  • update_path (Optional[bool], optional) – If True, set the MNE_DATASETS_(dataset)_PATH in mne-python config to the given path. If None, the user is prompted, by default None

  • proxies (Optional[Union[bool, str, int]], optional) – proxies if needed

  • verbose (Optional[Union[bool, str, int]], optional) – [description], by default None

Returns:

local path of a subject data, the first list is session and the second list is run

Return type:

List[List[Union[str, Path]]]

class brainda.datasets.bnci.BNCI2014004

Bases: BaseDataset

BNCI 2014-004 Motor Imagery dataset.

Dataset B from BCI Competition 2008.

Dataset description

This data set consists of EEG data from 9 subjects of a study published in [1]_. The subjects were right-handed, had normal or corrected-to-normal vision and were paid for participating in the experiments. All volunteers were sitting in an armchair, watching a flat screen monitor placed approximately 1 m away at eye level. For each subject 5 sessions are provided, whereby the first two sessions contain training data without feedback (screening), and the last three sessions were recorded with feedback.

Three bipolar recordings (C3, Cz, and C4) were recorded with a sampling frequency of 250 Hz.They were bandpass- filtered between 0.5 Hz and 100 Hz, and a notch filter at 50 Hz was enabled. The placement of the three bipolar recordings (large or small distances, more anterior or posterior) were slightly different for each subject (for more details see [1]). The electrode position Fz served as EEG ground. In addition to the EEG channels, the electrooculogram (EOG) was recorded with three monopolar electrodes.

The cue-based screening paradigm consisted of two classes, namely the motor imagery (MI) of left hand (class 1) and right hand (class 2). Each subject participated in two screening sessions without feedback recorded on two different days within two weeks. Each session consisted of six runs with ten trials each and two classes of imagery. This resulted in 20 trials per run and 120 trials per session. Data of 120 repetitions of each MI class were available for each person in total. Prior to the first motor im- agery training the subject executed and imagined different movements for each body part and selected the one which they could imagine best (e. g., squeezing a ball or pulling a brake).

Each trial started with a fixation cross and an additional short acoustic warning tone (1 kHz, 70 ms). Some seconds later a visual cue was presented for 1.25 seconds. Afterwards the subjects had to imagine the corresponding hand movement over a period of 4 seconds. Each trial was followed by a short break of at least 1.5 seconds. A randomized time of up to 1 second was added to the break to avoid adaptation

For the three online feedback sessions four runs with smiley feedback were recorded, whereby each run consisted of twenty trials for each type of motor imagery. At the beginning of each trial (second 0) the feedback (a gray smiley) was centered on the screen. At second 2, a short warning beep (1 kHz, 70 ms) was given. The cue was presented from second 3 to 7.5. At second 7.5 the screen went blank and a random interval between 1.0 and 2.0 seconds was added to the trial.

References

data_path(subject: Union[str, int], path: Optional[Union[str, Path]] = None, force_update: bool = False, update_path: Optional[bool] = None, proxies: Optional[Dict[str, str]] = None, verbose: Optional[Union[bool, str, int]] = None) List[List[Union[str, Path]]]

Get path to local copy of a subject data.

Parameters:
  • subject (Union[str, int]) – subject id

  • path (Optional[Union[str, Path]], optional) – Location of where to look for the data storing location. If None, the environment variable or config parameter MNE_DATASETS_(dataset_code)_PATH is used. If it doesn’t exist, the “~/mne_data” directory is used. If the dataset is not found under the given path, the data will be automatically downloaded to the specified folder, by default None

  • force_update (bool, optional) – force update of the dataset even if a local copy exists, by default False

  • update_path (Optional[bool], optional) – If True, set the MNE_DATASETS_(dataset)_PATH in mne-python config to the given path. If None, the user is prompted, by default None

  • proxies (Optional[Union[bool, str, int]], optional) – proxies if needed

  • verbose (Optional[Union[bool, str, int]], optional) – [description], by default None

Returns:

local path of a subject data, the first list is session and the second list is run

Return type:

List[List[Union[str, Path]]]

brainda.datasets.cbcic module

brainda.datasets.cho2017 module

GigaDb Motor imagery dataset.

class brainda.datasets.cho2017.Cho2017

Bases: BaseDataset

Motor Imagery dataset from Cho et al 2017.

Dataset from the paper [1]_.

Dataset Description

We conducted a BCI experiment for motor imagery movement (MI movement) of the left and right hands with 52 subjects (19 females, mean age ± SD age = 24.8 ± 3.86 years); Each subject took part in the same experiment, and subject ID was denoted and indexed as s1, s2, …, s52. Subjects s20 and s33 were both-handed, and the other 50 subjects were right-handed.

EEG data were collected using 64 Ag/AgCl active electrodes. A 64-channel montage based on the international 10-10 system was used to record the EEG signals with 512 Hz sampling rates. The EEG device used in this experiment was the Biosemi ActiveTwo system. The BCI2000 system 3.0.2 was used to collect EEG data and present instructions (left hand or right hand MI). Furthermore, we recorded EMG as well as EEG simultaneously with the same system and sampling rate to check actual hand movements. Two EMG electrodes were attached to the flexor digitorum profundus and extensor digitorum on each arm.

Subjects were asked to imagine the hand movement depending on the instruction given. Five or six runs were performed during the MI experiment. After each run, we calculated the classification accuracy over one run and gave the subject feedback to increase motivation. Between each run, a maximum 4-minute break was given depending on the subject’s demands.

References

data_path(subject: Union[str, int], path: Optional[Union[str, Path]] = None, force_update: bool = False, update_path: Optional[bool] = None, proxies: Optional[Dict[str, str]] = None, verbose: Optional[Union[bool, str, int]] = None) List[List[Union[str, Path]]]

Get path to local copy of a subject data.

Parameters:
  • subject (Union[str, int]) – subject id

  • path (Optional[Union[str, Path]], optional) – Location of where to look for the data storing location. If None, the environment variable or config parameter MNE_DATASETS_(dataset_code)_PATH is used. If it doesn’t exist, the “~/mne_data” directory is used. If the dataset is not found under the given path, the data will be automatically downloaded to the specified folder, by default None

  • force_update (bool, optional) – force update of the dataset even if a local copy exists, by default False

  • update_path (Optional[bool], optional) – If True, set the MNE_DATASETS_(dataset)_PATH in mne-python config to the given path. If None, the user is prompted, by default None

  • proxies (Optional[Union[bool, str, int]], optional) – proxies if needed

  • verbose (Optional[Union[bool, str, int]], optional) – [description], by default None

Returns:

local path of a subject data, the first list is session and the second list is run

Return type:

List[List[Union[str, Path]]]

brainda.datasets.munich2009 module

Munich MI dataset. Unkown channel names.

class brainda.datasets.munich2009.MunichMI

Bases: BaseDataset

Munich Motor Imagery dataset.

Motor imagery dataset from Grosse-Wentrup et al. 2009 [1]_.

A trial started with the central display of a white fixation cross. After 3 s, a white arrow was superimposed on the fixation cross, either pointing to the left or the right. Subjects were instructed to perform haptic motor imagery of the left or the right hand during display of the arrow, as indicated by the direction of the arrow. After another 7 s, the arrow was removed, indicating the end of the trial and start of the next trial. While subjects were explicitly instructed to perform haptic motor imagery with the specified hand, i.e., to imagine feeling instead of visualizing how their hands moved, the exact choice of which type of imaginary movement, i.e., moving the fingers up and down, gripping an object, etc., was left unspecified. A total of 150 trials per condition were carried out by each subject, with trials presented in pseudorandomized order.

Ten healthy subjects (S1–S10) participated in the experimental evaluation. Of these, two were females, eight were right handed, and their average age was 25.6 years with a standard deviation of 2.5 years. Subject S3 had already participated twice in a BCI experiment, while all other subjects were naive to BCIs. EEG was recorded at M=128 electrodes placed according to the extended 10–20 system. Data were recorded at 500 Hz with electrode Cz as reference. Four BrainAmp amplifiers were used for this purpose, using a temporal analog high-pass filter with a time constant of 10 s. The data were re-referenced to common average reference offline. Electrode impedances were below 10 kΩ for all electrodes and subjects at the beginning of each recording session. No trials were rejected and no artifact correction was performed. For each subject, the locations of the 128 electrodes were measured in three dimensions using a Zebris ultrasound tracking system and stored for further offline analysis.

References

data_path(subject: Union[str, int], path: Optional[Union[str, Path]] = None, force_update: bool = False, update_path: Optional[bool] = None, proxies: Optional[Dict[str, str]] = None, verbose: Optional[Union[bool, str, int]] = None) List[List[Union[str, Path]]]

Get path to local copy of a subject data.

Parameters:
  • subject (Union[str, int]) – subject id

  • path (Optional[Union[str, Path]], optional) – Location of where to look for the data storing location. If None, the environment variable or config parameter MNE_DATASETS_(dataset_code)_PATH is used. If it doesn’t exist, the “~/mne_data” directory is used. If the dataset is not found under the given path, the data will be automatically downloaded to the specified folder, by default None

  • force_update (bool, optional) – force update of the dataset even if a local copy exists, by default False

  • update_path (Optional[bool], optional) – If True, set the MNE_DATASETS_(dataset)_PATH in mne-python config to the given path. If None, the user is prompted, by default None

  • proxies (Optional[Union[bool, str, int]], optional) – proxies if needed

  • verbose (Optional[Union[bool, str, int]], optional) – [description], by default None

Returns:

local path of a subject data, the first list is session and the second list is run

Return type:

List[List[Union[str, Path]]]

brainda.datasets.nakanishi2015 module

Nakanishi SSVEP dataset.

class brainda.datasets.nakanishi2015.Nakanishi2015

Bases: BaseDataset

SSVEP Nakanishi 2015 dataset

This dataset contains 12-class joint frequency-phase modulated steady-state visual evoked potentials (SSVEPs) acquired from 10 subjects used to estimate an online performance of brain-computer interface (BCI) in the reference study [1]_.

References

“A Comparison Study of Canonical Correlation Analysis Based Methods for Detecting Steady-State Visual Evoked Potentials,” PLoS One, vol.10, no.10, e140703, 2015. http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0140703

data_path(subject: Union[str, int], path: Optional[Union[str, Path]] = None, force_update: bool = False, update_path: Optional[bool] = None, proxies: Optional[Dict[str, str]] = None, verbose: Optional[Union[bool, str, int]] = None) List[List[Union[str, Path]]]

Get path to local copy of a subject data.

Parameters:
  • subject (Union[str, int]) – subject id

  • path (Optional[Union[str, Path]], optional) – Location of where to look for the data storing location. If None, the environment variable or config parameter MNE_DATASETS_(dataset_code)_PATH is used. If it doesn’t exist, the “~/mne_data” directory is used. If the dataset is not found under the given path, the data will be automatically downloaded to the specified folder, by default None

  • force_update (bool, optional) – force update of the dataset even if a local copy exists, by default False

  • update_path (Optional[bool], optional) – If True, set the MNE_DATASETS_(dataset)_PATH in mne-python config to the given path. If None, the user is prompted, by default None

  • proxies (Optional[Union[bool, str, int]], optional) – proxies if needed

  • verbose (Optional[Union[bool, str, int]], optional) – [description], by default None

Returns:

local path of a subject data, the first list is session and the second list is run

Return type:

List[List[Union[str, Path]]]

get_freq(event: str)
get_phase(event: str)

brainda.datasets.physionet module

Physionet MI.

class brainda.datasets.physionet.BasePhysionet(paradigm: str, is_imagined: bool = True)

Bases: BaseDataset

Physionet Motor Imagery dataset.

Physionet MI dataset: https://physionet.org/pn4/eegmmidb/

This data set consists of over 1500 one- and two-minute EEG recordings, obtained from 109 volunteers.

Subjects performed different motor/imagery tasks while 64-channel EEG were recorded using the BCI2000 system (http://www.bci2000.org). Each subject performed 14 experimental runs: two one-minute baseline runs (one with eyes open, one with eyes closed), and three two-minute runs of each of the four following tasks:

  1. A target appears on either the left or the right side of the screen. The subject opens and closes the corresponding fist until the target disappears. Then the subject relaxes.

  2. A target appears on either the left or the right side of the screen. The subject imagines opening and closing the corresponding fist until the target disappears. Then the subject relaxes.

  3. A target appears on either the top or the bottom of the screen. The subject opens and closes either both fists (if the target is on top) or both feet (if the target is on the bottom) until the target disappears. Then the subject relaxes.

  4. A target appears on either the top or the bottom of the screen. The subject imagines opening and closing either both fists (if the target is on top) or both feet (if the target is on the bottom) until the target disappears. Then the subject relaxes.

Parameters:
  • imagined (bool (default True)) – if True, return runs corresponding to motor imagination.

  • executed (bool (default False)) – if True, return runs corresponding to motor execution.

References

data_path(subject: Union[str, int], path: Optional[Union[str, Path]] = None, force_update: bool = False, update_path: Optional[bool] = None, proxies: Optional[Dict[str, str]] = None, verbose: Optional[Union[bool, str, int]] = None) List[List[Union[str, Path]]]

Get path to local copy of a subject data.

Parameters:
  • subject (Union[str, int]) – subject id

  • path (Optional[Union[str, Path]], optional) – Location of where to look for the data storing location. If None, the environment variable or config parameter MNE_DATASETS_(dataset_code)_PATH is used. If it doesn’t exist, the “~/mne_data” directory is used. If the dataset is not found under the given path, the data will be automatically downloaded to the specified folder, by default None

  • force_update (bool, optional) – force update of the dataset even if a local copy exists, by default False

  • update_path (Optional[bool], optional) – If True, set the MNE_DATASETS_(dataset)_PATH in mne-python config to the given path. If None, the user is prompted, by default None

  • proxies (Optional[Union[bool, str, int]], optional) – proxies if needed

  • verbose (Optional[Union[bool, str, int]], optional) – [description], by default None

Returns:

local path of a subject data, the first list is session and the second list is run

Return type:

List[List[Union[str, Path]]]

raw_hook(raw: Raw, caches: dict, verbose=None)
class brainda.datasets.physionet.PhysionetME

Bases: BasePhysionet

class brainda.datasets.physionet.PhysionetMI

Bases: BasePhysionet

brainda.datasets.schirrmeister2017 module

High-gamma dataset.

class brainda.datasets.schirrmeister2017.BBCIDataset(filename, load_sensor_names=None)

Bases: object

Loader class for files created by saving BBCI files in matlab (make sure to save with ‘-v7.3’ in matlab, see https://de.mathworks.com/help/matlab/import_export/mat-file-versions.html#buk6i87 ) :param filename: :type filename: str :param load_sensor_names: Also speeds up loading if you only load some sensors.

None means load all sensors.

Parameters:
  • Schirrmeister (Copyright Robin) –

  • 2017

  • Jayaram (Altered by Vinay) –

  • 2018

static get_all_sensors(filename, pattern=None)

Get all sensors that exist in the given file.

Parameters:
  • filename (str) –

  • pattern (str, optional) – Only return those sensor names that match the given pattern.

Returns:

sensor_names – Sensor names that match the pattern or all sensor names in the file.

Return type:

list of str

load()
class brainda.datasets.schirrmeister2017.Schirrmeister2017

Bases: BaseDataset

High-gamma dataset discribed in Schirrmeister et al. 2017

Our “High-Gamma Dataset” is a 128-electrode dataset (of which we later only use 44 sensors covering the motor cortex, (see Section 2.7.1), obtained from 14 healthy subjects (6 female, 2 left-handed, age 27.2 ± 3.6 (mean ± std)) with roughly 1000 (963.1 ± 150.9, mean ± std) four-second trials of executed movements divided into 13 runs per subject. The four classes of movements were movements of either the left hand, the right hand, both feet, and rest (no movement, but same type of visual cue as for the other classes). The training set consists of the approx. 880 trials of all runs except the last two runs, the test set of the approx. 160 trials of the last 2 runs. This dataset was acquired in an EEG lab optimized for non-invasive detection of high- frequency movement-related EEG components (Ball et al., 2008; Darvas et al., 2010).

Depending on the direction of a gray arrow that was shown on black back- ground, the subjects had to repetitively clench their toes (downward arrow), perform sequential finger-tapping of their left (leftward arrow) or right (rightward arrow) hand, or relax (upward arrow). The movements were selected to require little proximal muscular activity while still being complex enough to keep subjects in- volved. Within the 4-s trials, the subjects performed the repetitive movements at their own pace, which had to be maintained as long as the arrow was showing. Per run, 80 arrows were displayed for 4 s each, with 3 to 4 s of continuous random inter-trial interval. The order of presentation was pseudo-randomized, with all four arrows being shown every four trials. Ideally 13 runs were performed to collect 260 trials of each movement and rest. The stimuli were presented and the data recorded with BCI2000 (Schalk et al., 2004). The experiment was approved by the ethical committee of the University of Freiburg.

References

neural networks for EEG decoding and visualization.” Human brain mapping 38.11 (2017): 5391-5420.

data_path(subject: Union[str, int], path: Optional[Union[str, Path]] = None, force_update: bool = False, update_path: Optional[bool] = None, proxies: Optional[Dict[str, str]] = None, verbose: Optional[Union[bool, str, int]] = None) List[List[Union[str, Path]]]

Get path to local copy of a subject data.

Parameters:
  • subject (Union[str, int]) – subject id

  • path (Optional[Union[str, Path]], optional) – Location of where to look for the data storing location. If None, the environment variable or config parameter MNE_DATASETS_(dataset_code)_PATH is used. If it doesn’t exist, the “~/mne_data” directory is used. If the dataset is not found under the given path, the data will be automatically downloaded to the specified folder, by default None

  • force_update (bool, optional) – force update of the dataset even if a local copy exists, by default False

  • update_path (Optional[bool], optional) – If True, set the MNE_DATASETS_(dataset)_PATH in mne-python config to the given path. If None, the user is prompted, by default None

  • proxies (Optional[Union[bool, str, int]], optional) – proxies if needed

  • verbose (Optional[Union[bool, str, int]], optional) – [description], by default None

Returns:

local path of a subject data, the first list is session and the second list is run

Return type:

List[List[Union[str, Path]]]

brainda.datasets.tsinghua module

Tsinghua BCI Lab.

class brainda.datasets.tsinghua.BETA

Bases: BaseDataset

BETA SSVEP dataset [1]_.

EEG data after preprocessing are store as a 4-way tensor, with a dimension of channel x time point x block x condition. Each trial comprises 0.5-s data before the event onset and 0.5-s data after the time window of 2 s or 3 s. For S1-S15, the time window is 2 s and the trial length is 3 s, whereas for S16-S70 the time window is 3 s and the trial length is 4 s. Additional details about the channel and condition information can be found in the following supplementary information.

Eight supplementary information is comprised of personal information, channel information, frequency and initial phase associated to each condition, SNR and sampling rate. The personal information contains age and gender of the subject. For the channel information, a location matrix (64 x 4) is provided, with the first column indicating channel index, the second column and third column indicating the degree and radius in polar coordinates, and the last column indicating channel name. The SNR information contains the mean narrow-band SNR and wide-band SNR matrix for each subject, calculated in (3) and (4), respectively. The initial phase is in radius.

3-100Hz bandpass filtering (eegfilt), downsampled to 250 Hz

References

data_path(subject: Union[str, int], path: Optional[Union[str, Path]] = None, force_update: bool = False, update_path: Optional[bool] = None, proxies: Optional[Dict[str, str]] = None, verbose: Optional[Union[bool, str, int]] = None) List[List[Union[str, Path]]]

Get path to local copy of a subject data.

Parameters:
  • subject (Union[str, int]) – subject id

  • path (Optional[Union[str, Path]], optional) – Location of where to look for the data storing location. If None, the environment variable or config parameter MNE_DATASETS_(dataset_code)_PATH is used. If it doesn’t exist, the “~/mne_data” directory is used. If the dataset is not found under the given path, the data will be automatically downloaded to the specified folder, by default None

  • force_update (bool, optional) – force update of the dataset even if a local copy exists, by default False

  • update_path (Optional[bool], optional) – If True, set the MNE_DATASETS_(dataset)_PATH in mne-python config to the given path. If None, the user is prompted, by default None

  • proxies (Optional[Union[bool, str, int]], optional) – proxies if needed

  • verbose (Optional[Union[bool, str, int]], optional) – [description], by default None

Returns:

local path of a subject data, the first list is session and the second list is run

Return type:

List[List[Union[str, Path]]]

get_freq(event: str)
get_phase(event: str)
class brainda.datasets.tsinghua.Wang2016

Bases: BaseDataset

SSVEP dataset from Yijun Wang.

This dataset gathered SSVEP-BCI recordings of 35 healthy subjects (17 females, aged 17-34 years, mean age: 22 years) focusing on 40 characters flickering at different frequencies (8-15.8 Hz with an interval of 0.2 Hz). For each subject, the experiment consisted of 6 blocks. Each block contained 40 trials corresponding to all 40 characters indicated in a random order. Each trial started with a visual cue (a red square) indicating a target stimulus. The cue appeared for 0.5 s on the screen. Subjects were asked to shift their gaze to the target as soon as possible within the cue duration. Following the cue offset, all stimuli started to flicker on the screen concurrently and lasted 5 s. After stimulus offset, the screen was blank for 0.5 s before the next trial began, which allowed the subjects to have short breaks between consecutive trials. Each trial lasted a total of 6 s. To facilitate visual fixation, a red triangle appeared below the flickering target during the stimulation period. In each block, subjects were asked to avoid eye blinks during the stimulation period. To avoid visual fatigue, there was a rest for several minutes between two consecutive blocks.

EEG data were acquired using a Synamps2 system (Neuroscan, Inc.) with a sampling rate of 1000 Hz. The amplifier frequency passband ranged from 0.15 Hz to 200 Hz. Sixty-four channels covered the whole scalp of the subject and were aligned according to the international 10-20 system. The ground was placed on midway between Fz and FPz. The reference was located on the vertex. Electrode impedances were kept below 10 KΩ. To remove the common power-line noise, a notch filter at 50 Hz was applied in data recording. Event triggers generated by the computer to the amplifier and recorded on an event channel synchronized to the EEG data.

The continuous EEG data was segmented into 6 s epochs (500 ms pre-stimulus, 5.5 s post-stimulus onset). The epochs were subsequently downsampled to 250 Hz. Thus each trial consisted of 1500 time points. Finally, these data were stored as double-precision floating-point values in MATLAB and were named as subject indices (i.e., S01.mat, …, S35.mat). For each file, the data loaded in MATLAB generate a 4-D matrix named ‘data’ with dimensions of [64, 1500, 40, 6]. The four dimensions indicate ‘Electrode index’, ‘Time points’, ‘Target index’, and ‘Block index’. The electrode positions were saved in a ‘64-channels.loc’ file. Six trials were available for each SSVEP frequency. Frequency and phase values for the 40 target indices were saved in a ‘Freq_Phase.mat’ file.

Information for all subjects was listed in a ‘Sub_info.txt’ file. For each subject, there are five factors including ‘Subject Index’, ‘Gender’, ‘Age’, ‘Handedness’, and ‘Group’. Subjects were divided into an ‘experienced’ group (eight subjects, S01-S08) and a ‘naive’ group (27 subjects, S09-S35) according to their experience in SSVEP-based BCIs.

Frequency Table 8 9 10 11 12 13 14 15 8.2 9.2 10.2 11.2 12.2 13.2 14.2 15.2 8.4 9.4 10.4 11.4 12.4 13.4 14.4 15.4 8.6 9.6 10.6 11.6 12.6 13.6 14.6 15.6 8.8 9.8 10.8 11.8 12.8 13.8 14.8 15.8

Notes

  1. sub5 is not available from the download url.

data_path(subject: Union[str, int], path: Optional[Union[str, Path]] = None, force_update: bool = False, update_path: Optional[bool] = None, proxies: Optional[Dict[str, str]] = None, verbose: Optional[Union[bool, str, int]] = None) List[List[Union[str, Path]]]

Get path to local copy of a subject data.

Parameters:
  • subject (Union[str, int]) – subject id

  • path (Optional[Union[str, Path]], optional) – Location of where to look for the data storing location. If None, the environment variable or config parameter MNE_DATASETS_(dataset_code)_PATH is used. If it doesn’t exist, the “~/mne_data” directory is used. If the dataset is not found under the given path, the data will be automatically downloaded to the specified folder, by default None

  • force_update (bool, optional) – force update of the dataset even if a local copy exists, by default False

  • update_path (Optional[bool], optional) – If True, set the MNE_DATASETS_(dataset)_PATH in mne-python config to the given path. If None, the user is prompted, by default None

  • proxies (Optional[Union[bool, str, int]], optional) – proxies if needed

  • verbose (Optional[Union[bool, str, int]], optional) – [description], by default None

Returns:

local path of a subject data, the first list is session and the second list is run

Return type:

List[List[Union[str, Path]]]

get_freq(event: str)
get_phase(event: str)

brainda.datasets.tunerl module

TUNERL Datasets

Weibo2014

class brainda.datasets.tunerl.Weibo2014

Bases: BaseDataset

Motor Imagery dataset from Weibo et al 2014.

Dataset from the article Evaluation of EEG oscillatory patterns and cognitive process during simple and compound limb motor imagery [1]_.

It contains data recorded on 10 subjects, with 60 electrodes.

This dataset was used to investigate the differences of the EEG patterns between simple limb motor imagery and compound limb motor imagery. Seven kinds of mental tasks have been designed, involving three tasks of simple limb motor imagery (left hand, right hand, feet), three tasks of compound limb motor imagery combining hand with hand/foot (both hands, left hand combined with right foot, right hand combined with left foot) and rest state.

At the beginning of each trial (8 seconds), a white circle appeared at the center of the monitor. After 2 seconds, a red circle (preparation cue) appeared for 1 second to remind the subjects of paying attention to the character indication next. Then red circle disappeared and character indication (‘Left Hand’, ‘Left Hand & Right Foot’, et al) was presented on the screen for 4 seconds, during which the participants were asked to perform kinesthetic motor imagery rather than a visual type of imagery while avoiding any muscle movement. After 7 seconds, ‘Rest’ was presented for 1 second before next trial (Fig. 1(a)). The experiments were divided into 9 sections, involving 8 sections consisting of 60 trials each for six kinds of MI tasks (10 trials for each MI task in one section) and one section consisting of 80 trials for rest state. The sequence of six MI tasks was randomized. Intersection break was about 5 to 10 minutes.

References

data_path(subject: Union[str, int], path: Optional[Union[str, Path]] = None, force_update: bool = False, update_path: Optional[bool] = None, proxies: Optional[Dict[str, str]] = None, verbose: Optional[Union[bool, str, int]] = None) List[List[Union[str, Path]]]

Get path to local copy of a subject data.

Parameters:
  • subject (Union[str, int]) – subject id

  • path (Optional[Union[str, Path]], optional) – Location of where to look for the data storing location. If None, the environment variable or config parameter MNE_DATASETS_(dataset_code)_PATH is used. If it doesn’t exist, the “~/mne_data” directory is used. If the dataset is not found under the given path, the data will be automatically downloaded to the specified folder, by default None

  • force_update (bool, optional) – force update of the dataset even if a local copy exists, by default False

  • update_path (Optional[bool], optional) – If True, set the MNE_DATASETS_(dataset)_PATH in mne-python config to the given path. If None, the user is prompted, by default None

  • proxies (Optional[Union[bool, str, int]], optional) – proxies if needed

  • verbose (Optional[Union[bool, str, int]], optional) – [description], by default None

Returns:

local path of a subject data, the first list is session and the second list is run

Return type:

List[List[Union[str, Path]]]

brainda.datasets.zhou2016 module

Zhou2016.

class brainda.datasets.zhou2016.Zhou2016

Bases: BaseDataset

Motor Imagery dataset from Zhou et al 2016.

Dataset from the article A Fully Automated Trial Selection Method for Optimization of Motor Imagery Based Brain-Computer Interface [1]_. This dataset contains data recorded on 4 subjects performing 3 type of motor imagery: left hand, right hand and feet.

Every subject went through three sessions, each of which contained two consecutive runs with several minutes inter-run breaks, and each run comprised 75 trials (25 trials per class). The intervals between two sessions varied from several days to several months.

A trial started by a short beep indicating 1 s preparation time, and followed by a red arrow pointing randomly to three directions (left, right, or bottom) lasting for 5 s and then presented a black screen for 4 s. The subject was instructed to immediately perform the imagination tasks of the left hand, right hand or foot movement respectively according to the cue direction, and try to relax during the black screen.

References

data_path(subject: Union[str, int], path: Optional[Union[str, Path]] = None, force_update: bool = False, update_path: Optional[bool] = None, proxies: Optional[Dict[str, str]] = None, verbose: Optional[Union[bool, str, int]] = None) List[List[Union[str, Path]]]

Get path to local copy of a subject data.

Parameters:
  • subject (Union[str, int]) – subject id

  • path (Optional[Union[str, Path]], optional) – Location of where to look for the data storing location. If None, the environment variable or config parameter MNE_DATASETS_(dataset_code)_PATH is used. If it doesn’t exist, the “~/mne_data” directory is used. If the dataset is not found under the given path, the data will be automatically downloaded to the specified folder, by default None

  • force_update (bool, optional) – force update of the dataset even if a local copy exists, by default False

  • update_path (Optional[bool], optional) – If True, set the MNE_DATASETS_(dataset)_PATH in mne-python config to the given path. If None, the user is prompted, by default None

  • proxies (Optional[Union[bool, str, int]], optional) – proxies if needed

  • verbose (Optional[Union[bool, str, int]], optional) – [description], by default None

Returns:

local path of a subject data, the first list is session and the second list is run

Return type:

List[List[Union[str, Path]]]

Module contents