gammapy / gamma-cat

An open data collection and source catalog for gamma-ray astronomy
https://gamma-cat.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
15 stars 17 forks source link

ZeroDivisionError from uncertainties in energy flux computation #107

Closed cdeil closed 7 years ago

cdeil commented 7 years ago

CI is broken (has been for weeks) on travis-ci: https://travis-ci.org/gammapy/gamma-cat/builds/224975711#L663

It's a ZeroDivisionError from uncertainties in energy flux computation, with Anaconda on Python 3.5 or 3.6.

I haven't been able to reproduce it locally, not even with Anaconda.

@adonath - Could you try, please, by executing the commands here? https://github.com/gammapy/gamma-cat/blob/master/.travis.yml

adonath commented 7 years ago

I was able to reproduce the issue locally on my machine. It seems the error is related to the fact, that the index for source 94 (HESS J1708-443) is exactly index=2, which is handled as a special case in Powerlaw.energy_flux() but not in Powerlaw.energy_flux_error(). The solution here is probably to reimplemented analytical solutions for .integral_error() and .energy_flux_error() for the simple cases, where the solutions are known (Powerlaw and Powerlaw2). I'll make a gammapy issue for that....

cdeil commented 7 years ago

@adonath - Can you please make this work now?

This should work and only take little time?

adonath commented 7 years ago

Yes, I can try work on that now. Just to make it clear: the solution is to add the special case to .energy_flux_error()and not to remove it from Powerlaw.energy_flux...

cdeil commented 7 years ago

As you like. Implementing special analytical cases is something that will take time. It's also something that can be distributed to others that have experience with it and know where to look up the formulae (e.g. I spent several days finding and debugging the formulae in HAP, and Julien did it for START). That's way I was suggesting to put a quick fix for now.