From 0ece818d5dfa8f3b720f43c57e359cd796563dd8 Mon Sep 17 00:00:00 2001 From: Joris Snellenburg Date: Tue, 20 Jul 2021 23:11:34 +0200 Subject: [PATCH] Backported fix for selecting sub-optimal optimized parameters for v0.4.1 Upon success the parameter from the last call to _calculate_penalty were used in lieu of the optimized parameters returned by least_square (ls_result.x). Increased version number to v0.4.1 --- glotaran/__init__.py | 2 +- glotaran/analysis/optimize.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/glotaran/__init__.py b/glotaran/__init__.py index 3c0d81ba8..196df8c62 100644 --- a/glotaran/__init__.py +++ b/glotaran/__init__.py @@ -8,7 +8,7 @@ load_plugins() -__version__ = "0.4.0" +__version__ = "0.4.1" def __getattr__(attribute_name: str): diff --git a/glotaran/analysis/optimize.py b/glotaran/analysis/optimize.py index 606beb73a..eb1c44955 100644 --- a/glotaran/analysis/optimize.py +++ b/glotaran/analysis/optimize.py @@ -101,7 +101,9 @@ def _create_result( root_mean_square_error = np.sqrt(reduced_chi_square) if success else None jacobian = ls_result.jac if success else None - problem.save_parameters_for_history() + if success: + problem.parameters.set_from_label_and_value_arrays(free_parameter_labels, ls_result.x) + problem.reset() history_index = None if success else -2 data = problem.create_result_data(history_index=history_index) # the optimized parameters are those of the last run if the optimization has crashed