bids.variables.merge_collections

merge_collections(collections, sampling_rate='highest', output_level=None, variables=None)[source]

Merge two or more collections at the same level of analysis.

Parameters:
  • collections (list) – List of Collections to merge.

  • sampling_rate (int or str) – Sampling rate to use if it becomes necessary to resample DenseRunVariables. Either an integer or ‘highest’ (see merge_variables docstring for further explanation).

  • output_level (str, optional) – Assign a new level (e.g., ‘run’, ‘subject’, etc.) to the merged collection. If None, the current level is retained.

  • variables (list) – Optional list of names of variables to keep. If None, all are retained.

Returns:

Result type depends on the type of the input collections.

Return type:

BIDSVariableCollection or BIDSRunVariableCollection