The sherpa.astro.io module

Provide Astronomy-specific I/O routines for Sherpa.

This module contains read and write routines for handling FITS and ASCII format data. The actual support is provided by the selected I/O backend package (currently Crates, provided by CIAO, or the FITS support in the AstroPy package, if installed).

Which backend is used?

When this module is first imported, Sherpa tries to import the backends installed with Sherpa in the order listed in the .sherpa.rc or .sherpa-standalone.rc file. The first module that imports successfully is set as the active backend. The following command prints the name of the backend:

>>> from sherpa.astro import io
>>> print(io.backend.name)

Change the backend

After the initial import, the backend can be changed by loading one of the I/O backends shipped with sherpa (or any other module that provides the same interface):

>>> import sherpa.astro.io.pyfits_backend
>>> io.backend = sherpa.astro.io.pyfits_backend

Functions

read_table(arg[, ncols, colkeys, dstype])

Create a dataset from a tabular file.

read_image(arg[, coord, dstype])

Create an image dataset from a file.

read_arf(arg)

Create a DataARF object.

read_rmf(arg)

Create a DataRMF object.

read_arrays(*args)

Create a dataset from multiple arrays.

read_pha(arg[, use_errors, use_background])

Create a DataPHA object.

write_arf(filename, dataset[, ascii, clobber])

Write out an ARF.

write_image(filename, dataset[, ascii, clobber])

Write out an image.

write_pha(filename, dataset[, ascii, clobber])

Write out a PHA dataset.

write_rmf(filename, dataset[, clobber])

Write out a RMF.

write_table(filename, dataset[, ascii, clobber])

Write out a table.

pack_table(dataset)

Convert a Sherpa data object into an I/O item (tabular).

pack_image(dataset)

Convert a Sherpa data object into an I/O item (image).

pack_pha(dataset)

Convert a Sherpa PHA data object into an I/O item (tabular).

read_table_blocks(arg[, make_copy])

Return the HDU elements (columns and header) from a FITS table.