Fit#

class gammapy.modeling.Fit(backend='minuit', optimize_opts=None, covariance_opts=None, confidence_opts=None, store_trace=False)#

Bases: object

Fit class.

The fit class provides a uniform interface to multiple fitting backends. Currently available: “minuit”, “sherpa” and “scipy”

Parameters
backend{“minuit”, “scipy” “sherpa”}

Global backend used for fitting, default : minuit

optimize_optsdict

Keyword arguments passed to the optimizer. For the "minuit" backend see https://iminuit.readthedocs.io/en/stable/reference.html#iminuit.Minuit for a detailed description of the available options. If there is an entry ‘migrad_opts’, those options will be passed to iminuit.Minuit.migrad().

For the "sherpa" backend you can from the options:

  • "simplex"

  • "levmar"

  • "moncar"

  • "gridsearch"

Those methods are described and compared in detail on http://cxc.cfa.harvard.edu/sherpa/methods/index.html. The available options of the optimization methods are described on the following pages in detail:

For the "scipy" backend the available options are described in detail here: https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html

covariance_optsdict

Covariance options passed to the given backend.

confidence_optsdict

Extra arguments passed to the backend. E.g. iminuit.Minuit.minos supports a maxcall option. For the scipy backend confidence_opts are forwarded to brentq. If the confidence estimation fails, the bracketing interval can be adapted by modifying the the upper bound of the interval (b) value.

store_tracebool

Whether to store the trace of the fit

Attributes Summary

minuit

Iminuit object

Methods Summary

confidence(datasets, parameter[, sigma, ...])

Estimate confidence interval.

covariance(datasets)

Estimate the covariance matrix.

optimize(datasets)

Run the optimization.

run(datasets)

Run all fitting steps.

stat_contour(datasets, x, y[, numpoints, sigma])

Compute stat contour.

stat_profile(datasets, parameter[, reoptimize])

Compute fit statistic profile.

stat_surface(datasets, x, y[, reoptimize])

Compute fit statistic surface.

Attributes Documentation

Methods Documentation