get_model_pars

sherpa.ui.get_model_pars(model)

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:

list of str

See also

create_model_component

Create a model component.

get_model

Return the model expression for a data set.

get_model_type

Describe a model expression.

get_source

Return 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 contaoins 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']