The sherpa.astro.data module
Classes for storing, inspecting, and manipulating astronomical data sets.
The two types of Astronomical data supported in this module are
two-dimensional images (
DataIMG) and X-ray spectra
DataPHA), along with associated response information
DataRMF). These objects can be
constructed directly or read from FITS files using the
Both types of data extend the capabilities of the
using geometric shapes (regions) to filter images;
support different units for filtering images (logical, physical, and WCS), depending on the available metadata;
support different analysis units for filtering and display for PHA files (channels, energy, and wavelengths);
dynamically re-bin PHA data to improve the signal to noise (grouping and quality);
and automatically support one or more spectra that define the background for the observation (for PHA files) that can then be subtracted from the data or a background model fit to them.
DataPHA class adds support for grouping data - effectively
reducing the number of values in a data set - and adds an extra way
to filter the data with the quality array. The class extends
Data1D, since the primary data is channels and
counts, but it also has to act like an integrated data set
Data1DInt) in some cases. In an extension to
OGIP support, there is limited support for the
BIN_HI fields provided with Chandra grating data.
DataIMG class extends 2D support for “gridded” data, with
multiple possible coordinate systems (e.g.
world). Along with this, spatial filters can be applied,
using the CIAO region syntax [REGION].
Some functionality depends on the presence of the region and grouping Sherpa modules, which are optional components of Sherpa.
The Data objects support the rich display protocol of IPython, with HTML display of a table of information highlighting the relevant data and, for some classes, SVG images. Examples can be found at [AstroNoteBook].
“The OGIP Spectral File Format”, https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/spectra/ogip_92_007/ogip_92_007.html
“The OGIP Spectral File Format Addendum: Changes log “, https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/spectra/ogip_92_007a/ogip_92_007a.html
“The Calibration Requirements for Spectral Analysis (Definition of RMF and ARF file formats)”, https://heasarc.gsfc.nasa.gov/docs/heasarc/caldb/docs/memos/cal_gen_92_002/cal_gen_92_002.html
“The Calibration Requirements for Spectral Analysis Addendum: Changes log”, https://heasarc.gsfc.nasa.gov/docs/heasarc/caldb/docs/memos/cal_gen_92_002a/cal_gen_92_002a.html
Private communication with Keith Arnaud
Read in a 2D dataset from the file ‘image2.fits’ and then filter it to only use those pixels that lie within 45 units from the physical coordinate 3150,4515:
>>> from sherpa.astro.io import read_image >>> img = read_image(data_dir + 'image2.fits') >>> img.set_coord('physical') >>> img.notice2d('circle(3150,4515,45)')
Read in a PHA dataset from the file ‘3c273.pi’, subtract the background, filter to only use the data 0.5 to 7 keV, and re-group the data within this range to have at least 20 counts per group:
>>> from sherpa.astro.io import read_pha >>> pha = read_pha(data_3c273 + '3c273.pi') >>> pha.subtract() >>> pha.set_analysis('energy') >>> pha.notice(0.5, 7) >>> pha.group_counts(20)
Parent class for OGIP responses, in particular ARF and RMF.
ARF data set.
RMF data set.
PHA data set, including any associated instrument and background data.
Image data set
Binned image data set