bids.variables.load_variables

load_variables(layout, types=None, levels=None, skip_empty=True, dataset=None, scope='all', regex_search=None, **kwargs)[source]

A convenience wrapper for one or more load_*_variables() calls.

Parameters:
  • layout (bids.layout.BIDSLayout) – BIDSLayout containing variable files.

  • types (str or list) – Types of variables to retrieve. All valid values reflect the filename stipulated in the BIDS spec for each kind of variable. Valid values include: ‘events’, ‘physio’, ‘stim’, ‘scans’, ‘participants’, ‘sessions’, and ‘regressors’.

  • levels (str or list) – Optional level(s) of variables to load. Valid values are ‘run’, ‘session’, ‘subject’, or ‘dataset’. This is simply a shorthand way to specify types–e.g., ‘run’ will be converted to types=[‘events’, ‘physio’, ‘stim’, ‘regressors’].

  • skip_empty (bool) – Whether or not to skip empty Variables (i.e., where there are no rows/records in a file after applying any filtering operations like dropping NaNs).

  • dataset (NodeIndex) – An existing NodeIndex container to store the loaded data in. Can be used to iteratively construct a dataset that contains otherwise heterogeneous sets of variables. If None, a new NodeIndex is used.

  • scope (str or list) – The scope of the space to search for variables. See docstring for BIDSLayout for details and valid predefined values.

  • kwargs (dict) – Optional keyword arguments to pass onto the individual load_*_variables() calls.

Return type:

A NodeIndex instance.

Examples

>>> load_variables(layout, ['events', 'physio'], subject='01')  
# returns all variables stored in _events.tsv and _physio.tsv.gz files
# for runs that belong to subject with id '01'.