Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix numerical comparison error of test_patternfit_stats #1334

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

dachengx
Copy link
Collaborator

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:

  • Update the docstring(s)
  • Update the documentation
  • Tests to check the (new) code is working as desired.
  • Does it solve one of the open issues on github?

@dachengx dachengx marked this pull request as ready for review February 16, 2024 05:41
@coveralls
Copy link

coveralls commented Feb 16, 2024

Coverage Status

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

@GiovanniVolta
Copy link
Contributor

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

@dachengx
Copy link
Collaborator Author

dachengx commented Feb 16, 2024

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

It is a very rare corner case. :)

@dachengx dachengx merged commit cbe1ca9 into master Feb 16, 2024
8 checks passed
@dachengx dachengx deleted the fix_binom_test branch February 16, 2024 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants