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 spectrum fit serialisation code #421

Merged
merged 16 commits into from Feb 2, 2016

Conversation

Projects
None yet
3 participants
@joleroi
Contributor

joleroi commented Jan 20, 2016

Add functionality to serialise fit results from gammapy.spectrum

  • Add gammapy.spectrum.results.SpectrumFitResult with
    • read_sherpa method
    • read (FitSpectrum) JSON method
    • read method
    • write method
    • plot function
    • plot residuals
    • plot fluxpoints
  • Add gammapy.spectrum.results.SpectrumFitResultDict for comparing analyses with
    • to_table method
    • plot_method

TODO

  • Do not hardcode flux point units!
@joleroi

This comment has been minimized.

Show comment
Hide comment
@joleroi

joleroi Jan 20, 2016

Contributor

@cdeil I would like to have the functionality to serialize fit results ASAP (to finally be able to show some results). I have a question - see inline comment

Contributor

joleroi commented Jan 20, 2016

@cdeil I would like to have the functionality to serialize fit results ASAP (to finally be able to show some results). I have a question - see inline comment

@joleroi

This comment has been minimized.

Show comment
Hide comment
@joleroi

joleroi Jan 22, 2016

Contributor

This is a proposal for the SpectrumFitResult class.

it write to a format different thatn the JSON format of FitSpectrum, because this format is tailored very much to FitSpectrum, e.g. it has a 'fitoptions' keys, which stores HAP options. So I think a slimmer new format, that concentrates only on FitResults is nicer to handle. But we will see....

Contributor

joleroi commented Jan 22, 2016

This is a proposal for the SpectrumFitResult class.

it write to a format different thatn the JSON format of FitSpectrum, because this format is tailored very much to FitSpectrum, e.g. it has a 'fitoptions' keys, which stores HAP options. So I think a slimmer new format, that concentrates only on FitResults is nicer to handle. But we will see....

@joleroi joleroi self-assigned this Jan 22, 2016

@joleroi joleroi added the feature label Jan 22, 2016

joleroi added some commits Jan 25, 2016

@joleroi

This comment has been minimized.

Show comment
Hide comment
@joleroi
Contributor

joleroi commented Jan 28, 2016

joleroi added some commits Jan 28, 2016

Show outdated Hide outdated gammapy/spectrum/results.py Outdated
@tibaldo

This comment has been minimized.

Show comment
Hide comment
@tibaldo

tibaldo Jan 29, 2016

Contributor

@joleroi Is the results serialization part complete so that we can merge with master and I can add a read
_from_3ML method?

Contributor

tibaldo commented Jan 29, 2016

@joleroi Is the results serialization part complete so that we can merge with master and I can add a read
_from_3ML method?

@joleroi

This comment has been minimized.

Show comment
Hide comment
@joleroi

joleroi Jan 29, 2016

Contributor

I will work on this this afternoon, and maybe @cdeil wants to have a look. Whould you be fine with merging it monday morning?

Contributor

joleroi commented Jan 29, 2016

I will work on this this afternoon, and maybe @cdeil wants to have a look. Whould you be fine with merging it monday morning?

joleroi added some commits Jan 29, 2016

@tibaldo

This comment has been minimized.

Show comment
Hide comment
@tibaldo

tibaldo Jan 29, 2016

Contributor

@joleroi absolutely, even better because I can bug you in person on Monday if there is something I don not understand :)

Contributor

tibaldo commented Jan 29, 2016

@joleroi absolutely, even better because I can bug you in person on Monday if there is something I don not understand :)

joleroi added some commits Jan 29, 2016

@cdeil cdeil added this to the 0.4 milestone Feb 1, 2016

Show outdated Hide outdated gammapy/spectrum/results.py Outdated
Show outdated Hide outdated gammapy/spectrum/results.py Outdated
Show outdated Hide outdated gammapy/spectrum/results.py Outdated
Show outdated Hide outdated gammapy/spectrum/results.py Outdated
Show outdated Hide outdated gammapy/spectrum/results.py Outdated
Show outdated Hide outdated gammapy/spectrum/results.py Outdated
Show outdated Hide outdated gammapy/spectrum/results.py Outdated
Show outdated Hide outdated gammapy/spectrum/results.py Outdated
Show outdated Hide outdated gammapy/spectrum/results.py Outdated
Show outdated Hide outdated gammapy/spectrum/spectrum_analysis.py Outdated
covar = datastack.get_covar_results()
efilter = datastack.get_filter()
# First go on calculation flux points following

This comment has been minimized.

@cdeil

cdeil Feb 1, 2016

Member

Flux point computation is a big project on it's own, with some existing code in Gammapy.
For now, can you split this out into a separate function or method from _run_sherpa_fit and leave a TODO that this should be improved?

@cdeil

cdeil Feb 1, 2016

Member

Flux point computation is a big project on it's own, with some existing code in Gammapy.
For now, can you split this out into a separate function or method from _run_sherpa_fit and leave a TODO that this should be improved?

@cdeil cdeil changed the title from Add functionality to serialise fit results from gammapy.spectrum to Add spectrum fit serialisation code Feb 1, 2016

@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Feb 1, 2016

Member

I've left minor inline comments ... +1 to merge once those are addressed.
(I also added the 0.4 milestone and shortened the PR title a bit. You could add the changelog entry before merging ... that's what I do when a PR is ready to go, to try to limit working directly in master.)

Member

cdeil commented Feb 1, 2016

I've left minor inline comments ... +1 to merge once those are addressed.
(I also added the 0.4 milestone and shortened the PR title a bit. You could add the changelog entry before merging ... that's what I do when a PR is ready to go, to try to limit working directly in master.)

joleroi added some commits Feb 1, 2016

@joleroi

This comment has been minimized.

Show comment
Hide comment
@joleroi

joleroi Feb 1, 2016

Contributor

@cdeil I cannot reproduce the Sphinx build error locally. What command is run exactly on Travis again?
I tried

python setup.py build_sphinx -w
python setup.py build_sphinx -l
Contributor

joleroi commented Feb 1, 2016

@cdeil I cannot reproduce the Sphinx build error locally. What command is run exactly on Travis again?
I tried

python setup.py build_sphinx -w
python setup.py build_sphinx -l
@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Feb 1, 2016

Member

@joleroi - The Sphinx build error is present in gammapy master and is unrelated to this PR:
#428 (comment)
I don't know why it showed up now ... this docs file hasn't been touched in a long time ... probably Sphinx or some code it uses was updated and it's stricter now.

Feel free to merge this PR now. Or let it sit until tomorrow and I'll re-start the travis-ci build for this PR once #428 is merged.

Member

cdeil commented Feb 1, 2016

@joleroi - The Sphinx build error is present in gammapy master and is unrelated to this PR:
#428 (comment)
I don't know why it showed up now ... this docs file hasn't been touched in a long time ... probably Sphinx or some code it uses was updated and it's stricter now.

Feel free to merge this PR now. Or let it sit until tomorrow and I'll re-start the travis-ci build for this PR once #428 is merged.

@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Feb 1, 2016

Member

Now that #428 is merged, the Sphinx build should work. I've restarted travis-ci just now.

@joleroi - Can you remove the Long term -> abandon way spectral model is handled entry from the task list for this PR? Either make a new issue listing the next steps, or just remove it if having such a reminder issue with a task list is not helpful to you.

Member

cdeil commented Feb 1, 2016

Now that #428 is merged, the Sphinx build should work. I've restarted travis-ci just now.

@joleroi - Can you remove the Long term -> abandon way spectral model is handled entry from the task list for this PR? Either make a new issue listing the next steps, or just remove it if having such a reminder issue with a task list is not helpful to you.

Show outdated Hide outdated gammapy/utils/testing.py Outdated
Show outdated Hide outdated gammapy/spectrum/results.py Outdated
@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Feb 1, 2016

Member

@joleroi - All travis-ci builds passed for this PR.

Member

cdeil commented Feb 1, 2016

@joleroi - All travis-ci builds passed for this PR.

@joleroi

This comment has been minimized.

Show comment
Hide comment
@joleroi

joleroi Feb 2, 2016

Contributor

@tibaldo I am merging this, so feel free to add whatever you like!

Contributor

joleroi commented Feb 2, 2016

@tibaldo I am merging this, so feel free to add whatever you like!

joleroi added a commit that referenced this pull request Feb 2, 2016

Merge pull request #421 from joleroi/serialisation
Add spectrum fit serialisation code

@joleroi joleroi merged commit 79502a0 into gammapy:master Feb 2, 2016

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@joleroi joleroi deleted the joleroi:serialisation branch Feb 2, 2016

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