metabci.brainda.datasets.base module

Basic elements to describe a BCI dataset.

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

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

Bases: object

BaseDataset for all datasets.

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

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: str | Path | None = None, force_update: bool = False, proxies: Dict[str, str] | None = None, verbose: bool | str | int | None = None)[source]

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[str | int], verbose: bool | str | int | None = None) Dict[int | str, Dict[str, Dict[str, Raw]]][source]

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

class metabci.brainda.datasets.base.BaseTimeEncodingDataset(dataset_code: str, subjects: List[str | int], events: Dict[str, Tuple[int | str, Tuple[float, float]]], channels: List[str], srate: float | int, paradigm: str, minor_events: Dict[str, Tuple[int | str, Tuple[float, float]]], encode: Dict[str, List[str | int]], encode_loop: int)[source]

Bases: BaseDataset

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

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]]]