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

Move plotting helper functions from SpectrumFitResult to SpectrumDatasetOnOff #2121

Merged
merged 5 commits into from Apr 18, 2019

Conversation

2 participants
@adonath
Copy link
Member

commented Apr 17, 2019

This PR moves the plotting functionality of the SpectrumFitResult over to the SpectrumDatasetOnOff and adapts the spectrum_analysis.ipynb notebook accordingly.

@adonath adonath self-assigned this Apr 17, 2019

@adonath adonath added the cleanup label Apr 17, 2019

@adonath adonath added this to To do in Spectrum analysis (1D) via automation Apr 17, 2019

@adonath adonath added this to the 0.12 milestone Apr 17, 2019

@registerrier
Copy link
Contributor

left a comment

Thanks @adonath . Looks good.

def plot_counts(self, ax):
"""Plot predicted and detected counts."""
self.npred().plot(ax=ax, label="mu_src")
self.excess().plot(ax=ax, label="Excess", fmt=".", energy_unit="TeV")

This comment has been minimized.

Copy link
@registerrier

registerrier Apr 17, 2019

Contributor

Why forcing the units to be TeV? That might be optional? Or simply use the units of the counts?

This comment has been minimized.

Copy link
@adonath

adonath Apr 17, 2019

Author Member

Done

@@ -282,3 +280,63 @@ def energy_range(self):
e_lo = self.counts_on.energy.lo[self.mask]
e_hi = self.counts_on.energy.hi[self.mask]
return u.Quantity([e_lo.min(), e_hi.max()])

def _as_counts_spectrum(self, data):

This comment has been minimized.

Copy link
@registerrier

registerrier Apr 17, 2019

Contributor

This could also be a .copy() method on CountsSpectrum, no?

@adonath adonath merged commit a8d4881 into gammapy:master Apr 18, 2019

8 of 9 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
Codacy/PR Quality Review Up to standards. A positive pull request.
Details
Scrutinizer Analysis: 2 new issues, 9 updated code elements – Tests: passed
Details
gammapy.gammapy Build #20190417.13 succeeded
Details
gammapy.gammapy (DevDocs) DevDocs succeeded
Details
gammapy.gammapy (Lint) Lint succeeded
Details
gammapy.gammapy (Test Python35) Test Python35 succeeded
Details
gammapy.gammapy (Test Windows35) Test Windows35 succeeded
Details
gammapy.gammapy (Test Windows37) Test Windows37 succeeded
Details

Spectrum analysis (1D) automation moved this from To do to Done Apr 18, 2019

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.