    Load a data set from a file.

load_data(id, filename=None, *args, **kwargs)
id - int or str, optional

This loads a data set from the file, trying in order

`load_pha` , `load_image` , `load_table` , then `load_ascii` .

>>> 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)

PARAMETERS

The parameters for this function are:

Parameter
Definition
id
The identifier for the data set to use. For multi-dataset files, currently only PHA2, the id value indicates the first dataset: if it is an integer then the numbering starts at id, and if a string then a suffix of 1 to n is added. 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` .

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.

Changes in CIAO

The id argument is now used to define the first identifier when loading in a PHA2 file to match `load_pha` (previously the range always started at 1).

See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

December 2023