Skip to content

Commit

Permalink
Improved get step where value error msg (#2654)
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell authored Aug 18, 2023
1 parent e332861 commit e8de4c1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions openmc/deplete/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,10 +512,11 @@ def get_step_where(
if math.isclose(time, times[ix], rel_tol=rtol, abs_tol=atol):
return ix

closest = min(times, key=lambda t: abs(time - t))
raise ValueError(
"A value of {} {} was not found given absolute and "
"relative tolerances {} and {}.".format(
time, time_units, atol, rtol)
f"A value of {time} {time_units} was not found given absolute and "
f"relative tolerances {atol} and {rtol}. Closest time is {closest} "
f"{time_units}."
)

def export_to_materials(
Expand Down

0 comments on commit e8de4c1

Please sign in to comment.