Skip to content

Commit

Permalink
the warning was repeated many times, fix that
Browse files Browse the repository at this point in the history
  • Loading branch information
segasai committed Feb 15, 2024
1 parent 8f3a05f commit 23d09b8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions py/dynesty/sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,16 @@ def sample_bound_unif(args):
nonbounded = nonbounded[:n_cluster]
ntries = 0
threshold_warning = 10000
threshold_warned = False
while True:
u = bound.samples(1, rstate=rstate).flatten()
if not unitcheck(u, nonbounded):
ntries += 1
if ntries > threshold_warning:
with warnings.catch_warnings():
warnings.filterwarnings("once")
warnings.warn(
"Ellipsoid sampling is extremely inefficient")
if ntries > threshold_warning and not threshold_warned:
warnings.warn("Ellipsoid sampling is extremely inefficient",
category=RuntimeWarning)
threshold_warned = True

continue
else:
ntries = 0
Expand Down

0 comments on commit 23d09b8

Please sign in to comment.