Skip to content

Commit

Permalink
Backported fix for selecting sub-optimal optimized parameters for v0.4.1
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jsnel committed Jul 20, 2021
1 parent dc00e6d commit 0ece818
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion glotaran/__init__.py
Expand Up @@ -8,7 +8,7 @@

load_plugins()

__version__ = "0.4.0"
__version__ = "0.4.1"


def __getattr__(attribute_name: str):
Expand Down
4 changes: 3 additions & 1 deletion glotaran/analysis/optimize.py
Expand Up @@ -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
Expand Down

0 comments on commit 0ece818

Please sign in to comment.