PHACountsSpectrum¶
-
class
gammapy.spectrum.PHACountsSpectrum(energy_lo, energy_hi, data=None, quality=None, backscal=None, areascal=None, is_bkg=False, meta=None)[source]¶ Bases:
gammapy.spectrum.CountsSpectrumCounts spectrum corresponding to OGIP PHA format.
The
bkgflag controls whether the PHA counts spectrum represents a background estimate or not (this slightly affects the FITS header information when writing to disk).Parameters: energy_lo :
QuantityLower bin edges of energy axis
energy_hi :
QuantityUpper bin edges of energy axis
data : array-like, optional
Counts
quality : int, array-like, optional
Mask bins in safe energy range (1 = bad, 0 = good)
backscal : float, array-like, optional
Background scaling factor
areascal : float, array-like, optional
Area scaling factor
is_bkg : bool, optional
Background or soure spectrum, default: False
meta : dict, optional
Meta information, TODO: add link where possible meta info is listed
Attributes Summary
arffileARF associated with the observations bins_in_safe_rangeIndices of bins within the energy thresholds bkgfileBackground PHA files associated with the observations counts_in_safe_rangeCounts with bins outside safe range set to 0 default_interp_kwargsenergyhi_thresholdHigh energy threshold of the observation (upper bin edge) livetimelo_thresholdLow energy threshold of the observation (lower bin edge) obs_idoffsetphafilePHA file associated with the observations rmffileRMF associated with the observations total_countsTotal number of counts Methods Summary
copy()A deep copy of self. fill(events)Fill with list of events. from_hdulist(hdulist[, hdu1, hdu2])Create from HDUList.peek([figsize])Quick-look summary plots. plot([ax, energy_unit, show_poisson_errors, …])Plot as data points. plot_hist([ax, energy_unit, show_energy])Plot as histogram. read(filename[, hdu1, hdu2])Read from file. rebin(parameter)Rebin. reset_thresholds()Reset energy thresholds (i.e. to_hdulist()Convert to HDUList.to_sherpa(name)Convert to sherpa.astro.data.DataPHA.to_table()Convert to Table.write(filename, **kwargs)Write to file. Attributes Documentation
-
arffile¶ ARF associated with the observations
-
bins_in_safe_range¶ Indices of bins within the energy thresholds
-
bkgfile¶ Background PHA files associated with the observations
-
counts_in_safe_range¶ Counts with bins outside safe range set to 0
-
default_interp_kwargs= {'bounds_error': False, 'method': 'nearest'}¶
-
energy¶
-
hi_threshold¶ High energy threshold of the observation (upper bin edge)
-
livetime¶
-
lo_threshold¶ Low energy threshold of the observation (lower bin edge)
-
obs_id¶
-
offset¶
-
phafile¶ PHA file associated with the observations
-
rmffile¶ RMF associated with the observations
-
total_counts¶ Total number of counts
Methods Documentation
-
copy()¶ A deep copy of self.
-
fill(events)¶ Fill with list of events.
TODO: Move to
NDDataArrayParameters: events :
Quantity,gammapy.data.EventList,List of event energies
-
peek(figsize=(5, 10))¶ Quick-look summary plots.
-
plot(ax=None, energy_unit='TeV', show_poisson_errors=False, show_energy=None, **kwargs)¶ Plot as data points.
kwargs are forwarded to
errorbarParameters: ax :
axis(optional)Axis instance to be used for the plot
energy_unit : str,
Unit, optionalUnit of the energy axis
show_poisson_errors : bool, optional
Show poisson errors on the plot
show_energy :
Quantity, optionalShow energy, e.g. threshold, as vertical line
Returns: ax:
axisAxis instance used for the plot
-
plot_hist(ax=None, energy_unit='TeV', show_energy=None, **kwargs)¶ Plot as histogram.
kwargs are forwarded to
histParameters: ax :
axis(optional)Axis instance to be used for the plot
energy_unit : str,
Unit, optionalUnit of the energy axis
show_energy :
Quantity, optionalShow energy, e.g. threshold, as vertical line
-
rebin(parameter)[source]¶ Rebin.
See
CountsSpectrum. This function treats the quality vector correctly
-
to_hdulist()¶ Convert to
HDUList.This adds an
EBOUNDSextension to theBinTableHDUproduced byto_table, in order to store the energy axis
-
write(filename, **kwargs)¶ Write to file.
-