pypeit.par.util module
Utility functions for PypeIt parameter sets
- pypeit.par.util.recursive_dict_evaluate(d)[source]
Recursively run
eval()on each element of the provided dictionary.A raw read of a configuration file with configobj results in a dictionary that contains strings or lists of strings. However, when assigning the values for the various ParSets, the from_dict methods expect the dictionary values to have the appropriate type. E.g., the configobj will have something like d[‘foo’] = ‘1’, when the from_dict method expects the value to be an integer (d[‘foo’] = 1).
This function tries to evaluate all dictionary values, except for those listed above in the
_eval_ignore()function. Any value in this list or where:ast_literal_eval(d[k]) for k in d.keys()
raises an exception is returned as the original string.
This is currently only used in
from_cfg_file(); see further comments there.