ParameterEstimator#

class gammapy.estimators.ParameterEstimator(n_sigma=1, n_sigma_ul=2, null_value=1e-150, selection_optional=None, fit=None, reoptimize=True)[source]#

Bases: gammapy.estimators.core.Estimator

Model parameter estimator.

Estimates a model parameter for a group of datasets. Compute best fit value, symmetric and delta(TS) for a given null value. Additionally asymmetric errors as well as parameter upper limit and fit statistic profile can be estimated.

Parameters
n_sigmaint

Sigma to use for asymmetric error computation. Default is 1.

n_sigma_ulint

Sigma to use for upper limit computation. Default is 2.

null_valuefloat

Which null value to use for the parameter.

selection_optionallist of str, optional

Which additional quantities to estimate. Available options are:

  • “all”: all the optional steps are executed.

  • “errn-errp”: estimate asymmetric errors on parameter best fit value.

  • “ul”: estimate upper limits.

  • “scan”: estimate fit statistic profiles.

Default is None so the optional steps are not executed.

fitFit

Fit instance specifying the backend and fit options.

reoptimizebool

Re-optimize other free model parameters. Default is True.

Attributes Summary

config_parameters

Configuration parameters.

selection_optional

tag

Methods Summary

copy()

Copy estimator.

estimate_best_fit(datasets, parameter)

Estimate parameter asymmetric errors.

estimate_counts(datasets)

Estimate counts for the flux point.

estimate_errn_errp(datasets, parameter)

Estimate parameter asymmetric errors.

estimate_npred(datasets)

Estimate npred for the flux point.

estimate_scan(datasets, parameter)

Estimate parameter statistic scan.

estimate_ts(datasets, parameter)

Estimate parameter ts.

estimate_ul(datasets, parameter)

Estimate parameter ul.

run(datasets, parameter)

Run the parameter estimator.

Attributes Documentation

config_parameters#

Configuration parameters.

selection_optional#
tag = 'ParameterEstimator'#

Methods Documentation

copy()#

Copy estimator.

estimate_best_fit(datasets, parameter)[source]#

Estimate parameter asymmetric errors.

Parameters
datasetsDatasets

Datasets.

parameterParameter

For which parameter to get the value.

Returns
resultdict

Dictionary with the various parameter estimation values. Entries are:

  • parameter.name: best fit parameter value.

  • “stat”: best fit total stat.

  • “success”: boolean flag for fit success.

  • parameter.name_err: covariance-based error estimate on parameter value.

static estimate_counts(datasets)[source]#

Estimate counts for the flux point.

Parameters
datasetsDatasets

Datasets.

Returns
resultdict

Dictionary with an array with one entry per dataset with the sum of the masked counts.

estimate_errn_errp(datasets, parameter)[source]#

Estimate parameter asymmetric errors.

Parameters
datasetsDatasets

Datasets.

parameterParameter

For which parameter to get the value.

Returns
resultdict

Dictionary with the parameter asymmetric errors. Entries are:

  • {parameter.name}_errp : positive error on parameter value.

  • {parameter.name}_errn : negative error on parameter value.

static estimate_npred(datasets)[source]#

Estimate npred for the flux point.

Parameters
datasetsDatasets

Datasets.

Returns
resultdict

Dictionary with an array with one entry per dataset with the sum of the masked npred.

estimate_scan(datasets, parameter)[source]#

Estimate parameter statistic scan.

Parameters
datasetsDatasets

The datasets used to estimate the model parameter.

parameterParameter

For which parameter to get the value.

Returns
resultdict

Dictionary with the parameter fit scan values. Entries are:

  • parameter.name_scan : parameter values scan.

  • “stat_scan” : fit statistic values scan.

estimate_ts(datasets, parameter)[source]#

Estimate parameter ts.

Parameters
datasetsDatasets

Datasets.

parameterParameter

For which parameter to get the value.

Returns
resultdict

Dictionary with the test statistic of the best fit value compared to the null hypothesis. Entries are:

  • “ts” : fit statistic difference with null hypothesis.

  • “npred” : predicted number of counts per dataset.

  • “stat_null” : total stat corresponding to the null hypothesis

estimate_ul(datasets, parameter)[source]#

Estimate parameter ul.

Parameters
datasetsDatasets

The datasets used to estimate the model parameter.

parameterParameter

For which parameter to get the value.

Returns
resultdict

Dictionary with the parameter upper limits. Entries are:

  • parameter.name_ul : upper limit on parameter value.

run(datasets, parameter)[source]#

Run the parameter estimator.

Parameters
datasetsDatasets

The datasets used to estimate the model parameter.

parameterstr or Parameter

For which parameter to run the estimator.

Returns
resultdict

Dictionary with the various parameter estimation values.