Parameters¶
-
class
gammapy.modeling.
Parameters
(parameters=None)[source]¶ Bases:
collections.abc.Sequence
Parameters container.
List of
Parameter
objects.Covariance matrix.
- Parameters
- parameterslist of
Parameter
List of parameters
- parameterslist of
Attributes Summary
List of free parameters
List of parameter names
Context manager to restore values.
Parameter types
Unique parameters (
Parameters
).Parameter values (
numpy.ndarray
).Methods Summary
autoscale
([method])Autoscale all parameters.
Check parameter limits and emit a warning
copy
()A deep copy
count
(value)Freeze all parameters
from_dict
(data)from_stack
(parameters_list)Create
Parameters
by stacking a list of otherParameters
objects.index
(val)Get position index for a given parameter.
set_parameter_factors
(factors)Set factor of all parameters.
to_dict
()to_table
()Convert parameter attributes to
Table
.Attributes Documentation
-
free_parameters
¶ List of free parameters
-
names
¶ List of parameter names
-
restore_values
¶ Context manager to restore values.
A copy of the values is made on enter, and those values are restored on exit.
Examples
from gammapy.modeling.models import PowerLawSpectralModel pwl = PowerLawSpectralModel(index=2) with pwl.parameters.restore_values: pwl.parameters["index"].value = 3 print(pwl.parameters["index"].value)
-
types
¶ Parameter types
-
unique_parameters
¶ Unique parameters (
Parameters
).
-
values
¶ Parameter values (
numpy.ndarray
).
Methods Documentation
-
autoscale
(method='scale10')[source]¶ Autoscale all parameters.
See
autoscale()
- Parameters
- method{‘factor1’, ‘scale10’}
Method to apply
-
count
(value) → integer -- return number of occurrences of value¶
-
classmethod
from_stack
(parameters_list)[source]¶ Create
Parameters
by stacking a list of otherParameters
objects.- Parameters
- parameters_listlist of
Parameters
List of
Parameters
objects
- parameters_listlist of
-
index
(val)[source]¶ Get position index for a given parameter.
The input can be a parameter object, parameter name (str) or if a parameter index (int) is passed in, it is simply returned.