Skip to content

Commit

Permalink
fix: revert ValueError to printed warning for poor Plot2D ranges with…
Browse files Browse the repository at this point in the history
… default prior bounds
  • Loading branch information
BradyPlanden committed Jul 5, 2024
1 parent c417ced commit b6fdc3b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
5 changes: 3 additions & 2 deletions pybop/parameters/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,9 @@ def get_bounds_for_plotly(self):

for i, param in enumerate(self.param.values()):
if param.applied_prior_bounds:
raise ValueError(
"Bounds were created from prior distributions. Please provide bounds for plotting."
print(

Check warning on line 423 in pybop/parameters/parameter.py

View check run for this annotation

Codecov / codecov/patch

pybop/parameters/parameter.py#L423

Added line #L423 was not covered by tests
"Bounds were created from prior distributions."
"Please provide bounds for better plotting results."
)
elif param.bounds is not None:
bounds[i] = param.bounds
Expand Down
19 changes: 0 additions & 19 deletions tests/unit/test_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,22 +193,3 @@ def test_plot2d_incorrect_number_of_parameters(self, model, dataset):
fitting_problem = pybop.FittingProblem(model, parameters, dataset)
cost = pybop.SumSquaredError(fitting_problem)
pybop.plot2d(cost)

# Test with applied prior bounds
parameters = pybop.Parameters(
pybop.Parameter(
"Negative electrode active material volume fraction",
prior=pybop.Gaussian(0.68, 0.05),
),
pybop.Parameter(
"Positive electrode active material volume fraction",
prior=pybop.Gaussian(0.58, 0.05),
bounds=[0.4, 0.7],
),
)
fitting_problem = pybop.FittingProblem(model, parameters, dataset)
cost = pybop.SumSquaredError(fitting_problem)
with pytest.raises(
ValueError, match="Bounds were created from prior distributions"
):
pybop.plot2d(cost)

0 comments on commit b6fdc3b

Please sign in to comment.