moabb.datasets.Liu2024#
- class moabb.datasets.Liu2024(break_events=False, instr_events=False, subjects=None, sessions=None, *, return_all_modalities=False, **kwargs)[source]#
Bases:
BaseDataset[source]Dataset Snapshot
Liu2024
EEG motor imagery dataset from 50 acute stroke patients performing left- and right-handed hand-grip imagination tasks. First open dataset addressing left- and right-handed motor imagery in acute stroke patients.
Motor Imagery, 2 classes (left_hand vs right_hand)
Class Labels: left_hand, right_hand
Citation & Impact
- Paper DOI10.1038/s41597-023-02787-8
- CitationsLoading…
- Public APICrossref | OpenAlex
- Page Views30d: 62 · all-time: 409#25 of 151 · Top 17% most viewedUpdated: 2026-03-20 UTC
HED Event TagsHED tagsSource: MOABB BIDS HED annotation mapping.
left_handSensory-eventAgent-actionright_handSensory-eventAgent-actionHED tree view
Tree · left_hand
├─ Sensory-event │ ├─ Experimental-stimulus │ └─ Visual-presentation └─ Agent-action └─ Imagine ├─ Move └─ Left └─ HandTree · right_hand
├─ Sensory-event │ ├─ Experimental-stimulus │ └─ Visual-presentation └─ Agent-action └─ Imagine ├─ Move └─ Right └─ HandChannel SummaryTotal channels29EEG29 (semi-dry Ag/AgCl)EOG2Montage10-10Sampling500 HzReferenceCPzNotch / line50 HzThis diagram is automatically generated from MOABB metadata. Please consult the original publication to confirm the experimental protocol details.
Dataset [1] from the study on motor imagery [2].
Dataset description This dataset includes data from 50 acute stroke patients (the time after stroke ranges from 1 day to 30 days) admitted to the stroke unit of Xuanwu Hospital of Capital Medical University. The patients included 39 males (78%) and 11 females (22%), aged between 31 and 77 years, with an average age of 56.70 years (SD = 10.57) Before the start of the experiment, the subject sat in a chair in a position as comfortable as possible with an EEG cap placed on their head; subjects were positioned approximately 80 cm away from a computer screen in front of them. The computer played audio instructions to the patient about the procedure. Each experiment lasted approximately 20 minutes, including preparation time and approximately 10 minutes of signal recording. Before the start of the MI experiment, the patients opened their eyes and closed their eyes for 1 minute each. The MI experiment was divided into 40 trials, and each trial took 8 seconds, which consisted of three stages (instruction, MI and break). In the instruction stage, patients were prompted to imagine grasping a spherical object with the left- or right-hand. In the MI stage, participants imagined performing this action, a video of gripping motion is played on the computer, which leads the patient imagine grabbing the ball. This video stays playing for 4 s. Patients only imagine one hand movement.In the break stage, participants were allowed to relax and rest. The MI experiments alternated between the left- and right-hand, and the patients moved onto the next stage of the experiment according to the instructions.
The EEG data were collected through a wireless multichannel EEG acquisition system (ZhenTec NT1, Xi’an ZhenTec Intelligence Technology Co., Ltd., China). The system includes an EEG cap, an EEG acquisition amplifier, a data receiver and host computer software. The EEG cap had electrodes placed according to the international 10-10 system, including 29 EEG recording electrodes and 2 electrooculography (EOG) electrodes. The reference electrode located at CPz position and the grounding electrode located at FPz position. All the EEG electrodes and grounding electrode are Ag/AgCl semi-dry EEG electrodes based on highly absorbable porous sponges that are dampened with 3% NaCl solution. The EOG electrodes are composed by Ag/AgCl electrodes and conductive adhesive hydrogel. The common-mode rejection ratio was 120 dB, the input impedance was 1 GΩ, the input noise was less than 0.4 μVrms, and the resolution was 24 bits. The acquisition impedance was less than or equal to 20 kΩ. The sampling frequency was 500 Hz.
References
[1]Liu, Haijie; Lv, Xiaodong (2022). EEG datasets of stroke patients. figshare. Dataset. DOI: https://doi.org/10.6084/m9.figshare.21679035.v5
[2]Liu, Haijie, Wei, P., Wang, H. et al. An EEG motor imagery dataset for brain computer interface in acute stroke patients. Sci Data 11, 131 (2024). DOI: https://doi.org/10.1038/s41597-023-02787-8
from moabb.datasets import Liu2024 dataset = Liu2024() data = dataset.get_data(subjects=[1]) print(data[1])
Dataset summary
#Subj
50
#Chan
29
#Classes
2
#Trials / class
20
Trials length
4 s
Freq
500 Hz
#Sessions
1
#Runs
1
Total_trials
2000
Participants
Population: acute stroke patients
Clinical population: acute stroke patients (1-30 days post-stroke)
Age: 56.7 (range: 31-77) years
Equipment
Amplifier: ZhenTec NT1 wireless multichannel EEG acquisition system
Electrodes: semi-dry Ag/AgCl
Montage: 10-10
Reference: CPz
Preprocessing
Data state: preprocessed
Bandpass filter: 0.5-40 Hz
Steps: baseline removal (mean removal method), FIR filtering (0.5-40 Hz)
Notes: Preprocessed with EEGLAB toolbox in MATLAB R2019b. Filtered data split into trials x channels x time-samples format by marker ‘1’. Some motion artifacts present in subjects 4, 5, 13, 14, 18, 24, 28, 33, 42, 43, 47, 48, 49.
Data Access
DOI: 10.1038/s41597-023-02787-8
Repository: Figshare
Experimental Protocol
Paradigm: imagery
Feedback: none
Stimulus: video and audio
Notes
To add the break and instruction events, set the break_events and instr_events parameters to True while instantiating the class.
Added in version 1.1.1.
- __init__(break_events=False, instr_events=False, subjects=None, sessions=None, *, return_all_modalities=False, **kwargs)[source]#
Initialize function for the BaseDataset.
- property all_subjects#
Full list of subjects available in this dataset (unfiltered).
- convert_to_bids(path=None, subjects=None, overwrite=False, format='EDF', verbose=None, generate_figures=False)[source]#
Convert the dataset to BIDS format.
Saves the raw EEG data in a BIDS-compliant directory structure. Unlike the caching mechanism (see
CacheConfig), the files produced here do not contain a processing-pipeline hash (desc-<hash>) in their names, making the output a clean, shareable BIDS dataset.- Parameters:
path (str | Path | None) – Directory under which the BIDS dataset will be written. If
Nonethe default MNE data directory is used (same default as the rest of MOABB).subjects (list of int | None) – Subject numbers to convert. If
None, all subjects insubject_listare converted.overwrite (bool) – If
True, existing BIDS files for a subject are removed before saving. Default isFalse.format (str) – The file format for the raw EEG data. Supported values are
"EDF"(default),"BrainVision", and"EEGLAB".verbose (str | None) – Verbosity level forwarded to MNE/MNE-BIDS.
generate_figures (bool) – If
True, generate interactive neural signature HTML figures in{bids_root}/derivatives/neural_signatures/. Requiresplotly(pip install moabb[interactive]). Default isFalse.
- Returns:
bids_root – Path to the root of the written BIDS dataset.
- Return type:
Examples
>>> from moabb.datasets import AlexMI >>> dataset = AlexMI() >>> bids_root = dataset.convert_to_bids(path='/tmp/bids', subjects=[1])
See also
CacheConfigCache configuration for
get_data().moabb.datasets.bids_interface.get_bids_rootReturn the BIDS root path.
Notes
Added in version 1.5.
- static create_event_array(raw: Any, event_category: ndarray, stim_values: set) ndarray[source]#
This method creates an event array based on the stimulus channel.
- Parameters:
raw (mne.io.Raw) – The raw data.
event_category (np.ndarray) – The event categories.
stim_values (set) – Set of STI channel values to select triggers for.
- Returns:
events – The created events array.
- Return type:
np.ndarray
- data_infos()[source]#
Returns the data paths of the electrodes and events information
This function downloads the necessary data files for electrodes and events from their respective URLs and returns their local file paths.
- Returns:
A tuple containing the local file paths to the channels, electrodes, and events information files.
- Return type:
- data_path(subject, path=None, force_update=False, update_path=None, verbose=None)[source]#
Return the data paths of a single subject.
- Parameters:
subject (int) – The subject number to fetch data for.
path (None | str) – Location of where to look for the data storing location. If None, the environment variable or config parameter MNE_(dataset) 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.
force_update (bool) – Force update of the dataset even if a local copy exists.
update_path (bool | None) – If True, set the MNE_DATASETS_(dataset)_PATH in mne-python config to the given path. If None, the user is prompted.
verbose (bool, str, int, or None) – If not None, override default verbose level (see mne.verbose()).
- Returns:
A list containing the path to the subject’s data file.
- Return type:
- download(subject_list=None, path=None, force_update=False, update_path=None, accept=False, verbose=None)[source]#
Download all data from the dataset.
This function is only useful to download all the dataset at once.
- Parameters:
subject_list (list of int | None) – List of subjects id to download, if None all subjects are downloaded.
path (None | str) – Location of where to look for the data storing location. If None, the environment variable or config parameter
MNE_DATASETS_(dataset)_PATHis 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.force_update (bool) – Force update of the dataset even if a local copy exists.
update_path (bool | None) – If True, set the MNE_DATASETS_(dataset)_PATH in mne-python config to the given path. If None, the user is prompted.
accept (bool) – Accept licence term to download the data, if any. Default: False
verbose (bool, str, int, or None) – If not None, override default verbose level (see
mne.verbose()).
- encoding(events_df: DataFrame) Tuple[array, Dict[int, str], set][source]#
Encode the columns ‘value’ and ‘trial_type’ into a single event type.
- Parameters:
events_df (pd.DataFrame) – DataFrame containing the events information.
- Returns:
np.ndarray – Array of encoded event types.
dict – Mapping from event codes to event names.
set – Set of STI channel values included in the encoding.
Notes
- The ‘trial_type’ variable can take the following values:
1 : Left hand
2 : Right hand
- The ‘value’ variable can take the following values:
1 : instructions
2 : MI
3 : break
- get_additional_metadata(subject: str, session: str, run: str) None | DataFrame[source]#
Load additional metadata for a specific subject, session, and run.
This method is intended to be overridden by subclasses to provide additional metadata specific to the dataset. The metadata is typically loaded from an events.tsv file or similar data source.
- get_block_repetition(paradigm, subjects, block_list, repetition_list)[source]#
Select data for all provided subjects, blocks and repetitions.
subject -> session -> run -> block -> repetition
See also
BaseDataset.get_data
- get_data(subjects=None, cache_config=None, process_pipeline=None)[source]#
Return the data corresponding to a list of subjects.
The returned data is a dictionary with the following structure:
data = {'subject_id' : {'session_id': {'run_id': run} } }
subjects are on top, then we have sessions, then runs. A sessions is a recording done in a single day, without removing the EEG cap. A session is constitued of at least one run. A run is a single contiguous recording. Some dataset break session in multiple runs.
Processing steps can optionally be applied to the data using the
*_pipelinearguments. These pipelines are applied in the following order:raw_pipeline->epochs_pipeline->array_pipeline. If a*_pipelineargument isNone, the step will be skipped. Therefore, thearray_pipelinemay either receive amne.io.Rawor amne.Epochsobject as input depending on whetherepochs_pipelineisNoneor not.- Parameters:
subjects (List of int) – List of subject number
cache_config (dict | CacheConfig) – Configuration for caching of datasets. See
CacheConfigfor details.process_pipeline (Pipeline | None) – Optional processing pipeline to apply to the data. To generate an adequate pipeline, we recommend using
moabb.utils.make_process_pipelines(). This pipeline will receivemne.io.BaseRawobjects. The steps names of this pipeline should be elements ofStepType. According to their name, the steps should either return amne.io.BaseRaw, amne.Epochs, or anumpy.ndarray(). This pipeline must be “fixed” because it will not be trained, i.e. no call tofitwill be made.
- Returns:
data – dict containing the raw data
- Return type:
Dict
- property metadata: DatasetMetadata | None[source]#
Return structured metadata for this dataset.
Returns the DatasetMetadata object from the centralized catalog, or None if metadata is not available for this dataset.
- Returns:
The metadata object containing acquisition parameters, participant demographics, experiment details, and documentation. Returns None if no metadata is registered for this dataset.
- Return type:
DatasetMetadata | None
Examples
>>> from moabb.datasets import BNCI2014_001 >>> dataset = BNCI2014_001() >>> dataset.metadata.participants.n_subjects 9 >>> dataset.metadata.acquisition.sampling_rate 250.0