examples/notebooks/comparison_examples/optimiser_calibration.ipynb::optimiser_calibration.ipynb: ---------------------------------------------------------------------------
result = optim.run()
print("True values:", true_values)
print("Estimates:", result.x)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[6], line 1
----> 1 result = optim.run()
2
3 print("True values:", true_values)
4 print("Estimates:", result.x)
File ~/work/PyBOP/PyBOP/pybop/optimisers/base_optimiser.py:150, in BaseOptimiser.run(self)
148 self.problem.parameters.update(initial_values=initial_values)
149 self._set_up_optimiser()
--> 150 results.append(self._run())
152 result = OptimisationResult.combine(results)
154 if self.options.verbose:
File ~/work/PyBOP/PyBOP/pybop/optimisers/base_pints_optimiser.py:388, in BasePintsOptimiser._run(self)
385 # Log the optimised result as the final evaluation
386 self._evaluator.evaluate([x])
--> 388 return OptimisationResult(
389 optim=self,
390 time=total_time,
391 method_name=self.name,
392 message=halt_message,
393 )
File ~/work/PyBOP/PyBOP/pybop/optimisers/base_optimiser.py:190, in OptimisationResult.__init__(self, optim, time, method_name, message, scipy_result)
182 def __init__(
183 self,
184 optim: BaseOptimiser,
(...) 188 scipy_result=None,
189 ):
--> 190 super().__init__(
191 problem=optim.problem,
192 logger=optim.logger,
193 time=time,
194 method_name=method_name,
195 message=message,
196 scipy_result=scipy_result,
197 )
File ~/work/PyBOP/PyBOP/pybop/_result.py:57, in Result.__init__(self, problem, logger, time, method_name, message, scipy_result)
54 self._scipy_result = [scipy_result]
55 self._time = [time]
---> 57 self._validate()
File ~/work/PyBOP/PyBOP/pybop/_result.py:127, in Result._validate(self)
125 def _validate(self):
126 """Check that there is a finite cost and update best run."""
--> 127 self._check_for_finite_cost()
128 if self._minimising:
129 self._best_run = self._best_cost.index(min(self._best_cost))
File ~/work/PyBOP/PyBOP/pybop/_result.py:141, in Result._check_for_finite_cost(self)
134 """
135 Validate the optimised parameters and ensure they produce a finite cost value.
136
137 Raises:
138 ValueError: If the optimised parameters do not produce a finite cost value.
139 """
140 if not any(np.isfinite(self._best_cost)):
--> 141 raise ValueError(
142 f"Optimised parameters {self._problem.parameters.to_dict(self._x[-1])} do not produce a finite cost value."
143 )
ValueError: Optimised parameters {'Negative electrode active material volume fraction': np.float64(0.5), 'Positive electrode active material volume fraction': np.float64(0.5)} do not produce a finite cost value.
Workflow Run URL
Python 3.13 Test Summary