Skip to content
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 `integrate_spectrum` for small integration ranges #2163

merged 2 commits into from May 27, 2019


None yet
2 participants
Copy link

commented May 27, 2019

This PR fixes a bug in the integrate_spectrum method reported by @luca-giunti. If emin and emax was within the same decade, the integration method would return 0, as the total number of sub-bins for the integration would be rounded to 0. A regression test is added as well.

@adonath adonath requested a review from luca-giunti May 27, 2019

@adonath adonath self-assigned this May 27, 2019

@adonath adonath added the bug label May 27, 2019

@adonath adonath added this to the 0.12 milestone May 27, 2019

Copy link

left a comment

Hi @adonath! Thanks. Did you change the line n = int((logmax - logmin)) * ndecade in integrate_spectrum()? In the diff I only see the new test function.

Cheers :)


This comment has been minimized.

Copy link
Member Author

commented May 27, 2019

@luca-giunti Thanks! Indeed the commit was missing, I just added it to the PR.

@adonath adonath merged commit b07cac1 into gammapy:master May 27, 2019

7 of 8 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Codacy/PR Quality Review Up to standards. A positive pull request.
gammapy.gammapy Build #20190527.11 succeeded
gammapy.gammapy (DevDocs) DevDocs succeeded
gammapy.gammapy (Lint) Lint succeeded
gammapy.gammapy (Test Python35) Test Python35 succeeded
gammapy.gammapy (Test Windows35) Test Windows35 succeeded
gammapy.gammapy (Test Windows37) Test Windows37 succeeded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.