- sherpa.astro.ui.guess(id=None, model=None, limits=True, values=True)
Estimate the parameter values and ranges given the loaded data.
The guess function can change the parameter values and limits to match the loaded data. This is generally limited to changing the amplitude and position parameters (sometimes just the values and sometimes just the limits). The parameters that are changed depend on the type of model.
id (int or str, optional) – The data set that provides the data. If not given then the default identifier is used, as returned by
model – Change the parameters of this model component. If
None, then the source expression is assumed to consist of a single component, and that component is used.
limits (bool) – Should the parameter limits be changed? The default is
values (bool) – Should the parameter values be changed? The default is
Return the default data set identifier.
Reset the model parameters to their default settings.
Set the value, limits, or behavior of a model parameter.
The function does not follow the normal Python standards for parameter use, since it is designed for easy interactive use. When called with a single un-named argument, it is taken to be the
modelparameter. If given two un-named arguments, then they are interpreted as the
The guess function can reduce the time required to fit a data set by moving the parameters closer to a realistic solution. It can also be useful because it can set bounds on the parameter values based on the data: for instance, many two-dimensional models will limit their
yposvalues to lie within the data area. This can be done manually, but
guesssimplifies this, at least for those parameters that are supported. Instrument models - such as an ARF and RMF - should be set up before calling guess.
Since the source expression contains only one component, guess can be called with no arguments:
>>> set_source(polynom1d.poly) >>> guess()
In this case, guess is called on each component separately.
>>> set_source(gauss1d.line + powlaw1d.cont) >>> guess(line) >>> guess(cont)
In this example, the values of the
srcmodel component are guessed from the “src” data set, whereas the
bgndcomponent is guessed from the “bgnd” data set.
>>> set_source("src", gauss2d.src + const2d.bgnd) >>> set_source("bgnd", bgnd) >>> guess("src", src) >>> guess("bgnd", bgnd)
Set the source model for the default dataset. Guess is run to determine the values of the model component “p1” and the limits of the model component “g1”:
>>> set_source(powlaw1d.p1 + gauss1d.g1) >>> guess(p1, limits=False) >>> guess(g1, values=False)