RegularizedFluxPointsEstimator#

class gammapy.estimators.RegularizedFluxPointsEstimator[source]#

Bases: Estimator

Estimate flux points using a regularized likelihood approach.

This estimator computes flux points by fitting piecewise-normalized spectral models to datasets, optionally including Gaussian prior penalties on the normalization parameters. Regularization can be used to stabilize the fit or enforce smoothness across energy bins.

The estimator works by multiplying each input spectral model with a PiecewiseNormSpectralModel defined on a set of energy nodes, and fitting the resulting normalization parameters simultaneously.

Parameters:
energy_nodesQuantity

Energy nodes defining the piecewise normalization bins.

modelsModels

Spectral models for which flux points are estimated.

penalty_name{“L2”, “smoothness”, “unpenalized”, None}, optional

Name of the regularization penalty to apply. If None or “unpenalized”, no penalty is used. Default is “L2”.

lambda_float, optional

Regularization strength. Larger values increase the impact of the penalty term. Default is 1.

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 flux.

  • “ul”: estimate upper limits.

Default is None so the optional steps are not executed.

fitFit, optional

Fit instance used for likelihood minimization and confidence interval estimation. If None, a default Fit is created.

reoptimizebool, optional

Whether to reoptimize non-flux-point model parameters during the fit. If False, all other model parameters are frozen. Default is False.

Returns:
resultdict

Dictionary with the following keys:

  • "flux_points"dict of FluxPoints

    Flux points for each input model, keyed by model name.

  • "models"Models

    Models used in the fit, including the regularized components.

  • "stat_sum_likelihood"float

    Sum of the likelihood terms.

  • "stat_sum_penalty"float

    Sum of the penalty contributions.

Notes

The regularization is implemented via Gaussian prior penalties added to the likelihood:

  • "L2" applies a quadratic penalty around a mean normalization of 1.

  • "smoothness" enforces smooth variations between adjacent energy bins.

The estimator returns flux points in sed_type="likelihood" format, making them suitable for further statistical analyses.

Attributes Summary

tag

Methods Summary

run(datasets)

Run the regularized flux points estimation.

Attributes Documentation

tag = 'RegularizedFluxPointsEstimator'#

Methods Documentation

run(datasets)[source]#

Run the regularized flux points estimation.

Parameters:
datasetsDatasets or list of Dataset

Datasets to fit.

Returns:
resultdict

Dictionary with the following keys:

  • flux_pointsdict of FluxPoints

    Estimated flux points for each input model.

  • modelsModels

    Models used in the fit.

  • stat_sum_likelihoodfloat

    Sum of likelihood contributions.

  • stat_sum_penaltyfloat

    Sum of penalty contributions.

__init__(energy_nodes, models, penalty_name='L2', lambda_=1, selection_optional=None, fit=None, reoptimize=False)[source]#
classmethod __new__(*args, **kwargs)#