tpgillam / mt2

Stransverse mass computation, compatible with numpy.
MIT License
4 stars 3 forks source link

Create test_collinear_endpoint_cases.py #32

Closed kesterlester closed 3 years ago

kesterlester commented 3 years ago

There is a line of this test which sets a tolerance in the approx-equal command. Docs say that the default tolerance is 1e-6, but the MT2 calculator should be able to do better in this test, so I pushed it up to 1e-12 and the test still passes. However if I push this tolerance up to 1e-13 then the test fails (on my laptop -- I don't know if it fails on github or elsewhere at 1e-13). This I fund surprising as the printouts suggest that python thinks the numbers it is comparing agree to at least 1e-15 or maybe even higher, EVEN WHEN IT SAYS THE COMPARISON FAILS. This means that something fishy is happening which should be understood.

tpgillam commented 3 years ago

Regarding formatting, if in doubt go with what the “Black” automatic formatter does to your code. Reduces the amount of mental effort you need to spend :)

tpgillam commented 3 years ago

Are your precision issues fixed by using absolute tolerance levels, and setting relative tolerances to zero?

see documentation here:

https://docs.pytest.org/en/stable/reference.html#pytest-approx

kesterlester commented 3 years ago

Are your precision issues fixed by using absolute tolerance levels, and setting relative tolerances to zero?

see documentation here:

https://docs.pytest.org/en/stable/reference.html#pytest-approx

No - my confusion as to why tests were failing was fixed by replacing m_parent with val in the debug/warning line. (This was something you commented on.) That change/fix made clear that the tests which were failing were failing for the right reasons.