icecube / FIRESONG

FIRst Extragalactic Simulation Of Neutrino and Gamma-ray
Other
18 stars 8 forks source link

Fix the test_sampling.py test failures #28

Closed mjlarson closed 3 years ago

mjlarson commented 3 years ago

The test_sampling.py relied on numbers found from the buggy InvCDF sampling before the fix in #19 . This updates the test with new numbers and replaces a hand-crafted truncated gaussian distribution in the test with an implementation from scipy, which directly gives the cdf values we want to test against.

In order to better ensure that things are working correctly, adding is also added to the InvCDF function. This ensures that the values at the edges - CDF values of 0 and 1 - return the right thing. Before, the edges were a little bit dodgy and could return values outside of [0,1].