- sherpa.astro.ui.load_data(id, filename=None, *args, **kwargs)
Load a data set from a file.
Changed in version 4.13.1: 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).
id (int or str, optional) – 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
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
IMAGECratefor crates, as used by CIAO, or a list of AstroPy HDU objects.
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
filenameparameter. If given two un-named arguments, then they are interpreted as the
filenameparameters, respectively. The remaining parameters are expected to be given as named arguments.
>>> 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)