OGIPDatasetReader#
- class gammapy.datasets.OGIPDatasetReader(filename)[source]#
Bases:
gammapy.datasets.io.DatasetReader
Read
SpectrumDatasetOnOff
from OGIP files.BKG file, ARF, and RMF must be set in the PHA header and be present in the same folder.
The naming scheme is fixed to the following scheme:
PHA file is named
pha_obs{name}.fits
BKG file is named
bkg_obs{name}.fits
ARF file is named
arf_obs{name}.fits
RMF file is named
rmf_obs{name}.fits
with{name}
the dataset name.
- Parameters
- filenamestr or
Path
OGIP PHA file to read
- filenamestr or
Attributes Summary
Methods Summary
get_filenames
(pha_meta)Get filenames.
get_valid_path
(filename)Get absolute or relative path.
read
()Read dataset.
read_arf
(filename, livetime)Read ARF file.
read_bkg
(filename)Read PHA background file.
read_pha
(filename)Read PHA file.
read_rmf
(filename, exposure)Read RMF file.
Attributes Documentation
- tag = 'ogip'#
Methods Documentation
- get_filenames(pha_meta)[source]#
Get filenames.
- Parameters
- pha_metadict
Meta data from the PHA file
- Returns
- filenamesdict
Dict with filenames of “arffile”, “rmffile” (optional) and “bkgfile” (optional)
- get_valid_path(filename)[source]#
Get absolute or relative path.
The relative path is with respect to the name of the reference file.
- Parameters
- filenamestr or
Path
Filename
- filenamestr or
- Returns
- filename
Path
Valid path
- filename
- static read_arf(filename, livetime)[source]#
Read ARF file.
- Parameters
- filenamestr or
Path
PHA file name
- livetime
Quantity
Livetime
- filenamestr or
- Returns
- data
RegionNDMap
Exposure map
- data
- static read_bkg(filename)[source]#
Read PHA background file.
- Parameters
- filenamestr or
Path
PHA file name
- filenamestr or
- Returns
- datadict
Dict with counts_off and acceptance_off