util
utilities used throughout em_framework
- class ema_workbench.em_framework.util.Counter(startfrom=0)
helper function for generating counter based names for NamedDicts
- class ema_workbench.em_framework.util.NamedDict(name=<function representation>, **kwargs)
- class ema_workbench.em_framework.util.ProgressTrackingMixIn(N, reporting_interval, logger, log_progress=False, log_func=<function ProgressTrackingMixIn.<lambda>>)
Mixin for monitoring progress
- Parameters:
N (int) – total number of experiments
reporting_interval (int) – nfe between logging progress
logger (logger instance)
log_progress (bool, optional)
log_func (callable, optional) – function called with self as only argument, should invoke self._logger with custom log message
- i
- Type:
int
- reporting_interval
- Type:
int
- log_progress
- Type:
bool
- log_func
- Type:
callable
- pbar
if log_progress is true, None, if false tqdm.tqdm instance
- Type:
{None, tqdm.tqdm instance}
- ema_workbench.em_framework.util.combine(*args)
combine scenario and policy into a single experiment dict
- Parameters:
args (two or more dicts that need to be combined)
- Return type:
a single unified dict containing the entries from all dicts
- Raises:
EMAError – if a keyword argument exists in more than one dict
- ema_workbench.em_framework.util.determine_objects(models, attribute, union=True)
determine the parameters over which to sample
- Parameters:
models (a collection of AbstractModel instances)
attribute ({'uncertainties', 'levers', 'outcomes'})
union (bool, optional) – in case of multiple models, sample over the union of levers, or over the intersection of the levers
- Return type:
collection of Parameter instances
- ema_workbench.em_framework.util.representation(named_dict)
helper function for generating repr based names for NamedDicts