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
, thenload_ascii
.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).- Parameters
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
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
, orIMAGECrate
for crates, as used by CIAO, or a list of AstroPy HDU objects.args – The arguments supported by
load_pha
,load_image
,load_table
, andload_ascii
.kwargs – The keyword arguments supported by
load_pha
,load_image
,load_table
, andload_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 theid
andfilename
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)