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: modeling


Return a plot, contour, or image of a model, or the associated preferences


get_model_plot( [id] )
get_model_contour( [id] )
get_model_image( [id] )


  • 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")


The get_model_plot command returns a model plot object which holds references to various plot preferences and data arrays. The attributes are:

Field name Description
x The bin centers (independent variable)
y The value of the dependent variable
yerr The error on y
xerr The half-width of the bin
xlabel The label for the X axis
ylabel The label for the Y axis
title The plot title
plot_prefs The preferences for the plot

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


The get_model_plot_prefs command returns a dictionary of model plot preferences. For example:

{'symbolstyle': 0, 'linethickness': 3, 'linestyle': 1, 'linecolor': 'red'}

Users can change preferences as desired in the set returned by this function, as shown below in the examples. These preferences changes the appearance of models plotted using the following commands: plot_model(), plot_bkg_model(), the "fit" versions of these commands, such as plot_fit(), plot_bkg_fit(), and plot_fit_delchi().


The get_model_contour command returns a model contour object which holds references to various plot preferences and data arrays. The attributes are:

Field name Description
x0 The coordinate values for the first axis as a 1D array
x1 The coordinate values for the second axis as a 1D array
y The model value at each point of (x0,x1) as a 1D array
levels The levels used for drawing contours
xlabel The label for the X axis
ylabel The label for the Y axis
title The plot title
contour_prefs The preferences for the plot


The get_model_contour_prefs command returns a dictionary of model contour preferences. For example:

{'color': 'red', 'style': None, 'thickness': 3}


The get_model_image command returns an image object which holds the reference to the image array. The attributes are:

Field name Description
name A label for the object
y The model data (as a 2D array)
eqpos Information on the world coordinate system (if available)
sky Information on the physical coordinate system (if available)

Example 1

sherpa> p = get_model_plot_prefs()
sherpa> p["xlog"] = True
sherpa> p["ylog"] = True
sherpa> p["symbolstyle"] = chips_none
sherpa> p["linetyle"] = chips_dot
sherpa> p["linecolor"] = "orange"
sherpa> p["linethickness"] = 2

Change the defaults for plot_model() so that:

  • both the X and Y axes will be drawn using a log scale;
  • no symbols will be drawn;
  • the points will be connected using a dotted, orange line of thickness 2.

Example 2

sherpa> get_model_plot()

Return a model plot object for the default dataset.

Example 3

sherpa> get_model_contour("src")

Return a model contour object for dataset "src".


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_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_component_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, 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_split_plot, plot_model, plot_model_component, plot_source, plot_source_component
delete_psf, get_kernel, get_psf, load_conv
save_delchi, save_resid
get_chisqr_plot, get_delchi_plot, 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 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.