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.CountsSpectrum

OGIP PHA equivalent

The bkg flag controls wheater the PHA counts spectrum represents a background estimate or not (this slightly affectes the FITS header information when writing to disk).

Parameters:

energy_lo : Quantity

Lower bin edges of energy axis

energy_hi : Quantity

Upper bin edges of energy axis

data : array, list, 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

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
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

Methods Summary

from_hdulist(hdulist[, hdu1, hdu2]) Read
read(filename[, hdu1, hdu2])
rebin(parameter) Rebin
to_sherpa(name) Return DataPHA
to_table() Write

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

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

Methods Documentation

classmethod from_hdulist(hdulist, hdu1='SPECTRUM', hdu2='EBOUNDS')[source]

Read

classmethod read(filename, hdu1='SPECTRUM', hdu2='EBOUNDS', **kwargs)[source]
rebin(parameter)[source]

Rebin

see CountsSpectrum, this function treats the quality vector correctly

to_sherpa(name)[source]

Return DataPHA

Parameters:

name : str

Instance name

to_table()[source]

Write