param_apply_limits
- sherpa.utils.guess.param_apply_limits(param_limits: ValueAndRange, par, limits: bool = True, values: bool = True) None[source] [edit on github]
Apply the given limits to a parameter.
This is primarily used by the
guessroutine of a model to set one or more of its parameters to a given value or range.- Parameters:
- param_limits
dict - par
sherpa.models.parameter.Parameterinstance If the parameter is frozen then nothing is changed.
- limitsbool,
optional The parameter limits are not changed when
valuesisTrueandlimitsisFalse. In all other cases the limits are changed.- valuesbool,
optional When
Truethe parameter value is changed and the original value is stored (for use by the parameter’sresetmethod).
- param_limits
Examples
Create an initial guess for the
mdl.fwhmparameter, changing both the value and the soft limits, based on thexandyarrays.>>> vals = guess_fwhm(y, x) >>> param_apply_limits(vals, mdl.fwhm)
Change the soft limits for the
xposandyposparameters of thesrcmodel:>>> 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)