PriorParameter#

class gammapy.modeling.PriorParameter(name, value, unit='', scale=1, min=nan, max=nan, error=0, scale_method='scale10', scale_transform='lin')[source]#

Bases: Parameter

Attributes Summary

conf_max

Confidence maximum value as a float.

conf_min

Confidence minimum value as a float.

error

factor

Factor as a float.

factor_max

Factor maximum as a float (used by the optimizer).

factor_min

Factor minimum as a float (used by the optimizer).

frozen

Frozen (used in fitting) (bool).

max

Maximum as a float.

min

Minimum as a float.

name

Name as a string.

prior

Prior applied to the parameter as a Prior.

quantity

Value times unit as a Quantity.

scale

Scale as a float.

scale_method

Method used to set factor and scale.

scale_transform

scale interp : {"lin", "sqrt", "log"}

scan_max

Stat scan maximum.

scan_min

Stat scan minimum.

scan_n_sigma

Stat scan n sigma.

scan_values

Stat scan values as a ndarray.

type

unit

Unit as a Unit object.

value

Value = factor x scale (float).

Methods Summary

autoscale()

Apply `interpolation_scale' and `scale_method' to the parameter.

check_limits()

Emit a warning or error if value is outside the minimum/maximum range.

copy()

Deep copy.

inverse_transform(factor)

Inverse tranform from factor (used by the optimizer) to value.

prior_stat_sum()

reset_autoscale()

Reset scaling such as factor=value, scale=1.

set_lim([min, max])

Set the min and/or max value for the parameter.

to_dict()

Convert to dictionary.

transform(value[, update_scale])

Tranform from value to factor (used by the optimizer).

update_from_dict(data)

Update parameters from a dictionary.

update_scale(value)

Update the parameter scale.

Attributes Documentation

conf_max#

Confidence maximum value as a float. Return parameter maximum if defined, otherwise a default is estimated from value and error.

conf_min#

Confidence minimum value as a float. Return parameter minimum if defined, otherwise a default is estimated from value and error.

error#
factor#

Factor as a float.

factor_max#

Factor maximum as a float (used by the optimizer).

By default when no transform is applied, factor_max = max / scale, otherwise factor_max = transform(max).

factor_min#

Factor minimum as a float (used by the optimizer).

By default when no transform is applied, factor_min = min / scale, otherwise factor_min = transform(min).

frozen#

Frozen (used in fitting) (bool).

max#

Maximum as a float.

min#

Minimum as a float.

name#

Name as a string.

prior#

Prior applied to the parameter as a Prior.

quantity#

Value times unit as a Quantity.

scale#

Scale as a float.

scale_method#

Method used to set factor and scale.

scale_transform#

scale interp : {“lin”, “sqrt”, “log”}

scan_max#

Stat scan maximum.

scan_min#

Stat scan minimum.

scan_n_sigma#

Stat scan n sigma.

scan_values#

Stat scan values as a ndarray.

type#
unit#

Unit as a Unit object.

value#

Value = factor x scale (float).

Methods Documentation

autoscale()#

Apply `interpolation_scale’ and `scale_method’ to the parameter.

check_limits()#

Emit a warning or error if value is outside the minimum/maximum range.

copy()#

Deep copy.

inverse_transform(factor)#

Inverse tranform from factor (used by the optimizer) to value.

Parameters:
valuefloat

Parameter factor

prior_stat_sum()#
reset_autoscale()#

Reset scaling such as factor=value, scale=1.

set_lim(min=None, max=None)#

Set the min and/or max value for the parameter.

Parameters:
min, max: float, `~astropy.units.Quantity`, str

Minimum and Maximum value to assign to the parameter min and max. Default is None, which set min and max to np.nan.

to_dict()[source]#

Convert to dictionary.

transform(value, update_scale=False)#

Tranform from value to factor (used by the optimizer).

Parameters:
valuefloat

Parameter value

update_scalebool, optional

Update the scaling (used by the autoscale). Default is False.

update_from_dict(data)#

Update parameters from a dictionary.

update_scale(value)#

Update the parameter scale.

Set factor and scale according to scale_method attribute.

Available scale_method.

  • scale10 sets scale to power of 10, so that abs(factor) is in the range 1 to 10

  • factor1 sets factor, scale = 1, value

In both cases the sign of value is stored in factor, i.e. the scale is always positive. If scale_method is None the scaling is ignored.