Skip to content

Commit

Permalink
Fix numerical comparison error of test_patternfit_stats (#1334)
Browse files Browse the repository at this point in the history
  • Loading branch information
dachengx authored Feb 16, 2024
1 parent 2cc3473 commit cbe1ca9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/test_patternfit.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import math
from hypothesis import strategies, given, settings, example
from straxen.plugins.events.event_pattern_fit import (
binom_test,
Expand All @@ -14,7 +15,8 @@
@given(strategies.floats(0.0, 1.0), strategies.floats(0.01, 0.99), strategies.floats(2.0, 1000))
def test_patternfit_stats(aftobs, aft, s1tot):
s1top = aftobs * s1tot
assert (binom_test(s1top, s1tot, aft) >= 0) & (binom_test(s1top, s1tot, aft) <= 1)
r = binom_test(s1top, s1tot, aft)
assert (math.isclose(r, 0.0) | (r >= 0.0)) & math.isclose(r, 1.0) | (r <= 1.0)


@settings(deadline=None)
Expand Down

0 comments on commit cbe1ca9

Please sign in to comment.