OGIPDatasetWriter#
- class gammapy.datasets.OGIPDatasetWriter(filename, format='ogip', overwrite=False)[source]#
Bases:
gammapy.datasets.io.DatasetWriter
Write OGIP files.
If you want to use the written files with Sherpa you have to use the
ogip-sherpa
format. Then all files will be written in units of ‘keV’ and ‘cm2’.The naming scheme is fixed as following:
PHA file is named filename.fits
BKG file is named filename_bkg.fits
ARF file is named filename_arf.fits
RMF file is named filename_rmf.fits
- Parameters
- filename
pathlib.Path
or str Filename.
- format{“ogip”, “ogip-sherpa”}
Which format to use.
- overwritebool
Overwrite existing files?
- filename
Attributes Summary
Methods Summary
get_filenames
(filename)Get filenames
get_ogip_meta
(dataset[, is_bkg])Meta info for the OGIP data format
to_counts_hdulist
(dataset[, is_bkg])Convert counts region map to hdulist
write
(dataset)Write dataset to files
write_arf
(dataset, filename)Write effective area
write_bkg
(dataset, filename)Write off counts file
write_pha
(dataset, filename)Write counts file
write_rmf
(dataset, filename)Write energy dispersion.
Attributes Documentation
- tag = ['ogip', 'ogip-sherpa']#
Methods Documentation
- static get_filenames(filename)[source]#
Get filenames
- Parameters
- filename
Path
Filename
- filename
- Returns
- filenamesdict
Dict of filenames.
- to_counts_hdulist(dataset, is_bkg=False)[source]#
Convert counts region map to hdulist
- Parameters
- dataset
SpectrumDatasetOnOff
Dataset to write
- is_bkgbool
Whether to use counts off.
- dataset
- write(dataset)[source]#
Write dataset to files
- Parameters
- dataset
SpectrumDatasetOnOff
Dataset to write
- dataset
- write_arf(dataset, filename)[source]#
Write effective area
- Parameters
- dataset
SpectrumDatasetOnOff
Dataset to write
- filenamestr or
Path
Filename to use.
- dataset
- write_bkg(dataset, filename)[source]#
Write off counts file
- Parameters
- dataset
SpectrumDatasetOnOff
Dataset to write
- filenamestr or
Path
Filename to use.
- dataset
- write_pha(dataset, filename)[source]#
Write counts file
- Parameters
- dataset
SpectrumDatasetOnOff
Dataset to write
- filenamestr or
Path
Filename to use.
- dataset
- write_rmf(dataset, filename)[source]#
Write energy dispersion.
- Parameters
- dataset
SpectrumDatasetOnOff
Dataset to write
- filenamestr or
Path
Filename to use.
- dataset