Parameter#
- class gammapy.modeling.Parameter(name, value, unit='', scale=1, min=nan, max=nan, frozen=False, error=0, scan_min=None, scan_max=None, scan_n_values=11, scan_n_sigma=2, scan_values=None, scale_method='scale10', interp='lin', is_norm=False)[source]#
Bases:
objectA model parameter.
Note that the parameter value has been split into a factor and scale like this:
value = factor x scale
Users should interact with the
value,quantityorminandmaxproperties and consider the fact that there is afactor`andscalean implementation detail.That was introduced for numerical stability in parameter and error estimation methods, only in the Gammapy optimiser interface do we interact with the
factor,factor_minandfactor_maxproperties, i.e. the optimiser “sees” the well-scaled problem.- Parameters
- namestr
Name
- valuefloat or
Quantity Value
- scalefloat, optional
Scale (sometimes used in fitting)
- unit
Unitor str, optional Unit
- minfloat, optional
Minimum (sometimes used in fitting)
- maxfloat, optional
Maximum (sometimes used in fitting)
- frozenbool, optional
Frozen? (used in fitting)
- errorfloat
Parameter error
- scan_minfloat
Minimum value for the parameter scan. Overwrites scan_n_sigma.
- scan_maxfloat
Minimum value for the parameter scan. Overwrites scan_n_sigma.
- scan_n_values: int
Number of values to be used for the parameter scan.
- scan_n_sigmaint
Number of sigmas to scan.
- scan_values: `numpy.array`
Scan values. Overwrites all of the scan keywords before.
- scale_method{‘scale10’, ‘factor1’, None}
Method used to set
factorandscale- interp{“lin”, “sqrt”, “log”}
Parameter scaling to use for the scan.
- is_normbool
Whether the parameter represents the flux norm of the model.
Attributes Summary
Confidence max value (
float)Confidence min value (
float)Factor (float).
Factor max (float).
Factor min (float).
Frozen? (used in fitting) (bool).
Whether the parameter represents the norm of the model
Maximum (float).
Minimum (float).
Name (str).
Value times unit (
Quantity).Scale (float).
Method used to set
factorandscaleStat scan max
Stat scan min
Stat scan n sigma
Stat scan values (
ndarray)Unit (
Unit).Value = factor x scale (float).
Methods Summary
Autoscale the parameters.
Emit a warning or error if value is outside the min/max range
copy()A deep copy
to_dict()Convert to dict.
update_from_dict(data)Update parameters from a dict.
Attributes Documentation
- error#
- factor#
Factor (float).
- factor_max#
Factor max (float).
This
factor_max = max / scaleis for the optimizer interface.
- factor_min#
Factor min (float).
This
factor_min = min / scaleis for the optimizer interface.
- frozen#
Frozen? (used in fitting) (bool).
- is_norm#
Whether the parameter represents the norm of the model
- max#
Maximum (float).
- min#
Minimum (float).
- name#
Name (str).
- scale#
Scale (float).
- scale_method#
Method used to set
factorandscale
- scan_max#
Stat scan max
- scan_min#
Stat scan min
- scan_n_sigma#
Stat scan n sigma
- type#
- value#
Value = factor x scale (float).
Methods Documentation
- autoscale()[source]#
Autoscale the parameters.
Set
factorandscaleaccording toscale_methodattributeAvailable
scale_methodscale10setsscaleto power of 10, so that abs(factor) is in the range 1 to 10factor1setsfactor, scale = 1, value
In both cases the sign of value is stored in
factor, i.e. thescaleis always positive. Ifscale_methodis None the scaling is ignored.