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

URL: http://cxc.harvard.edu/sherpa/ahelp/get_model_component.html
Jump to: Description · Examples · Bugs · See Also


AHELP for CIAO 4.6 Sherpa v1

get_model_component

Context: modeling

Synopsis

Returns the parameters for the specified model component

Syntax

get_model_component(name)

Description

  • name - variable name representing the model component

The get_model_component command returns the parameter values and settings currently defining the specified model component (the get_model function returns the full model by data set ID). This command is useful in scripting since any portion of the model parameter information it returns can be stored to a variables and therefore easily accessed and manipulated within a script. Furthermore, it allows the user to view model settings before the model has been assigned to a data set, whereas the show_model and get_model commands do not. The show_model command ("ahelp show_model") is recommended to simply print the current model to the screen after the model has been assigned to a data set.

Example 1

sherpa> src1 = get_model_component("p1")

Store the parameters defining the model component "p1" to the variable "src1."

sherpa> set_source(xsphabs.abs1*powlaw1d.p1)
sherpa> fit()
sherpa> src1 = get_model_component("p1")
sherpa> print(src1)
powlaw1d.p1
   Param        Type          Value          Min          Max      Units
   -----        ----          -----          ---          ---      -----
   p1.gamma     thawed      1.63768          -10           10           
   p1.ref       frozen            1 -3.40282e+38  3.40282e+38           
   p1.ampl      thawed  0.000131805            0  3.40282e+38   

sherpa> print(src1.gamma)
val         = 1.63768019074
min         = -10.0
max         = 10.0
units       = 
frozen      = False
link        = None
default_val = 1.0
default_min = -10.0
default_max = 10.0

sherpa> print(src1.gamma.max)
10.0

sherpa> src1.gamma.max = 12.

Return the current parameter values defining the power law model component named "p1" and store them in the variable "src1". Return the individual model parameter "p1.gamma" stored in "src1"; change the maximum value for this parameter to a new value.

Example 2

sherpa> create_model_component("gauss1d", "g1")
sherpa> g1_pars = get_model_component("g1")
sherpa> g1_pars.fwhm.val = 3.
sherpa> g1pars.fwhm.frozen = True

Create a 1D Gaussian model component named "g1" and store it to the variable "g1_pars". Use the "g1_pars" variable to set the FWHM value of the model to 3, and then freeze it so that it does not vary in the next fit.

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_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_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

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:   cxcweb@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2014. All rights reserved.