| AHELP for CIAO 4.5 Sherpa v1 | get_data |
Context: data |
Synopsis
Return details of a Sherpa data set by ID.
Syntax
get_data([id])
Description
The get_data() function returns a variable that grants access to all the information contained in a data set by data ID. If no ID is given, then the default data set loaded in the Sherpa session is returned. The get_data() function can also be used to modify the details of a data set, e.g. to change units from "energy" to "wavelength" in a PHA grating data set, to subtract or unsubtract background data, to set the grouping of a PHA data set, among other options.
- 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")
Example 1
sherpa> get_data()
For example, data that had been read from a simple ASCII file has the following information (in this case it is the default data set, which has data id=1):
sherpa> print get_data()
name = foo.dat
x = Float64[124]
y = Float64[124]
staterror = None
syserror = None
sherpa> print get_data(1)
name = foo.dat
x = Float64[124]
y = Float64[124]
staterror = None
syserror = None
Example 2
sherpa> get_data("src")The data read from a PHA file, on the other hand, has more complex information, including arrays for grouping and quality flags as well as the data (here the data set has been assigned id="src"):
sherpa> print get_data("src")
name = s0_mar24_bin.pha
channel = Int16[512]
counts = Int32[512]
staterror = None
syserror = None
bin_lo = None
bin_hi = None
grouping = Int16[512]
quality = Int16[512]
exposure = 33483.25
backscal = 0.044189453125
areascal = 1.0
grouped = True
subtracted = False
units = energy
response_ids = [1]
background_ids = []
Example 3
sherpa> get_data(3).units = "wavelength"
The get_data() function can be used to modify the details of a data set; the command in this example sets the 'units' field of the PHA grating data set 3 to "wavelength".
sherpa> print get_data(3)
name = 460_leg_m1_bin10.pha
channel = Int16[16384]
counts = Int16[16384]
staterror = None
syserror = None
bin_lo = Float64[16384]
bin_hi = Float64[16384]
grouping = Int16[16384]
quality = Int16[16384]
exposure = 39939.2745006
backscal = 1.0
areascal = 1.0
grouped = True
subtracted = False
units = energy
response_ids = [1, 2, 3]
background_ids = [1, 2]
sherpa> get_data(3).units = "wavelength"
sherpa> print get_data(3).units
wavelength
Bugs
See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.
See Also
- confidence
- get_conf, get_covar, get_int_proj, get_int_unc, get_proj, get_reg_proj, get_reg_unc
- contrib
- get_chart_spectrum
- data
- copy_data, dataspace1d, dataspace2d, delete_data, fake, get_areascal, get_arf, get_arf_plot, get_axes, get_backscal, get_bkg, get_bkg_plot, get_bkg_scale, get_coord, get_counts, get_data_plot, get_dep, get_dims, get_error, get_exposure, get_grouping, get_indep, get_quality, get_rmf, get_specresp, get_staterror, get_syserror, group, load_ascii, load_data, load_grouping, load_quality, set_data, set_quality, ungroup, unpack_ascii, unpack_data
- filtering
- get_filter, load_filter, set_filter
- fitting
- calc_stat_info, get_fit, get_stat_info
- info
- get_default_id, list_data_ids, list_response_ids, list_stats
- methods
- get_draws, get_iter_method_name, get_iter_method_opt, get_method
- modeling
- clean, get_model, get_model_component, get_model_component_image, get_model_component_plot, get_model_plot, get_num_par, get_order_plot, get_par, get_pileup_model, get_response, get_source, get_source_component_image, get_source_component_plot, image_source
- plotting
- get_split_plot, plot_data, set_xlinear, set_xlog, set_ylinear, set_ylog
- psfs
- get_kernel, get_psf
- saving
- save_error, save_filter, save_grouping, save_quality, save_staterror, save_syserror
- statistics
- get_chisqr_plot, get_delchi_plot, get_prior, get_sampler, get_stat
- utilities
- calc_data_sum, calc_data_sum2d, calc_ftest, calc_kcorr, calc_mlr, calc_model_sum2d, calc_source_sum2d, get_analysis, get_rate
- visualization
- contour, contour_data, contour_ratio, get_ratio, get_resid, histogram1d, histogram2d, image_data, image_getregion, rebin

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