sherpa.utils.param_apply_limits(param_limits, par, limits=True, values=True)[source] [edit on github]

Apply the given limits to a parameter.

This is primarily used by the guess routine of a model to set one or more of its parameters to a given value or range.

  • param_limits (dict) –

  • par (sherpa.models.parameter.Parameter instance) – If the parameter is frozen then nothing is changed.

  • limits (bool, optional) – The parameter limits are not changed when values is True and limits is False. In all other cases the limits are changed.

  • values (bool, optional) – When True the parameter value is changed and the original value is stored (for use by the parameter’s reset method).


Create an initial guess for the mdl.fwhm parameter, changing both the value and the soft limits, based on the x and y arrays.

>>> vals = guess_fwhm(y, x)
>>> param_apply_limits(vals, mdl.fwhm)

Change the soft limits for the xpos and ypos parameters of the src model:

>>> pos = guess_position(y, x0, x1)
>>> param_apply_limits(pos[0], src.xpos, limits=True, values=False)
>>> param_apply_limits(pos[1], src.ypos, limits=True, values=False)