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

Add flux point fitter class #979

Merged
merged 8 commits into from Apr 26, 2017

Conversation

Projects
None yet
2 participants
@adonath
Member

adonath commented Apr 19, 2017

This PR adds a FluxPointFitter class to fit a common model to a given set of flux points. A demo notebook is shown here.

TODO:

  • Rework flux point upper limit handling
  • Improve test (add asserts on more values of the result dict)
  • Wait for #978 to be merged and rebase
@cdeil

@adonath - Thanks!

I've left some inline comments.

Concerning your task list:

Rework flux point upper limit handling

Can you merge this ASAP and defer that to the future?
For now, how about adding a two-line FluxPoints.drop_ul classmethod and in the fitter to assume it's all non-UL?

Improve test (add asserts on more values of the result dict)

Yes, please add asserts on the other numbers in the results dict and the parameter errors.

And can you expose the Sherpa result objects? I.e. give people access to what Sherpa has built in without needing to re-expose a different set of results.

Wait for #978 to be merged and rebase

It's unrelated. But I'll merge that within the hour.

Show outdated Hide outdated gammapy/spectrum/flux_point.py Outdated
Show outdated Hide outdated gammapy/spectrum/flux_point.py Outdated
Show outdated Hide outdated gammapy/spectrum/flux_point.py Outdated
@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Apr 19, 2017

Member

The notebook is nice!

Suggest to add an intro at the top what it is, and to also print out the fitted model results.

Why not keep it a bit simpler and use the same flux points for the three spectral models?
The last one is best, with the weak signal, where parameter errors become visible.

Also I think it might be simpler to just pass data and model to the fitter init, and use one fitter per fit and to keep it simple.
At the moment you keep passing data and model in to different methods, and there's not really much gain (but some extra complexity and possibility for bugs by getting into a bad state after using it for a while for multiple fits) from re-using fitters, the setup is cheap. This is also how Sherpa and Minuit do it, no?

Member

cdeil commented Apr 19, 2017

The notebook is nice!

Suggest to add an intro at the top what it is, and to also print out the fitted model results.

Why not keep it a bit simpler and use the same flux points for the three spectral models?
The last one is best, with the weak signal, where parameter errors become visible.

Also I think it might be simpler to just pass data and model to the fitter init, and use one fitter per fit and to keep it simple.
At the moment you keep passing data and model in to different methods, and there's not really much gain (but some extra complexity and possibility for bugs by getting into a bad state after using it for a while for multiple fits) from re-using fitters, the setup is cheap. This is also how Sherpa and Minuit do it, no?

@cdeil cdeil added the feature label Apr 19, 2017

@cdeil cdeil added this to the 0.6 milestone Apr 19, 2017

@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Apr 26, 2017

Member

@adonath - Merge?

Member

cdeil commented Apr 26, 2017

@adonath - Merge?

@adonath adonath merged commit 45b23dd into gammapy:master Apr 26, 2017

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Apr 27, 2017

Member

Some small fixes and cleanup in 16a2df3 .

Member

cdeil commented Apr 27, 2017

Some small fixes and cleanup in 16a2df3 .

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