Loading functions¶
These package is used to perform operation of reading and writing information about data you need to use.
The data must be organized in a standard way. `` experiment_folder/ – 0_results/ where analysis results will be placed – derivatives/ same as above (for compatibility with BIDS data format) – subjN/ single subject folder —- ``
sekupy.io.base module¶
- sekupy.io.base.add_attributes(ds, attr)[source]¶
Add sample attributes to the dataset.
This function adds additional sample attributes from a dictionary to the dataset’s sample attribute collection.
- Parameters:
ds (Dataset) – The dataset to add attributes to
attr (dict) – Dictionary containing attribute names as keys and attribute values as values
- Returns:
Dataset with additional sample attributes added
- Return type:
Dataset
- sekupy.io.base.add_events(ds)[source]¶
Add event information to the dataset.
This function extracts event information from the dataset’s targets and chunks attributes and adds event-related attributes.
- Parameters:
ds (Dataset) – The dataset to add event information to
- Returns:
Dataset with event information added to attributes
- Return type:
Dataset
- sekupy.io.base.add_filename(ds, fmri_list)[source]¶
Add filename information to dataset sample attributes.
This function adds file provenance information to each sample in the dataset, tracking which file each volume came from.
- Parameters:
ds (Dataset) – The dataset to add filename information to
fmri_list (list) – List of neuroimaging files (nibabel images)
- Returns:
Dataset with filename sample attribute added
- Return type:
Dataset
- sekupy.io.base.load_attributes(path, subj, task, **kwargs)[source]¶
Loads attribute files from path and selected subject.
- Parameters:
- Returns:
[description]
- Return type:
[type]
- Raises:
FileNotFoundError – [description]
- sekupy.io.base.load_dataset(path, subj, folder, **kwargs)[source]¶
Load a 2d dataset.
The function needs the image path, the subject and the main folder of the data.
- Parameters:
path (string) – specification of filepath to load
subj (string) – subject name (in general it specifies a subfolder under path)
folder (string) – subfolder under subject folder (in general is the experiment name)
kwargs (keyword arguments) – Keyword arguments to format-specific load
- Returns:
ds – Instance of
sekupy.dataset.base.Dataset- Return type:
Dataset
- sekupy.io.base.load_filelist(path, name, folder, **kwargs)[source]¶
Load file given the filename.
- Parameters:
path (string) – specification of filepath to load
name (string) – subject name (in general it specifies a subfolder under path)
folder (string) – subfolder under subject folder (in general is the experiment name)
kwargs (keyword arguments) – Keyword arguments to format-specific load
- Returns:
file_list – list of strings indicating the file pathname
- Return type:
string list
- sekupy.io.base.load_fmri(filelist)[source]¶
Load data specified in the file list as nibabel image.
- Parameters:
filelist (list) – List of pathnames specifying the location of image to be loaded
- Returns:
List of nibabel images.
- Return type:
fmri_list
Module contents¶
- sekupy.io.load_ds(conf_file, task, extra_sa=None, loader=<function load_dataset>, prepro=None, n_subjects=None, selected_subjects=None, **kwargs)[source]¶
This is function loads a PyMVPA dataset given the configuration file and a loader.
- Parameters:
conf_file (str) – Path of the configuration file (see more in
`sekupy.io.configuration.read_configuration`)task (str) – name of the task that is used, this should be contatined in configuration file
extra_sa (dictionary, optional) – set of extra sample attributes to be attached to the dataset, by default None
loader (function, optional) – The function used to load the data in a correct way, by default load_dataset
prepro (
`sekupy.preprocessing.Pipeline`object) – or list of`sekupy.preprocessing.Transformer`, optional Preprocessing pipeline to be performed at dataset-level, by default Nonen_subjects (int, optional) – number of subjects to be loaded, by default None
selected_subjects (list of string, optional) – name of the subjects to be loaded, by default None
- Returns:
The loaded dataset
- Return type:
`sekupy.dataset.base.Dataset`