Skip to content

Commit

Permalink
Fix TypeError in pypesto.result.optimize.OptimizerResult.summary if x…
Browse files Browse the repository at this point in the history
…0 is None (#1266)

Previously, this would fail if `full=False` and `x0=None` (`TypeError: 'NoneType' object is not subscriptable`).
  • Loading branch information
dweindl committed Jan 4, 2024
1 parent 781b9db commit bcfd618
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pypesto/result/optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def summary(self, full: bool = False, show_hess: bool = True) -> str:
f"* message: {self.message} \n"
f"* number of evaluations: {self.n_fval}\n"
f"* time taken to optimize: {self.time:0.3f}s\n"
f"* startpoint: {self.x0 if full else self.x0[self.free_indices]}\n"
f"* startpoint: {self.x0 if full or self.x0 is None else self.x0[self.free_indices]}\n"
f"* endpoint: {self.x if full else self.x[self.free_indices]}\n"
)
# add fval, gradient, hessian, res, sres if available
Expand Down

0 comments on commit bcfd618

Please sign in to comment.