Skip to content

Commit

Permalink
'Refactored by Sourcery'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourcery AI committed Oct 20, 2023
1 parent ac85e89 commit cb2e2c2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions glotaran/optimization/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,16 @@ def from_least_squares_result(

result_args = {
"success": success,
# "glotaran_version": glotaran_version,
"free_parameter_labels": free_parameter_labels,
"parameter_history": parameter_history,
"termination_reason": termination_reason,
"optimization_history": optimization_history,
"number_of_function_evaluations": result.nfev # type:ignore[union-attr]
"number_of_function_evaluations": result.nfev
if success
else parameter_history.number_of_records,
"cost": 0.5 * np.dot(penalty, penalty),
}

result_args["cost"] = 0.5 * np.dot(penalty, penalty)
if success:
result_args["number_clp"] = number_clp
result_args["number_of_jacobian_evaluations"] = result.njev # type:ignore[union-attr]
Expand Down Expand Up @@ -164,5 +163,4 @@ def calculate_covariance_matrix_and_standard_errors(
_, jacobian_sv, jacobian_rsv = np.linalg.svd(jacobian, full_matrices=False)
jacobian_sv_square = jacobian_sv**2
mask = jacobian_sv_square > np.finfo(float).eps
covariance_matrix = (jacobian_rsv[mask].T / jacobian_sv_square[mask]) @ jacobian_rsv[mask]
return covariance_matrix
return (jacobian_rsv[mask].T / jacobian_sv_square[mask]) @ jacobian_rsv[mask]

0 comments on commit cb2e2c2

Please sign in to comment.