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

Jump to: Description · Examples · Bugs · See Also

AHELP for CIAO 4.3 Sherpa v1


Context: plotting


Plots individual convolved source model components


plot_model_component([id], name, [replot=False, overplot=False])


The plot_model_component command plots one, or a combination of, individual source model components to allow the user to quickly visualize the contribution to the full model being used to fit data. The model components will be convolved with any assigned convolution models, e.g. PSF or PHA responses; the plot_source_component command is available for plotting unconvolved model components.

Argument Default Description
id 1 (can be changed, see "ahelp get_default_id") the id of the dataset to plot
name no default - required argument variable name(s) representing the model component(s)
replot False should previously-calculated arrays be used to create the plot?
overplot False If True then add the data to the current plot, otherwise erase the frame and create a new plot.

The plot is displayed in a ChIPS plotting window. If there is no plotting window open, one is created. If a plotting window exists, the overplot parameter value determines whether the new plot is overlaid on any existing plots in the window or if the window is cleared before the plot is drawn.

ChIPS commands may be used within Sherpa to modify plot characteristics and create hardcopies; refer to the ChIPS website for information.

The default values for the plot can be read - and changed - using the get_model_plot_prefs() command (set_xlog/set_ylog and set_xlinear/set_ylinear are also available for setting the scale of plot axes to logarithmic or linear). See also

unix% ahelp get_model_component_plot

and the examples below for more information.

Plotting Multiple Objects

To plot multiple Sherpa objects - e.g. data, model, fit, residuals - in a single window, use the plot command.

Example 1

sherpa> set_model("xsphabs.abs1*powlaw1d.p1")
sherpa> set_xlog()
sherpa> set_ylog()
sherpa> plot_model_component("p1")
sherpa> print_window()

Plot the convolved power law source model component "p1" which has been used in the fit to default dataset 1. Use the Sherpa commands set_xlog/set_ylog to change the scaling of the axes to logarithmic and the ChIPS print_window command to send a postscript version of the plot to the default printer (since no argument is given).

Example 2

sherpa> set_model("src", "gauss1d.g1+beta1d.b1+const1d.c1")
sherpa> fit("src")
sherpa> plot_data("src")
sherpa> plot_model_component("g2", overplot=True)

Plot dataset "src" and then overplot the fitted, convolved Gaussian 1D source model component "g1".

Example 3

sherpa> set_model(2, "*xspowerlaw.spl+gal*xsapec.sth")
sherpa> fit(2)
sherpa> plot_model_component(2, "gal*sth")

Plot the contribution of the product of the "gal" and "sth" model components to the full model assigned to data set 2.


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

See Also

get_data_prof, get_data_prof_prefs, get_delchi_prof, get_delchi_prof_prefs, get_fit_prof, get_model_prof, get_model_prof_prefs, get_resid_prof, get_resid_prof_prefs, get_source_prof, get_source_prof_prefs, plot_chart_spectrum, prof_data, prof_delchi, prof_fit, prof_fit_delchi, prof_fit_resid, prof_model, prof_resid, prof_source
get_arf_plot, get_bkg_plot
list_model_ids, show_bkg_model, show_bkg_source
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_source, get_source_component_image, get_source_component_plot, image_model, image_model_component, image_source, image_source_component, integrate, link, load_table_model, load_user_model, 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
get_energy_flux_hist, get_photon_flux_hist, get_split_plot, plot, plot_arf, plot_bkg, plot_chisqr, plot_data, plot_delchi, plot_energy_flux, plot_fit, plot_model, plot_order, plot_photon_flux, plot_ratio, plot_resid, plot_source, plot_source_component, set_xlinear, set_xlog, set_ylinear, set_ylog
delete_psf, load_conv, plot_kernel
save_delchi, save_resid
get_chisqr_plot, get_delchi_plot
calc_chisqr, calc_energy_flux, calc_model_sum, calc_photon_flux, calc_source_sum, calc_stat, eqwidth
contour_model, contour_ratio, contour_resid, get_ratio, get_resid

Last modified: December 2010
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-2019. All rights reserved.