load_data

sherpa.astro.ui.load_data(id, filename=None, *args, **kwargs)

Load a data set from a file.

This loads a data set from the file, trying in order load_pha, load_image, load_table, then load_ascii.

Parameters:
  • id (int or str, optional) – The identifier for the data set to use. If not given then the default identifier is used, as returned by get_default_id.
  • filename – A file name or a data structure representing the data to use, as used by the I/O backend in use by Sherpa: e.g. a PHACrateDataset, TABLECrate, or IMAGECrate for crates, as used by CIAO, or a list of AstroPy HDU objects.
  • args – The arguments supported by load_pha, load_image, load_table, and load_ascii.
  • kwargs – The keyword arguments supported by load_pha, load_image, load_table, and load_ascii.

See also

load_arrays()
Create a data set from array values.
load_ascii()
Load an ASCII file as a data set.
load_image()
Load an image as a data set.
load_pha()
Load a PHA data set.
load_table()
Load a FITS binary file as a data set.
set_data()
Set a data set.
unpack_data()
Create a sherpa data object from a file.

Notes

The function does not follow the normal Python standards for parameter use, since it is designed for easy interactive use. When called with a single un-named argument, it is taken to be the filename parameter. If given two un-named arguments, then they are interpreted as the id and filename parameters, respectively. The remaining parameters are expected to be given as named arguments.

Examples

>>> load_data('tbl.dat')
>>> load_data('hist.dat', dstype=Data1DInt)
>>> load_data('img', 'img.fits')
>>> load_data('bg', 'img_bg.fits')
>>> cols = ['rmid', 'sur_bri', 'sur_bri_err']
>>> load_data(2, 'profile.fits', colkeys=cols)