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 bugs in spectral cube class #187

merged 1 commit into from Aug 26, 2014


None yet
2 participants

ellisowen commented Aug 26, 2014

Fixes bug mentioned in issue #178, and deals with the Quantity/ImageHDU issue.

from astropy.units import Quantity
energy_range = Quantity([10, 500], 'GeV')
flux_background = fermi_diffuse.integral_flux_image(energy_range)
[[ 4.96538718e-08 5.08790160e-08 5.16831888e-08 ..., 8.34615912e-08
8.27155529e-08 8.25761185e-08]
[ 5.15609632e-08 5.20233728e-08 5.20025838e-08 ..., 8.38200572e-08
8.27546690e-08 8.26082274e-08]
[ 5.66285891e-08 5.53183727e-08 5.51376924e-08 ..., 8.54037376e-08
8.49908847e-08 8.45082814e-08]
[ 7.91854550e-08 7.92956875e-08 8.16965935e-08 ..., 7.36334291e-08
7.59015607e-08 7.62683800e-08]
[ 7.86396735e-08 7.92222013e-08 8.11234297e-08 ..., 7.34012929e-08
7.62491752e-08 7.74276834e-08]
[ 7.84162988e-08 7.85808745e-08 8.04845338e-08 ..., 7.27042248e-08
7.62317234e-08 7.81416615e-08]]

energy_range = Quantity([10E3, 500E3], 'MeV')
flux_background = fermi_diffuse.integral_flux_image(energy_range)

array([[ 4.96538718e-08, 5.08790160e-08, 5.16831888e-08, ...,
8.34615912e-08, 8.27155529e-08, 8.25761185e-08],
[ 5.15609632e-08, 5.20233728e-08, 5.20025838e-08, ...,
8.38200572e-08, 8.27546690e-08, 8.26082274e-08],
[ 5.66285891e-08, 5.53183727e-08, 5.51376924e-08, ...,
8.54037376e-08, 8.49908847e-08, 8.45082814e-08],
[ 7.91854550e-08, 7.92956875e-08, 8.16965935e-08, ...,
7.36334291e-08, 7.59015607e-08, 7.62683800e-08],
[ 7.86396735e-08, 7.92222013e-08, 8.11234297e-08, ...,
7.34012929e-08, 7.62491752e-08, 7.74276834e-08],
[ 7.84162988e-08, 7.85808745e-08, 8.04845338e-08, ...,
7.27042248e-08, 7.62317234e-08, 7.81416615e-08]])

So these are now the same (sorry, I haven't figured out how to write code blocks on here).


This comment has been minimized.


cdeil commented Aug 26, 2014

I'm merging this now because it's an important fix that @adonath needs for a script.

But @ellisowen, could you please add a few more asserts in this test:

def test_integral_flux_image(self):

E.g. you could assert some header keyword value.

And please pass the input energy range once in MeV and once in GeV and check that the output is OK (i.e. add a test that would have shown the bug that you fixed here).

PS: This is how you write a code block on Github so that it's nicely formatted:

cdeil added a commit that referenced this pull request Aug 26, 2014

Merge pull request #187 from ellisowen/issue_178_a
Bug fixes for

@cdeil cdeil merged commit a848248 into gammapy:master Aug 26, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed

@cdeil cdeil added the bug label Apr 8, 2015

@cdeil cdeil added this to the 0.2 milestone Apr 8, 2015

@cdeil cdeil changed the title from Bug fixes for to Fix bugs in spectral cube class Apr 8, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment