Skip to content

Commit

Permalink
forward information on LinAlgError if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesBuchner committed May 3, 2021
1 parent b8fcdcf commit 17512e0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ultranest/integrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,8 @@ def _update_region_bootstrap(region, nbootstraps, minvol=0., comm=None, mpi_size
r, f = region.compute_enlargement(
minvol=minvol,
nbootstraps=max(1, nbootstraps // mpi_size))
except np.linalg.LinAlgError:
e = None
except np.linalg.LinAlgError as e:
r, f = np.nan, np.nan

if comm is not None:
Expand All @@ -377,6 +378,12 @@ def _update_region_bootstrap(region, nbootstraps, minvol=0., comm=None, mpi_size
recv_enlarge = comm.bcast(recv_enlarge, root=0)
f = np.max(recv_enlarge[:nbootstraps])

if not np.isfinite(r) and not np.isfinite(r):
if e is None:
raise np.linalg.LinAlgError("compute_enlargement failed")
else:
raise e

region.maxradiussq = r
region.enlarge = f
return r, f
Expand Down

0 comments on commit 17512e0

Please sign in to comment.