| AHELP for CIAO 4.5 Sherpa v1 | load_data |
Context: data |
Synopsis
Load 1D data from a file
Syntax
load_data( [id], filename, [options] )
Description
The load_data command is a filetype-independent method of loading 1D data from a file (e.g. if the file-specific load command is unknown or if the filetype is unknown). It tries to load the file in the following order: load_pha, load_table, and load_ascii.
- id - the id of the dataset to use; if not given, uses the default dataset id (id=1 by default, see "ahelp get_default_id")
- filename - the name of the file (with path) which contains the data
If the filetype is known, file-specific options may be included in the load_data command. They are:
- load_pha: use_errors
- load_table: ncols, colkeys, and dstype
- load_ascii: ncols, colkeys, sep, comment, and dstype
Refer to the individual command ahelp files for specifics on the options.
Example 1
sherpa> load_data("data.filtered")Using the default settings, load a data file into Sherpa.
Example 2
sherpa> load_data("src", "data.txt", ncols=3)Load the first three columns of data.txt, using the dataset id "src". This example could also have been done using the load_ascii command.
Example 3
sherpa> load_data("src", "source.pha")Data is loaded from the file source.pha with data id "src". This example could also have been done using the load_pha command.
Example 4
sherpa> load_data("rprofile_mid.fits[cols RMID,SUR_BRI,SUR_BRI_ERR]")
sherpa> load_data("rprofile_mid.fits",
colkeys=["RMID","SUR_BRI","SUR_BRI_ERR"])These commands are equivalent ways of loading x=RMID, y=SUR_BRI, and staterror=SUR_BRI_ERR from rprofile_mid.fits, a radial profile for which the midpoint of the annular regions has been calculated. This example could also have been done using the load_table command.
Example 5
sherpa> load_data("test_data.dat", dstype=Data1DInt)
sherpa> load_data("test_data.dat[opt colnames=first]", dstype=Data1DInt)
sherpa> load_data("test_data.dat[cols xlo,xhi,y,staterror]",
dstype=Data1DInt)This example shows three equivalent ways of loading four columns named 'xlo','xhi','y', and 'staterror' from the ASCII file test_data.dat, where the latter uses the CIAO Data Model ASCII kernel to select the desired columns.
Bugs
See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.
See Also
- data
- copy_data, dataspace1d, dataspace2d, delete_data, fake, get_axes, get_bkg_plot, get_counts, get_data, get_data_plot, get_dep, get_dims, get_error, get_quality, get_specresp, get_staterror, get_syserror, group, load_arf, load_arrays, load_ascii, load_bkg, load_bkg_arf, load_bkg_rmf, load_grouping, load_image, load_multi_arfs, load_multi_rmfs, load_pha, load_quality, load_rmf, load_staterror, load_syserror, load_table, pack_image, pack_pha, pack_table, set_data, set_quality, ungroup, unpack_arf, unpack_arrays, unpack_ascii, unpack_bkg, unpack_data, unpack_image, unpack_pha, unpack_rmf, unpack_table
- filtering
- get_filter, load_filter, set_filter
- info
- get_default_id, list_bkg_ids, list_data_ids, list_response_ids
- modeling
- add_model, add_user_pars, clean, load_table_model, load_template_model, load_user_model, save_model, save_source
- plotting
- plot_data, set_xlinear, set_xlog, set_ylinear, set_ylog
- saving
- save_arrays, save_data, save_delchi, save_error, save_filter, save_grouping, save_image, save_pha, save_quality, save_resid, save_staterror, save_syserror, save_table
- statistics
- load_user_stat
- utilities
- calc_data_sum, calc_data_sum2d, calc_ftest, calc_kcorr, calc_mlr, calc_model_sum2d, calc_source_sum2d, get_rate
- visualization
- contour, contour_data, contour_ratio, get_ratio, get_resid, histogram1d, histogram2d, image_data, rebin

![[Sherpa Logo]](../imgs/sherpa_logo_navbar.gif)