XENONnT / straxen

Streaming analysis for XENON
BSD 3-Clause "New" or "Revised" License
21 stars 32 forks source link

Fix numerical comparison error of `test_patternfit_stats` #1334

Closed dachengx closed 6 months ago

dachengx commented 6 months ago

What does the code in this PR do / what does it improve?

An error is seen in test: https://github.com/XENONnT/straxen/actions/runs/7918467685/job/21616952222, from a numerical comparison assert (1.0000000000000002 >= 0 & 1.0000000000000002 <= 1).

Can you briefly describe how it works?

This PR uses math.isclose in the test to solve the error. When 1.0000000000000002 is close to 1.0, the argument of assert is still true.

Can you give a minimal working example (or illustrate with a figure)?

Please include the following if applicable:

coveralls commented 6 months ago

Coverage Status

coverage: 91.347% (+0.02%) from 91.327% when pulling 27feb4fcc79c5ba9b5b799a8364ea7ccbb11b895 on fix_binom_test into 2cc3473957a2875653a3fc5f73b643d55033c1d4 on master.

GiovanniVolta commented 6 months ago

Hey Dacheng, thank you for fixing the test! I am surprised, though; I never see it fail

dachengx commented 6 months ago

Hey Dacheng, thank you for fixing the test! I am surprised, though; I never see it fail

It is a very rare corner case. :)