LogUniformPrior#

class gammapy.modeling.models.LogUniformPrior(**kwargs)[source]#

Bases: Prior

LogUniform Prior.

Equivalent to a uniform prior on the log of the parameter

Parameters:
minfloat, optional

Minimum value. Default is 1e-14.

maxfloat, optional

Maximum value. Default is 1e-10.

Attributes Summary

covariance

default_parameters

frozen

Frozen status of a model, True if all parameters are frozen.

max

Parameter of a Prior.

min

Parameter of a Prior.

parameters

Prior parameters as a PriorParameters object.

parameters_unique_names

tag

type

weight

Weight multiplied to the prior when evaluated.

Methods Summary

__call__(value)

Call evaluate method.

copy(**kwargs)

Deep copy.

evaluate(value, min, max)

Evaluate the likelihood penalization term (hence -2*).

freeze()

Freeze all parameters.

from_dict(data, **kwargs)

Get prior parameters from dictionary.

from_parameters(parameters, **kwargs)

Create model from parameter list.

reassign(datasets_names, new_datasets_names)

Reassign a model from one dataset to another.

to_dict([full_output])

Create dictionary for YAML serialisation.

unfreeze()

Restore parameters frozen status to default.

Attributes Documentation

covariance#
default_parameters = <gammapy.modeling.parameter.PriorParameters object>#
frozen#

Frozen status of a model, True if all parameters are frozen.

max#

Parameter of a Prior.

A prior is a probability density function of a model parameter and can take different forms, including but not limited to Gaussian distributions and uniform distributions. The prior includes information or knowledge about the dataset or the parameters of the fit.

Parameters:
namestr

Name.

valuefloat or Quantity

Value.

unitUnit or str, optional

Unit. Default is “”.

Examples

For a usage example see Priors tutorial.

min#

Parameter of a Prior.

A prior is a probability density function of a model parameter and can take different forms, including but not limited to Gaussian distributions and uniform distributions. The prior includes information or knowledge about the dataset or the parameters of the fit.

Parameters:
namestr

Name.

valuefloat or Quantity

Value.

unitUnit or str, optional

Unit. Default is “”.

Examples

For a usage example see Priors tutorial.

parameters#

Prior parameters as a PriorParameters object.

parameters_unique_names#
tag = ['LogUniformPrior']#
type#
weight#

Weight multiplied to the prior when evaluated.

Methods Documentation

__call__(value)#

Call evaluate method.

copy(**kwargs)#

Deep copy.

static evaluate(value, min, max)[source]#

Evaluate the likelihood penalization term (hence -2*). Note that this is currently a different scaling that the Uniform or Gaussian priors. With current implementation the TS of a source with/without LogUniform prior would be different… TBD

freeze()#

Freeze all parameters.

classmethod from_dict(data, **kwargs)#

Get prior parameters from dictionary.

classmethod from_parameters(parameters, **kwargs)#

Create model from parameter list.

Parameters:
parametersParameters

Parameters for init.

Returns:
modelModel

Model instance.

reassign(datasets_names, new_datasets_names)#

Reassign a model from one dataset to another.

Parameters:
datasets_namesstr or list

Name of the datasets where the model is currently defined.

new_datasets_namesstr or list

Name of the datasets where the model should be defined instead. If multiple names are given the two list must have the save length, as the reassignment is element-wise.

Returns:
modelModel

Reassigned model.

to_dict(full_output=False)#

Create dictionary for YAML serialisation.

unfreeze()#

Restore parameters frozen status to default.