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)
Named dictionary class.
- copy()
Return a shallow copy of this object.
- class ema_workbench.em_framework.util.NamedObject(name: str, **kwargs)
Base object with a name attribute.
- class ema_workbench.em_framework.util.NamedObjectMap(kind: type[T])
A named object mapping class.
- clear() None. Remove all items from D.
- keys() a set-like object providing a view on D's keys
- class ema_workbench.em_framework.util.NamedObjectMapDescriptor(kind)
Descriptor class for named objects.
- 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}
- class ema_workbench.em_framework.util.Variable(name: str, variable_name: str | list[str] | None = None)
Root class for input parameters and outcomes.
- ema_workbench.em_framework.util.combine(*args) dict
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: Literal['uncertainties', 'levers', 'outcomes'], 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.