zblz/gammafit — pull request #9 by cdeil (2013-08-05 11:58:35+00:00)
Title: Fix test_protonozm by loosening assert precision

This fixes the following error for `test_protonozm`:
```

______________________________________________________________________________ test_protonozm _______________________________________________________________________________

def test_protonozm():
from ..onezone import ProtonOZM

ozm = ProtonOZM( np.logspace(8,15,100), 1, index=2.0,cutoff=1e13,beta=1.0)
ozm.calc_outspec()

lpp=np.trapz(ozm.specpp*ozm.outspecene**2*u.eV.to('erg'),ozm.outspecene)
> assert_almost_equal(lpp,3.2800627079738687e+23)

gammafit/tests/test_onezone.py:50:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

x = 3.2800253970045753e+23, y = 3.280062707973869e+23

def assert_almost_equal(x,y):
> assert abs(x-y)/y < 1e-6
E assert (3.7310969293423247e+18 / 3.280062707973869e+23) < 1e-06
E + where 3.7310969293423247e+18 = abs((3.2800253970045753e+23 - 3.280062707973869e+23))

gammafit/tests/test_onezone.py:5: AssertionError
```
Plus I changed from hand-written `assert_almost_equal` to the equivalent `numpy.testing.assert_approx_equal` everywhere.