add_user_pars¶
-
sherpa.ui.
add_user_pars
(modelname, parnames, parvals=None, parmins=None, parmaxs=None, parunits=None, parfrozen=None)¶ Add parameter information to a user model.
- Parameters
modelname (str) – The name of the user model (created by load_user_model).
parnames (array 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).
parvals (array of number, optional) – The default values of the parameters. If not given each parameter is set to 0.
parmins (array of number, optional) – The minimum values of the parameters (hard limit). The default value is -3.40282e+38.
parmaxs (array of number, optional) – The maximum values of the parameters (hard limit). The default value is 3.40282e+38.
parunits (array of str, optional) – The units of the parameters. This is only used in screen output (i.e. is informational in nature).
parfrozen (array 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)