cubids.file_collections.collection_context

collection_context(entities, rule)[source]

Build a key shared by exactly the files in one collection.

Parameters:
  • entities (dict) – A pybids entities dictionary.

  • rule (CollectionRule) – The rule the file matched.

Returns:

Sorted (name, value) pairs for every entity that members of the collection must agree on.

Return type:

tuple

Examples

>>> rule = GENERIC_COLLECTION_RULE
>>> collection_context(
...     {"subject": "01", "echo": "1", "suffix": "bold", "extension": ".nii.gz"}, rule
... )
(('subject', '01'), ('suffix', 'bold'))