elisa.models.parameter#
The parameter.
- class AssignmentTracker[source]#
Bases:
objectTrack component assignment of a parameter.
Methods
append(cid, pname)Append a new assignment record.
get_comp_param(comp_ids)Get the earliest component assignment record within comp_ids.
remove(cid, pname)Remove an assignment record.
- class ParamInfo(name: str | Callable[[ParamIDStrMapping], str], latex: str | Callable[[ParamIDStrMapping], str], default: Any, bound: str, prior: str, log: bool, fixed: bool, tracker: AssignmentTracker, id_to_value: Callable[[ParamIDValMapping], JAXFloat], dist: Distribution | None = None, composite: bool = False, integrate: IntegralFactory | bool = False)[source]#
Bases:
NamedTupleParameter information.
Methods
count(value, /)Return number of occurrences of value.
index(value[, start, stop])Return first index of value.
- name: str | Callable[[dict[str, str]], str]#
Plain name of the parameter.
It is a getter function for composite parameter.
- latex: str | Callable[[dict[str, str]], str]#
\(\LaTeX\) format of the parameter.
It is a getter function for composite parameter.
- tracker: AssignmentTracker#
Component assignment tracker.
- dist: Distribution | None#
NumPyro distribution for the parameter.
- class Parameter[source]#
Bases:
ABCParameter base.
Attributes
Default value of the parameter.
Whether the parameter is fixed.
\(\LaTeX\) format of the parameter.
Whether the parameter is parameterized in a logarithmic scale.
Plain name of the parameter.
- class ParameterHelper(name: str, latex: str | None, default: Any | None = None)[source]#
Bases:
ParameterHandle name, latex, and default value of a parameter.
Attributes
Default value of the parameter.
fixedWhether the parameter is fixed.
\(\LaTeX\) format of the parameter.
logWhether the parameter is parameterized in a logarithmic scale.
Plain name of the parameter.
- class DistParameter(name: str, dist: Distribution, default: float, *, min: float | None = None, max: float | None = None, log: bool = False, fixed: bool = False, latex: str | None = None)[source]#
Bases:
ParameterHelperDefine a parameter by a distribution.
- Parameters:
- name
str Parameter name.
- dist
Distribution Numpyro distribution from which the parameter is sampled.
- default
float Parameter default value.
- min
float, optional Parameter minimum value, for display purpose only. The default is None.
- max
float, optional Parameter maximum value, for display purpose only. The default is None.
- logbool, optional
Whether the parameter is parameterized in a logarithmic scale. The default is False.
- fixedbool, optional
Whether the parameter is fixed. The default is False.
- latex
str, optional \(\LaTeX\) format of the parameter. The default is as name.
- name
Attributes
Default value of the parameter.
Whether the parameter is fixed.
latex\(\LaTeX\) format of the parameter.
Whether the parameter is parameterized in a logarithmic scale.
namePlain name of the parameter.
- class UniformParameter(name: str, default: float, min: float, max: float, *, log: bool = False, fixed: bool = False, latex: str | None = None)[source]#
Bases:
DistParameterDefine the parameter by a uniform distribution.
- Parameters:
- name
str Parameter name.
- default
float Parameter default value.
- min
float Parameter minimum value.
- max
float Parameter maximum value.
- logbool, optional
Whether the parameter is logarithmically uniform. The default is False.
- fixedbool, optional
Whether the parameter is fixed. The default is False.
- latex
str, optional \(\LaTeX\) format of the parameter. The default is as name.
- name
Attributes
Default value of the parameter.
Whether the parameter is fixed.
\(\LaTeX\) format of the parameter.
Whether the parameter is logarithmically uniform.
Parameter maximum value.
Parameter minimum value.
Plain name of the parameter.
- class ConstantParameter(name: str, value: Any, latex: str | None = None)[source]#
Bases:
ParameterHelperConstant parameter.
- Parameters:
- name
str Parameter name.
- valuearray_like
The constant value of parameter.
- latex
str, optional \(\LaTeX\) format of the parameter. The default is as name.
- name
Attributes
defaultDefault value of the parameter.
Constant parameter is fixed.
latex\(\LaTeX\) format of the parameter.
Constant parameter is not logarithmically parameterized.
namePlain name of the parameter.
- class ConstantValue(name: str, value: float, latex: str | None = None)[source]#
Bases:
ConstantParameterParameter with a fixed value.
- Parameters:
- name: str
Parameter name.
- value: float
Parameter value.
- latex
str, optional \(\LaTeX\) format of the parameter. The default is as name.
Attributes
Default value of the parameter.
fixedConstant parameter is fixed.
latex\(\LaTeX\) format of the parameter.
logConstant parameter is not logarithmically parameterized.
namePlain name of the parameter.
- class ConstantInterval(name: str, interval: Sequence[float], method: Literal['quadgk', 'quadcc', 'quadts', 'romberg', 'rombergts'] = 'quadgk', latex: str | None = None, **kwargs)[source]#
Bases:
ConstantParameterConstant parameter to be integrated over a given interval.
When assigning
ConstantIntervalparameters to a model component, the model will be evaluated according to the following formula:\[\frac{1}{\prod_i (b_i - a_i)} \int f(E, \vec{\theta}(\vec{p}, \vec{q})) \, \mathrm{d} \vec{p}\]where \(f\) is the model function, \(\vec{\theta}\) is the parameter vector of the model, \(\vec{p}\) is the
ConstantIntervalparameters, \(\vec{q}\) is the other parameters, and \(a_i\) and \(b_i\) are the intervals given by \(\vec{p}\).- Parameters:
- name: str
Parameter name.
- interval: array_like
The interval, a 2-element sequence.
- method{‘quadgk’, ‘quadcc’, ‘quadts’, ‘romberg’, ‘rombergts’}, optional
Numerical integration method used to integrate over the parameter. Available options are:
'quadgk': global adaptive quadrature by Gauss-Konrod rule'quadcc': global adaptive quadrature by Clenshaw-Curtis rule'quadts': global adaptive quadrature by trapz tanh-sinh rule'romberg': Romberg integration'rombergts': Romberg integration by tanh-sinh (a.k.a. double exponential) transformation
The default is
'quadgk'.- latex
str, optional \(\LaTeX\) format of the parameter. The default is as name.
- kwargs
dict, optional Extra kwargs passed to integration methods. See [1] for details.
Attributes
Default value of the parameter.
fixedConstant parameter is fixed.
latex\(\LaTeX\) format of the parameter.
logConstant parameter is not logarithmically parameterized.
Numerical integration method.
namePlain name of the parameter.
References
[1]
- class CompositeParameter(params: Parameter | Sequence[Parameter], op: Callable[[...], Array], op_name: str, op_latex: str | None = None, *, op_symbol: Literal['+', '-', '*', '/', '^'] | None = None)[source]#
Bases:
ParameterCombine parameters to create a new parameter.
- Parameters:
- params
Parameter, or sequenceofParameter Parameters to be combined.
- op
callable() Function applied to params. The function should take the same number and order of arguments as params and return a single value. The function must be compatible with
JAX.- op_name
str Name of the composition operator op.
- op_latex
str, optional \(\LaTeX\) format of the composition operator op. The default is as op_name.
- params
Attributes
Default value of the parameter.
If the sub-parameters are all fixed.
\(\LaTeX\) format of the parameter.
If the sub-parameters are all logarithmically parameterized.
Plain name of the parameter.