The module

Provide Astronomy-specific I/O routines for Sherpa.

This module contains read and write routines for handling FITS 1 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 and the location on disk of that module:

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

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
>>> io.backend =



Flexible Image Transport System,



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.


Create a DataARF object.


Create a DataRMF object.


Create a dataset from multiple arrays.

read_pha(arg[, use_errors, use_background])

Create a DataPHA object.

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

Write out an image.

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

Write out a PHA dataset.

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

Write out a table.


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


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


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.