nnmt.input_output.val_unit_to_quantities

nnmt.input_output.val_unit_to_quantities(dict_of_val_unit_dicts)[source]

Recursively convert a dict of value-unit pairs to a dict of quantities.

Combine value and unit of each quantity and save them in a dictionary of the structure: {'<quantity_key1>':<quantity1>, ...}.

Lists are converted to numpy arrays and then converted to quantities.

Quantities or names without units, are just stored the way they are.

Parameters:
dict_of_val_unit_dictsdict

Dictionary of the following format:

{'<quantity_key1>':{'val':<value1>, 'unit':<unit1>},
'<quantity_key2>':<value2>, ...}
Returns:
dict

Converted dictionary of format explained above.