collect_ND_datasets#
- ptyrad.load.collect_ND_datasets(data_dict, ndims=None, delimiter='.', verbose=True, _parent_key=None)[source]#
Collect ND numpy arrays from a (possibly nested) dictionary that match desired dimensionalities.
Automatically traverses nested dictionaries and flattens keys with ‘//’.
- Parameters:
data_dict (dict) – Dictionary of datasets (flat or nested).
ndims (list of int) – Desired dimensionalities to match (e.g., [3, 4]).
delimiter (str) – String symbol used to seperate different levels of the full path to the dataset
verbose (bool) – Whether to print matched datasets.
_parent_key (str, optional) – Internal use only. Tracks nested keys during recursion. Do not set manually.
- Returns:
Matching datasets with flattened hierarchical keys.
- Return type:
dict[str, np.ndarray]
- Raises:
ValueError – If input is not a dict or no datasets match.