From 5c97e274bd57441835434fb26539f221894fd22e Mon Sep 17 00:00:00 2001 From: IMDijkstra <73649939+iddie1994@users.noreply.github.com> Date: Wed, 16 Feb 2022 10:06:45 +0100 Subject: [PATCH] Add files via upload --- Offp2h_PAIRSPLOT.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Offp2h_PAIRSPLOT.py diff --git a/Offp2h_PAIRSPLOT.py b/Offp2h_PAIRSPLOT.py new file mode 100644 index 0000000..8e26314 --- /dev/null +++ b/Offp2h_PAIRSPLOT.py @@ -0,0 +1,37 @@ + +import numpy as np +import matplotlib.pyplot as plt + +from ema_workbench import load_results, ema_logging + +from ema_workbench.analysis.pairs_plotting import (pairs_lines, pairs_scatter, + pairs_density) + +ema_logging.log_to_stderr(level=ema_logging.DEFAULT_LEVEL) + +# load data +fn = r'./data/windhydrogen100.tar.gz' +experiments, outcomes = load_results(fn) + +# transform the results to the required format +# that is, we want to know the max peak and the casualties at the end of the +# run +tr = {} + +for key, value in outcomes.items(): + if key == 'Cumulative hydrogen production': + tr[key] = value[:, -1] # we want the end value + else: + # we want the maximum value of the peak + max_peak = np.max(value, axis=1) + tr['max peak'] = max_peak + + # we want the time at which the maximum occurred + # the code here is a bit obscure, I don't know why the transpose + # of value is needed. This however does produce the appropriate results + logical = value.T == np.max(value, axis=1) + +pairs_scatter(experiments, tr, filter_scalar=False) +pairs_lines(experiments, outcomes) +pairs_density(experiments, tr, filter_scalar=False) +plt.show() \ No newline at end of file