coco_pipe.io.load#
High-level data loading from a dataset configuration.
Author: Hamza Abdelhedi <hamza.abdelhedi@umontreal.ca>
Functions#
|
Load a dataset described by a configuration into a DataContainer. |
Module Contents#
- coco_pipe.io.load.load_data(config, *, subject_metadata_df=None, subject_key=None)#
Load a dataset described by a configuration into a DataContainer.
The configuration says what to load and how:
TabularConfigfor a feature table,BIDSConfigfor a BIDS M/EEG dataset andEmbeddingConfigfor an embedding file (read byload_embeddings(), its rows then averaged byaggregate_bywhen given), each validated when it is built. Only what a configuration cannot hold, tables, is passed here.- Parameters:
config (DatasetConfig or {Tabular,BIDS,Embedding}Config) – The dataset to load.
subject_metadata_df (DataFrame, optional) – BIDS and embeddings: subject-level metadata attached to each observation, in addition to
participants.tsv.subject_key (str, optional) – BIDS and embeddings: the column of subject_metadata_df holding the subject ID.
- Return type:
- Raises:
TypeError – If
configis not a dataset configuration, e.g. a path or a dict.
Examples
>>> from coco_pipe.io import BIDSConfig, TabularConfig, load_data >>> table = load_data(TabularConfig(path="features.csv", target_col="y")) >>> epochs = load_data( ... BIDSConfig(path="/data/bids", task="rest", window_length=2.0) ... )