RegularizedFluxPointsEstimator#
- class gammapy.estimators.RegularizedFluxPointsEstimator[source]#
Bases:
EstimatorEstimate 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
PiecewiseNormSpectralModeldefined on a set of energy nodes, and fitting the resulting normalization parameters simultaneously.- Parameters:
- energy_nodes
Quantity Energy nodes defining the piecewise normalization bins.
- models
Models 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.
- fit
Fit, optional Fit instance used for likelihood minimization and confidence interval estimation. If None, a default
Fitis 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.
- energy_nodes
- Returns:
- resultdict
Dictionary with the following keys:
"flux_points"dict ofFluxPointsFlux points for each input model, keyed by model name.
"models"ModelsModels used in the fit, including the regularized components.
"stat_sum_likelihood"floatSum of the likelihood terms.
"stat_sum_penalty"floatSum 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
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:
- Returns:
- resultdict
Dictionary with the following keys:
flux_pointsdict ofFluxPointsEstimated flux points for each input model.
modelsModelsModels used in the fit.
stat_sum_likelihoodfloatSum of likelihood contributions.
stat_sum_penaltyfloatSum of penalty contributions.
- __init__(energy_nodes, models, penalty_name='L2', lambda_=1, selection_optional=None, fit=None, reoptimize=False)[source]#
- classmethod __new__(*args, **kwargs)#