add_user_pars

sherpa.astro.ui.add_user_pars(modelname, parnames, parvals=None, parmins=None, parmaxs=None, parunits=None, parfrozen=None) → None

Add parameter information to a user model.

Parameters:
modelnamestr

The name of the user model (created by load_user_model).

parnamesarray of str

The names of the parameters. The order of all the parameter arrays must match that expected by the model function (the first argument to load_user_model).

parvalsarray of number, optional

The default values of the parameters. If not given each parameter is set to 0.

parminsarray of number, optional

The minimum values of the parameters (hard limit). The default value is -3.40282e+38.

parmaxsarray of number, optional

The maximum values of the parameters (hard limit). The default value is 3.40282e+38.

parunitsarray of str, optional

The units of the parameters. This is only used in screen output (i.e. is informational in nature).

parfrozenarray of bool, optional

Should each parameter be frozen. The default is that all parameters are thawed.

See also

add_model

Create a user-defined model class.

load_user_model

Create a user-defined model.

set_par

Set the value, limits, or behavior of a model parameter.

Notes

The parameters must be specified in the order that the function expects. That is, if the function has two parameters, pars[0]=’slope’ and pars[1]=’y_intercept’, then the call to add_user_pars must use the order [“slope”, “y_intercept”].

Examples

Create a user model for the function profile called “myprof”, which has two parameters called “core” and “ampl”, both of which will start with a value of 0.

>>> load_user_model(profile, "myprof")
>>> add_user_pars("myprof", ["core", "ampl"])

Set the starting values, minimum values, and whether or not the parameter is frozen by default, for the “prof” model:

>>> pnames = ["core", "ampl", "intflag"]
>>> pvals = [10, 200, 1]
>>> pmins = [0.01, 0, 0]
>>> pfreeze = [False, False, True]
>>> add_user_pars("prof", pnames, pvals,
...               parmins=pmins, parfrozen=pfreeze)