Skip to content

Commit a4d58c9

Browse files
committed
fix: correct check for "no accepted samples" in rejection_sample
Closes #466
1 parent 6990d08 commit a4d58c9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bayesflow/simulators/simulator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ def rejection_sample(
5050
# we could cast, but this tends to hide mistakes in the predicate
5151
raise RuntimeError(f"Predicate must return a boolean type array. Got dtype={accept.dtype}")
5252

53-
(accept,) = np.nonzero(accept)
54-
5553
if not np.any(accept):
5654
# no samples accepted, skip
5755
continue
5856

57+
(accept,) = np.nonzero(accept)
58+
5959
# apply acceptance mask
6060
samples = {key: np.take(value, accept, axis=axis) for key, value in samples.items()}
6161

0 commit comments

Comments
 (0)