Synopsis
Link a parameter to a value.
Syntax
link(par, val)
Description
A parameter can be linked to another parameter value, or function of that value, rather than be an independent value. As the linked-to values change, the parameter value will change.
Examples
Example 1
The fwhm parameter of the g2 model is set to be the same as the fwhm parameter of the g1 model.
>>> link(g2.fwhm, g1.fwhm)
Example 2
Fix the pos parameter of g2 to be 2.3 more than the pos parameter of the g1 model.
>>> gauss1d.g1 >>> gauss1d.g2 >>> g1.pos = 12.2 >>> link(g2.pos, g1.pos + 2.3) >>> g2.pos.val 14.5 >>> g1.pos = 12.1 >>> g2.pos.val 14.399999999999999
PARAMETERS
The parameters for this function are:
Parameter | Type information | Definition |
---|---|---|
par | str or Parameter | The parameter to link. |
val | The value - which can be a numeric value or a function of other model parameters, to set `par` to. |
Notes
The link attribute of the parameter is set to match the mathematical expression used for `val` .
In the following, the fit will vary the pos parameter even though the src2 component is not part of the source expression (this behavior changed in the 4.16.1 release):
>>> set_source(1, gauss1d.src1) >>> gauss1d.src2 >>> link(src1.pos, src2.pos) >>> fit(1)
The lpars attribute of a source model will include these "extra" parameters:
>>> get_source(1).lpars (<Parameter 'pos' of model 'src2'>,)
Changes in CIAO
Changed in CIAO 4.17
Source models no longer have to contain the linked parameter.
Bugs
See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.
See Also
- contrib
- renorm
- data
- get_bkg_chisqr_plot, get_bkg_delchi_plot, get_bkg_fit_plot, get_bkg_model_plot, get_bkg_plot, get_bkg_ratio_plot, get_bkg_resid_plot, get_bkg_source_plot
- info
- list_model_ids, show_bkg_model, show_bkg_source
- modeling
- add_model, add_user_pars, clean, create_model_component, delete_bkg_model, delete_model, delete_model_component, freeze, get_model, get_model_autoassign_func, get_model_component, get_model_component_image, get_model_component_plot, get_model_plot, get_num_par, get_num_par_frozen, get_num_par_thawed, get_order_plot, get_par, get_pileup_model, get_source, get_source_component_image, get_source_component_plot, get_source_contour, get_source_image, get_source_plot, guess, image_model, image_model_component, image_source, image_source_component, integrate, load_table_model, load_template_interpolator, load_template_model, load_user_model, normal_sample, paramprompt, reset, save_model, save_source, set_bkg_model, set_bkg_source, set_full_model, set_model, set_model_autoassign_func, set_par, set_pileup_model, set_source, t_sample, thaw, uniform_sample, unlink
- plotting
- get_cdf_plot, get_pdf_plot, get_pvalue_plot, get_pvalue_results, plot_cdf, plot_model, plot_model_component, plot_pdf, plot_pvalue, plot_scatter, plot_source, plot_source_component, plot_trace
- psfs
- delete_psf, load_conv
- saving
- save_delchi, save_resid
- utilities
- calc_chisqr, calc_energy_flux, calc_model_sum, calc_photon_flux, calc_source_sum, calc_stat, eqwidth
- visualization
- contour_model, contour_ratio, contour_resid