SamplesKDEPrior#

class gammapy.modeling.models.SamplesKDEPrior[source]#

Bases: Prior

Prior based on a Gaussian kernel density estimate (KDE) constructed from (optionally weighted) samples.

Parameters:
samplesndarray

One-dimensional samples used to build the KDE. Shape (n_samples,) or any array that can be flattened to this shape.

weightsndarray, optional

Weights associated with the samples. Must have the same length as samples. If not given, all samples are assigned equal weight. Weights are normalised internally to sum to 1.

Attributes Summary

Methods Summary

evaluate(value)

Evaluate the prior contribution to the fit statistic.

from_dict(data)

Create prior from dictionary.

to_dict()

Convert prior to dictionary for YAML serialization.

Attributes Documentation

default_parameters = <gammapy.modeling.parameter.PriorParameters object>#
tag = ['SamplesKDEPrior']#

Methods Documentation

evaluate(value)[source]#

Evaluate the prior contribution to the fit statistic.

This returns -2 log p(value) where p is given by the KDE.

classmethod from_dict(data)[source]#

Create prior from dictionary.

to_dict()[source]#

Convert prior to dictionary for YAML serialization.

__init__(samples, weights=None)[source]#
classmethod __new__(*args, **kwargs)#