bids.variables.entities.NodeIndex¶
-
class
NodeIndex
[source]¶ Represents the top level in a BIDS hierarchy.
Methods
add_variable
(self, variable)Adds a BIDSVariable to the current Node’s list.
get_collections
(self, unit[, names, merge, …])Retrieve variable data for a specified level in the Dataset.
get_or_create_node
(self, level, entities, …)Retrieves a child Node based on the specified criteria, creating a new Node if necessary.
get_nodes
Methods
__init__
(self)Initialize self.
add_variable
(self, variable)Adds a BIDSVariable to the current Node’s list.
get_collections
(self, unit[, names, merge, …])Retrieve variable data for a specified level in the Dataset.
get_nodes
(self[, level, entities, strict])get_or_create_node
(self, level, entities, …)Retrieves a child Node based on the specified criteria, creating a new Node if necessary.
-
add_variable
(self, variable)¶ Adds a BIDSVariable to the current Node’s list.
- Parameters
variable (BIDSVariable) – The Variable to add to the list.
-
get_collections
(self, unit, names=None, merge=False, sampling_rate=None, **entities)[source]¶ Retrieve variable data for a specified level in the Dataset.
- Parameters
unit (str) – The unit of analysis to return variables for. Must be one of ‘run’, ‘session’, ‘subject’, or ‘dataset’.
names (list) – Optional list of variables names to return. If None, all available variables are returned.
merge (bool) – If True, variables are merged across all observations of the current unit. E.g., if unit=’subject’ and return_type= ‘collection’, variablesfrom all subjects will be merged into a single collection. If False, each observation is handled separately, and the result is returned as a list.
sampling_rate (int, str) – If unit=’run’, the sampling rate to pass onto the returned BIDSRunVariableCollection.
entities – Optional constraints used to limit what gets returned.
- Returns
A list of BIDSVariableCollections if merge=False; a single BIDSVariableCollection if merge=True.
-
get_or_create_node
(self, level, entities, *args, **kwargs)[source]¶ Retrieves a child Node based on the specified criteria, creating a new Node if necessary.
- Parameters
entities (dict) – Dictionary of entities specifying which Node to return.
kwargs (args,) – Optional positional or named arguments to pass onto class-specific initializers. These arguments are only used if a Node that matches the passed entities doesn’t already exist, and a new one must be created.
- Returns
A Node instance.
-