get_model_pars
- sherpa.ui.get_model_pars(model: ModelType) list[str]
Return the names of the parameters of a model.
Added in version 4.16.1: Linked components are now included without having to include them in the model expression.
- Parameters:
model (str or a sherpa.models.model.Model object)
- Returns:
names – The names of the parameters in the model expression. These names do not include the name of the parent component.
- Return type:
See also
create_model_componentCreate a model component.
get_modelReturn the model expression for a data set.
get_model_typeDescribe a model expression.
get_sourceReturn the source model expression for a data set.
Examples
>>> mdl = gauss2d.src + const2d.bgnd >>> get_model_pars(mdl) ['fwhm', 'xpos', 'ypos', 'ellip', 'theta', 'ampl', 'c0']
The return value is unchanged if the two models are linked together, such as setting the background amplitude to 1% of the source amplitude:
>>> bgnd.c0 = 0.01 * src.ampl >>> get_model_pars(mdl) ['fwhm', 'xpos', 'ypos', 'ellip', 'theta', 'ampl', 'c0']
If a model expression contains linked parameters that are not part of the model expression then they will also be included (in this case both the const2d and scale1d parameters are named ‘c0’, hence the duplication):
>>> scale1d.sep <Scale1D model instance 'scale1d.sep'> >>> src.ypos = src.xpos + sep.c0 >>> get_model_pars(mdl) ['fwhm', 'xpos', 'ypos', 'ellip', 'theta', 'ampl', 'c0', 'c0']