This module provides various convenience functions and classes.


load the specified bz2 file. the file is assumed to be saves using save_results.

Parameters:file_name (str) – the path to the file
Raises:IOError if file not found
ema_workbench.util.utilities.save_results(results, file_name)

save the results to the specified tar.gz file. The results are stored as csv files. There is an x.csv, and a csv for each outcome. In addition, there is a metadata csv which contains the datatype information for each of the columns in the x array.

  • results (tuple) – the return of perform_experiments
  • file_name (str) – the path of the file

IOError if file not found

ema_workbench.util.utilities.experiments_to_scenarios(experiments, model=None)

This function transform a structured experiments array into a list of Scenarios.

If model is provided, the uncertainties of the model are used. Otherwise, it is assumed that all non-default columns are uncertainties.

  • experiments (numpy structured array) – a structured array containing experiments
  • model (ModelInstance, optional) –

Return type:

a list of Scenarios

ema_workbench.util.utilities.merge_results(results1, results2)

convenience function for merging the return from perform_experiments().

The function merges results2 with results1. For the experiments, it generates an empty array equal to the size of the sum of the experiments. As dtype is uses the dtype from the experiments in results1. The function assumes that the ordering of dtypes and names is identical in both results.

A typical use case for this function is in combination with experiments_to_cases(). Using experiments_to_cases() one extracts the cases from a first set of experiments. One then performs these cases on a different model or policy, and then one wants to merge these new results with the old result for further analysis.

  • results1 (tuple) – first results to be merged
  • results2 (tuple) – second results to be merged

Return type:

the merged results