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

Improve output units of spectral models #1979

Merged
merged 2 commits into from Jan 11, 2019
Merged

Conversation

@adonath
Copy link
Member

@adonath adonath commented Jan 10, 2019

This PR fixes #869 by converting the reference energies to the energy unit given by the user before evaluation.

@adonath adonath self-assigned this Jan 10, 2019
@adonath adonath added this to the 0.10 milestone Jan 10, 2019
@cdeil
Copy link
Member

@cdeil cdeil commented Jan 11, 2019

Like I said in the call today, I don't feel this is a good solution, because it's hard to maintain. Likely there are parameter names in Gammapy or in user models that don't match this hard-coded list. And also there will probably be other models (e.g. background models) where a similar fix is needed.

I don't have a clear proposal / opinion yet how unit handling in model __call__ and evaluate should work. As I mentioned in #1971 , I think it should be discussed and described there. How does Astropy do unit handling in __call__ and evaluate, now that they support quantities? Does the same problem appear in their "PowerLaw" class?

I would close this PR, and defer #869 with a comment, because it's not really well-resolved yet. But @adonath - if you want to merge this and / or close #869 to have fewer open issue, fine, as you prefer.

@adonath adonath force-pushed the adonath:issue_#869 branch from f2d1a4a to d15480b Jan 11, 2019
@adonath
Copy link
Member Author

@adonath adonath commented Jan 11, 2019

@cdeil I changed the implementation to get rid of the hard-coded parameter names and instead check the physical type of the parameter. In addition I'll add a section to #1971 describing the proposed design of __call__ and .evaluate() for models (basically what we have now).

@adonath adonath merged commit b304be1 into gammapy:master Jan 11, 2019
5 checks passed
5 checks passed
Codacy/PR Quality Review Up to standards. A positive pull request.
Details
Scrutinizer 1 updated code elements
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
gammapy.gammapy Build #20190111.3 succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants