UnaryOpParameter
- class sherpa.models.parameter.UnaryOpParameter(arg, op, opstr)[source] [edit on github]
Bases:
CompositeParameter
Apply an operator to a parameter expression.
- Parameters
arg (Parameter instance) –
op (function reference) – The ufunc to apply to the parameter value.
opstr (str) – The symbol used to represent the operator.
See also
Attributes Summary
Is the parameter always frozen?
The default value of the parameter.
Is the parameter currently frozen?
The hard maximum of the parameter.
The hard minimum of the parameter.
The link expression to other parameters, if set.
The maximum value of the parameter.
The minimum value of the parameter.
The current value of the parameter.
Methods Summary
eval
()Evaluate the composite expression.
freeze
()Set the
frozen
attribute for the parameter.reset
()Reset the parameter value and limits to their default values.
set
([val, min, max, frozen, default_val, ...])Change a parameter setting.
thaw
()Unset the
frozen
attribute for the parameter.unlink
()Remove any link to other parameters.
Attributes Documentation
- alwaysfrozen
Is the parameter always frozen?
- default_max
- default_min
- frozen
Is the parameter currently frozen?
Those parameters created with
alwaysfrozen
set can not be changed.See also
- link
The link expression to other parameters, if set.
The link expression defines if the parameter is not a free parameter but is actually defined in terms of other parameters.
See also
Examples
>>> a = Parameter("mdl", "a", 2) >>> b = Parameter("mdl", "b", 1) >>> b.link = 10 - a >>> a.val 2.0 >>> b.val 8.0
- max
The maximum value of the parameter.
The maximum must lie between the hard_min and hard_max limits.
- min
The minimum value of the parameter.
The minimum must lie between the hard_min and hard_max limits.
- val
The current value of the parameter.
If the parameter is a link then it is possible that accessing the value will raise a ParamaterErr in cases where the link expression falls outside the soft limits of the parameter.
See also
default_val
,link
,max
,min
Methods Documentation
- eval()[source] [edit on github]
Evaluate the composite expression.
- freeze() [edit on github]
Set the
frozen
attribute for the parameter.See also
- reset() [edit on github]
Reset the parameter value and limits to their default values.
- set(val=None, min=None, max=None, frozen=None, default_val=None, default_min=None, default_max=None) [edit on github]
Change a parameter setting.
- Parameters
val (number or None, optional) – The new parameter value.
min (number or None, optional) – The new parameter range.
max (number or None, optional) – The new parameter range.
frozen (bool or None, optional) – Should the frozen flag be set?
default_val (number or None, optional) – The new default parameter value.
default_min (number or None, optional) – The new default parameter limits.
default_max (number or None, optional) – The new default parameter limits.
- thaw() [edit on github]
Unset the
frozen
attribute for the parameter.See also
- unlink() [edit on github]
Remove any link to other parameters.