Last modified: December 2023

URL: https://cxc.cfa.harvard.edu/sherpa/ahelp/guess.html
Jump to: Description · Examples · PARAMETERS · Notes · Bugs · See Also


AHELP for CIAO 4.16 Sherpa

guess

Context: modeling

Synopsis

Estimate the parameter values and ranges given the loaded data.

Syntax

guess(id=None, model=None, limits=True, values=True)

id - int or str, optional
limits - bool
values - bool

Description

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.


Examples

Example 1

Since the source expression contains only one component, guess can be called with no arguments:

>>> set_source(polynom1d.poly)
>>> guess()

Example 2

In this case, guess is called on each component separately.

>>> set_source(gauss1d.line + powlaw1d.cont)
>>> guess(line)
>>> guess(cont)

Example 3

In this example, the values of the src model component are guessed from the "src" data set, whereas the bgnd component is guessed from the "bgnd" data set.

>>> set_source("src", gauss2d.src + const2d.bgnd)
>>> set_source("bgnd", bgnd)
>>> guess("src", src)
>>> guess("bgnd", bgnd)

Example 4

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)

PARAMETERS

The parameters for this function are:

Parameter Definition
id The data set that provides the data. If not given then the default identifier is used, as returned by `get_default_id` .
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 Should the parameter limits be changed? The default is True .
values Should the parameter values be changed? The default is True .

Notes

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 `model` parameter. If given two un-named arguments, then they are interpreted as the `id` and `model` parameters, respectively.

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 xpos and ypos values to lie within the data area. This can be done manually, but `guess` simplifies this, at least for those parameters that are supported. Instrument models - such as an ARF and RMF - should be set up before calling guess.


Bugs

See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

See Also

contrib
renorm
modeling
freeze, link, paramprompt, reset, set_par, thaw, unlink