From a5028d81d0b1e3ade683c8408bcbb4f210772682 Mon Sep 17 00:00:00 2001 From: thouska Date: Mon, 27 Feb 2023 17:08:46 +0100 Subject: [PATCH] Fix for #302 --- src/spotpy/analyser.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/spotpy/analyser.py b/src/spotpy/analyser.py index fa23811c..04f80874 100644 --- a/src/spotpy/analyser.py +++ b/src/spotpy/analyser.py @@ -337,7 +337,8 @@ def plot_posterior_parameter_histogram(ax, results, parameter): def plot_parameter_uncertainty( - posterior_results, evaluation, fig_name="Posterior_parameter_uncertainty.png" + posterior_results, evaluation, maximize=True, + fig_name="Posterior_parameter_uncertainty.png" ): import matplotlib.pyplot as plt @@ -363,8 +364,10 @@ def plot_parameter_uncertainty( label="parameter uncertainty", ) ax.plot(evaluation, "r.", markersize=1, label="Observation data") - - bestindex, bestobjf = get_maxlikeindex(posterior_results, verbose=False) + if maximize: + bestindex, bestobjf = get_maxlikeindex(posterior_results, verbose=False) + else: + bestindex, bestobjf = get_minlikeindex(posterior_results, verbose=False) plt.plot( list(posterior_results[simulation_fields][bestindex][0]), "b-",