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
guess
routine 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.Parameter instance) – If the parameter is frozen then nothing is changed.
limits (bool, optional) – The parameter limits are not changed when
values
isTrue
andlimits
isFalse
. 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’sreset
method).
Examples
Create an initial guess for the
mdl.fwhm
parameter, changing both the value and the soft limits, based on thex
andy
arrays.>>> vals = guess_fwhm(y, x) >>> param_apply_limits(vals, mdl.fwhm)
Change the soft limits for the
xpos
andypos
parameters of thesrc
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)