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:
- modelname
str The name of the user model (created by
load_user_model).- parnames
arrayofstr 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
arrayofnumber,optional The default values of the parameters. If not given each parameter is set to 0.
- parmins
arrayofnumber,optional The minimum values of the parameters (hard limit). The default value is -3.40282e+38.
- parmaxs
arrayofnumber,optional The maximum values of the parameters (hard limit). The default value is 3.40282e+38.
- parunits
arrayofstr,optional The units of the parameters. This is only used in screen output (i.e. is informational in nature).
- parfrozen
arrayofbool,optional Should each parameter be frozen. The default is that all parameters are thawed.
- modelname
See also
add_modelCreate a user-defined model class.
load_user_modelCreate a user-defined model.
set_parSet 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
profilecalled “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)