Chandra X-Ray Observatory
Skip to the navigation links
Last modified: December 2013

Jump to: Description · Examples · Bugs · See Also

AHELP for CIAO 4.9 Sherpa v1


Context: modeling


Returns the data and preferences defining the convolved model component plot


get_model_component_plot([id], name)


  • 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")
  • name - the variable name(s) representing the model component(s)

The get_model_component_plot() command returns the data arrays and preferences which define a plot of convolved model components created with the plot_model_component() command. (The get_source_component_plot command is available for returning information pertaining to plots of unconvolved model components.) Once a data set has been loaded into the Sherpa session, this command can be used to list the xlo, xhi, and y data arrays associated with a specified model component, as well as the x label, y label, title, and other (histogram) plotting preferences and settings. The information returned by get_model_component_plot() may be stored in variables, or printed to the screen, as shown in the examples section.


Field name Description
xlo grid array, low bins (independent variable)
xhi grid array, high bins (independent variable)
y convolved model amplitudes (dependent variable)
xlabel The label for the X axis
ylabel The label for the Y axis
title The plot title
histo_prefs dictionary of histogram plotting preferences

Note that the show_model command ("ahelp show_model") is recommended to simply print the current model to the screen.

Example 1

sherpa> print(get_model_component_plot(2, "p1"))

Return the data arrays and preferences defining the plot of the convolved power law model component "p1" associated with data set 2.

sherpa> load_data(2, "source_pi.fits")
sherpa> set_source(2, xsphabs.abs1 * powlaw1d.p1)

sherpa> print get_model_component_plot(2, "p1")
xlo    = [  1.0000e+00   2.0000e+00   3.0000e+00 ...,   1.0220e+03   1.0230e+03
xhi    = [    2.     3.     4. ...,  1023.  1024.  1025.]
y      = [  1.2732e-04   6.3658e-05   4.2439e-05 ...,   1.2458e-07   1.2445e-07
xlabel = Channel
ylabel = Counts/sec
title  = Model component: powlaw1d.p1
histo_prefs = {'linethickness': 2, 'symbolcolor': None, 'symbolfill': None, 'xlog': False, 'ylog': False, 'symbolangle': None, 'errthickness': None, 'fillcolor': None, 'linecolor': 'orange', 'errstyle': None, 'linestyle': 1, 'symbolstyle': 0, 'errcolor': None, 'fillstyle': None, 'fillopacity': None, 'yerrorbars': False, 'symbolsize': None}

Example 2

sherpa> set_source(gauss1d.g1 + const1d.c1)
sherpa> gauss_plot = get_model_component_plot("g1")
sherpa> gauss_plot.histo_prefs["symbolcolor"] = "cyan"

Store the plot information returned by the get_model_component_plot() command for the Guass 1D model component "g1" to the variable "gauss_plot". Use the "gauss_plot" variable to change the color of plot symbols to cyan.


See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

See Also

get_conf, get_covar, get_int_proj, get_int_unc, get_proj, get_reg_proj, get_reg_unc
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
calc_stat_info, get_fit, get_stat_info
get_default_id, list_model_ids, list_stats, show_bkg_model, show_bkg_source
get_draws, get_iter_method_name, get_iter_method_opt, get_method
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_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_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
get_lrt_plot, get_lrt_results, get_pvalue_plot, get_pvalue_results, get_split_plot, plot_cdf, plot_model, plot_model_component, plot_pdf, plot_pvalue, plot_scatter, plot_source, plot_source_component, plot_trace
delete_psf, get_kernel, get_psf, load_conv
save_delchi, save_resid
get_chisqr_plot, get_delchi_plot, get_prior, get_sampler, get_stat
calc_chisqr, calc_energy_flux, calc_model_sum, calc_photon_flux, calc_source_sum, calc_stat, eqwidth, get_analysis, get_rate
contour_model, contour_ratio, contour_resid, get_ratio, get_resid, image_getregion

Last modified: December 2013
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email: Smithsonian Institution, Copyright © 1998-2017. All rights reserved.