| AHELP for CIAO 4.5 Sherpa v1 | get_source |
Context: modeling |
Synopsis
Return the unconvolved model associated with a Sherpa data set ID.
Syntax
get_source([id]) get_source_plot([id, lo, hi]) get_source_image([id]) get_source_contour([id])
Description
- id - the id of the data set to use; if not given, uses the default dataset id (id=1 by default, see "ahelp get_default_id")
- lo - low bound of the desired plotting range; default=None
- hi - high bound of the desired plotting range; default= None
get_source
The get_source() function returns the parameter values and settings for an unconvolved model associated with a given data set ID. If no ID is given, then the unconvolved model assigned to the default data set loaded in the Sherpa session is returned.
get_source_plot
The get_source_plot() function returns the data and preferences defining a plot of a 1-D unconvolved source model associated with a data set. Once a model is assigned to a data set, this command can be used to list the x and y data arrays used in the source model plot created with plot_source() or plot(), in addition to the values for the x label, y label, units, title, and other plotting preferences (such as linestyle, linethickness, etc.). The information returned by get_source_plot() may be stored in a variable, or printed to the screen, as shown in the examples section.
get_source_image
The get_source_image() function returns the image array defining a plot of a 2-D unconvolved source model associated with a 2-D data set. The model image can be visualized in ds9 with the image_source() function. When called with no arguments, the model image array associated with the default data set loaded in the Sherpa session will be returned.
get_source_contour
The get_source_contour() function returns the data and settings defining a contour plot of a 2-D unconvolved source model associated with a 2-D data set. The model contour plot can be visualized with the contour_source() function. Once a 2-D model is assigned to a 2-D data set, this command can be used to list the x0, x1, and y data arrays used in the 2-D model contour plot created with contour_source(), in addition to the values for the x0 label, x1 label, title, and other plotting preferences. When called with no arguments, the model data associated with the default data set loaded in the Sherpa session will be returned. The information returned by get_source_contour() may be stored in a variable, or printed to the screen, as shown in the examples section.
Example 1
sherpa> print(get_source())
sherpa> print(get_source(2))
sherpa> print(get_source("src"))When called with no arguments from within the print command, the model associated with the default data set loaded in the Sherpa session is returned. The user can also specify a data set ID to view the parameter settings for the model associated with that data set.
sherpa> set_model( xsphabs.abs1 * xszphabs.zabs1 * powlaw1d.p1 ) sherpa> print(get_source()) ((xsphabs[abs1] * xszphabs[zabs1]) * powlaw1d[p1]) Param Type Value Min Max Units ----- ---- ----- --- --- ----- abs1.nh thawed 1 0 100000 10^22 atoms / cm^2 zabs1.nh thawed 1 0 100000 10^22 atoms / cm^2 zabs1.redshift frozen 0 0 10 p1.gamma thawed 1 -10 10 p1.ref frozen 1 -1e+120 1e+120 p1.ampl thawed 1 0 1e+120
Example 2
sherpa> print(get_source_plot())
sherpa> print(get_source_plot(2))
sherpa> print(get_source_plot("src"))When called with no arguments from within the print command, the data and settings defining the plot of the model associated with the default data set loaded in the Sherpa session is returned. The user can also specify a data set ID to view the model data and settings for that data set.
sherpa> print(get_source_plot(2))
x = [ 0.30000001 0.31 0.31999999 0.3300000 . . . . 10.97000027 10.97999954 10.98999977]
flux= [0.2608447 0.26798434 0.27503966 0.28201114 . . . . 0.0020627 0.0020459 0.00202923]
y = [2.60844450e-03 2.67984088e-03 2.75040220e-03 2.82010867e-03
. . . . . 2.07968163e-05 2.06254908e-05 2.04594448e-05]
xlabel = Energy (keV)
ylabel = Photons/sec/keV/cm^2
units = energy
title = Source Model of 1843.pi
plot_prefs = {'symbolstyle': 0, 'linethickness': 3, 'linestyle': 1, 'linecolor': 'red'}
sherpa> model_plot_flux=get_source_plot(2, lo=1.5, hi=2.0).flux
This command stores to the variable "model_plot_flux" the unconvolved
model flux values defining the plot of the source model assigned to data
set 2, between 1.5 and 2.0 keV. The contents may be printed with 'print(model_plot_flux)'.
Example 3
sherpa> print(get_source_image())
sherpa> print(get_source_image(4))
sherpa> print(get_source_image("src"))When called with no arguments from within the print command, the model image array associated with the default data set loaded in the Sherpa session is returned. The user can also specify a data set ID to view the image array for the model associated with that data set.
sherpa> set_model(4, "bbody.b4") sherpa> image_source(4) sherpa> print(get_source_image(4)) name = Source y = [[ 0. -0.6931 -1.0986 ..., -5.5568 -5.5607 -5.5645] [ 0.6931 0. -0.4055 ..., -4.8637 -4.8675 -4.8714] [ 1.0986 0.4055 0. ..., -4.4582 -4.4621 -4.4659] ..., [ 5.366 4.6728 4.2674 ..., -0.1909 -0.1947 -0.1985] [ 5.3706 4.6775 4.272 ..., -0.1862 -0.19 -0.1939] [ 5.3753 4.6821 4.2767 ..., -0.1815 -0.1854 -0.1892]] eqpos = <pytransform.Transform; proxy of < Swig Object of type 'Transform *' at 0x96b4820 < < sky = <pytransform.WCSTANTransform; proxy of <Swig Object of type 'WCSTANTransform *' at 0x96cb138< <
Example 4
sherpa> print(get_source_contour())
sherpa> print(get_source_contour(5))
sherpa> print(get_source_contour("src"))When called with no arguments from within the print command, the 2-D model contour data associated with the default data set loaded in the Sherpa session is returned. The user can also specify a data set ID to view the data defining the contour plot of a 2-D model associated with that data set.
sherpa> set_model(5, "bbody.b5")
sherpa> contour_source(5)
sherpa> print(get_source_contour(5))
x0 = [ 1. 2. 3. ..., 259. 260. 261.]
x1 = [ 1. 1. 1. ..., 216. 216. 216.]
y = [ 0. -0.6322 -1.0535 ..., -0. -0. -0. ]
xlabel = x0 (pixels)
ylabel = x1 (pixels)
title = Source
levels = None
contour_prefs = {'color': 'red', 'style': None, 'thickness': 3}
sherpa> model_contour=get_source_contour(5)
This command stores to the variable "model_contour" the data and
preferences defining the contour plot of the 2-D unconvolved source
model assigned to 2-D data set 5. The contents may be printed with 'print(model_contour)'.
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
- 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, 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
- filtering
- get_filter
- fitting
- calc_stat_info, get_fit, get_stat_info
- info
- get_default_id, list_model_ids, list_stats, show_bkg_model, show_bkg_source
- methods
- get_draws, get_iter_method_name, get_iter_method_opt, get_method
- modeling
- add_model, add_user_pars, clean, create_model_component, delete_bkg_model, delete_model, delete_model_component, get_model, get_model_autoassign_func, 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_component_image, get_source_component_plot, image_model, image_model_component, image_source, image_source_component, integrate, integrate1d, link, load_table_model, load_template_model, load_user_model, normal_sample, reset, save_model, save_source, set_bkg_model, set_full_model, set_model_autoassign_func, set_pileup_model, set_source, set_xsabund, set_xscosmo, set_xsxsect, set_xsxset, t_sample, uniform_sample
- plotting
- get_lrt_plot, get_lrt_results, get_pvalue_plot, get_pvalue_results, get_split_plot, plot_cdf, plot_lrt, plot_model, plot_model_component, plot_pdf, plot_pvalue, plot_scatter, plot_source, plot_source_component, plot_trace
- psfs
- delete_psf, get_kernel, get_psf, load_conv
- saving
- save_delchi, save_resid
- statistics
- get_chisqr_plot, get_delchi_plot, get_prior, get_sampler, get_stat
- utilities
- calc_chisqr, calc_energy_flux, calc_model_sum, calc_photon_flux, calc_source_sum, calc_stat, eqwidth, get_analysis, get_rate
- visualization
- contour_model, contour_ratio, contour_resid, get_ratio, get_resid, image_getregion

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