elisa.models.model#

The spectral model bases.

class Model(name: str, latex: str, comps: list[Component])[source]#

Bases: ABC

Base model class.

Attributes

comp_names

Component names.

eval

Get side-effect free model evaluation function.

latex

\(\LaTeX\) format of the model.

name

Model name.

type

Model type.

Methods

compile(*[, model_info])

Compile the model for fast evaluation.

compile(*, model_info: ModelInfo | None = None) CompiledModel[source]#

Compile the model for fast evaluation.

Parameters:
model_infoModelInfo, optional

Optional model information used to compile the model.

Returns:
CompiledModel

The compiled model.

abstract property eval: Callable[[Array, dict[str, dict[str, Array]]], Array]#

Get side-effect free model evaluation function.

property name: str#

Model name.

property latex: str#

\(\LaTeX\) format of the model.

abstract property type: Literal['add', 'mul', 'conv']#

Model type.

property comp_names: tuple[str, ...]#

Component names.

class CompiledModel(name: str, params_id: Sequence[str], fixed_id: Sequence[str], fn: Callable[[Array, dict[str, Array]], Array], additive_fn: Callable[[Array, dict[str, Array]], dict[tuple[str, str], Array]] | None, mtype: Literal['add', 'mul'], model_info: ModelInfo)[source]#

Bases: object

Model with fast evaluation and fixed configuration.

Attributes

has_comps

Whether the model has additive subcomponents.

params_name

Parameter names.

type

Model type.

Methods

ce(egrid, resp_matrix, channel_width[, ...])

Calculate the folded model, i.e. \(C(E)\).

eene(egrid[, params, comps])

Calculate \(E^2 N(E)\), i.e. \(\nu F(\nu)\).

eiso(emin_rest, emax_rest, z, duration, ...)

Calculate the isotropic emission energy of model.

ene(egrid[, params, comps])

Calculate \(E N(E)\), i.e. \(F(\nu)\).

eval(egrid[, params])

Evaluate the model.

flux(emin, emax[, params, energy, comps, ...])

Calculate the flux of model between emin and emax.

lumin(emin_rest, emax_rest, z, params, ...)

Calculate the luminosity of model.

ne(egrid[, params, comps])

Calculate \(N(E)\).

simulate(photon_egrid, channel_emin, ...[, ...])

Simulate observation data.

simulate_from_data(data[, spec_exposure, ...])

Simulate observation based on the configuration of existing data.

property params_name: tuple[str, ...]#

Parameter names.

property type: Literal['add', 'mul']#

Model type.

property has_comps: bool#

Whether the model has additive subcomponents.

eval(egrid: Array | ndarray | bool | number | bool | int | float | complex, params: Sequence | Mapping | None = None) Array[source]#

Evaluate the model.

Parameters:
egridndarray

Photon energy grid in units of keV.

paramssequence or mapping, optional

Parameter sequence or mapping for the model.

Returns:
jax.Array

The model value.

ne(egrid: Array | ndarray | bool | number | bool | int | float | complex, params: Sequence | Mapping | None = None, comps: bool = False) Array | dict[str, Array][source]#

Calculate \(N(E)\).

Parameters:
egridndarray

Photon energy grid in units of keV.

paramssequence or mapping, optional

Parameter sequence or mapping for the model.

compsbool, optional

Whether to return the result of each component. Defaults to False.

Returns:
jax.Array, or dict[str, jax.Array]

The differential photon flux in units of ph cm⁻² s⁻¹ keV⁻¹.

ene(egrid: Array | ndarray | bool | number | bool | int | float | complex, params: Sequence | Mapping | None = None, comps: bool = False) Array | dict[str, Array][source]#

Calculate \(E N(E)\), i.e. \(F(\nu)\).

Parameters:
egridndarray

Photon energy grid in units of keV.

paramssequence or mapping, optional

Parameter sequence or mapping for the model.

compsbool, optional

Whether to return the result of each component. Defaults to False.

Returns:
jax.Array, or dict[str, jax.Array]

The differential energy flux in units of erg cm⁻² s⁻¹ keV⁻¹.

eene(egrid: Array | ndarray | bool | number | bool | int | float | complex, params: Sequence | Mapping | None = None, comps: bool = False) Array | dict[str, Array][source]#

Calculate \(E^2 N(E)\), i.e. \(\nu F(\nu)\).

Parameters:
egridndarray

Photon energy grid in units of keV.

paramssequence or mapping, optional

Parameter sequence or mapping for the model.

compsbool, optional

Whether to return the result of each component. Defaults to False.

Returns:
jax.Array, or dict[str, jax.Array]

The energy flux in units of erg cm⁻² s⁻¹.

ce(egrid: Array | ndarray | bool | number | bool | int | float | complex, resp_matrix: Array | ndarray | bool | number | bool | int | float | complex, channel_width: Array | ndarray | bool | number | bool | int | float | complex, params: Sequence | Mapping | None = None, comps: bool = False) Array | dict[str, Array][source]#

Calculate the folded model, i.e. \(C(E)\).

Parameters:
egridndarray

Photon energy grid of resp_matrix, in units of keV.

resp_matrixndarray

Instrumental response matrix used to fold the model.

channel_widthndarray

Measured energy channel width of resp_matrix.

paramssequence or mapping, optional

Parameter sequence or mapping for the model.

compsbool, optional

Whether to return the result of each component. Defaults to False.

Returns:
jax.Array, or dict[str, jax.Array]

The folded model in units of counts s⁻¹ keV⁻¹.

flux(emin: float | int | Array, emax: float | int | Array, params: Sequence | Mapping | None = None, energy: bool = True, comps: bool = False, ngrid: int = 1000, log: bool = True) Array | dict[str, Array][source]#

Calculate the flux of model between emin and emax.

Warning

The flux is calculated by trapezoidal rule, which may not be accurate if not enough energy bins are used when the difference between emin and emax is large.

Parameters:
eminfloat or int

Minimum value of energy range, in units of keV.

emaxfloat or int

Maximum value of energy range, in units of keV.

paramssequence or mapping, optional

Parameter sequence or mapping for the model.

energybool, optional

When True, calculate energy flux in units of erg cm⁻² s⁻¹; otherwise calculate photon flux in units of ph cm⁻² s⁻¹. The default is True.

compsbool, optional

Whether to return the result of each component. The default is False.

ngridint, optional

The energy grid number to use in integration. The default is 1000.

logbool, optional

Whether to use logarithmically regular energy grid. The default is True.

Returns:
jax.Array, or dict[str, jax.Array]

The model flux.

lumin(emin_rest: float | int, emax_rest: float | int, z: float | int, params: Sequence | Mapping | None = None, comps: bool = False, ngrid: int = 1000, log: bool = True, cosmo: LambdaCDM = FlatLambdaCDM(name='Planck18', H0=<Quantity 67.66 km / (Mpc s)>, Om0=0.30966, Tcmb0=<Quantity 2.7255 K>, Neff=3.046, m_nu=<Quantity [0., 0., 0.06] eV>, Ob0=0.04897)) Array | dict[str, Array][source]#

Calculate the luminosity of model.

Warning

The luminosity is calculated by trapezoidal rule, and is accurate only if enough numbers of energy grids are used.

Parameters:
emin_restfloat or int

Minimum value of rest-frame energy range, in units of keV.

emax_restfloat or int

Maximum value of rest-frame energy range, in units of keV.

zfloat or int

Redshift of the source.

paramssequence or mapping, optional

Parameter sequence or mapping for the model.

compsbool, optional

Whether to return the result of each component. The default is False.

ngridint, optional

The energy grid number to use in integration. The default is 1000.

logbool, optional

Whether to use logarithmically regular energy grid. The default is True.

cosmoLambdaCDM, optional

Cosmology model used to calculate luminosity. The default is Planck18.

Returns:
jax.Array, or dict[str, jax.Array]

The model luminosity.

eiso(emin_rest: float | int, emax_rest: float | int, z: float | int, duration: float | int, params: Sequence | Mapping | None = None, comps: bool = False, ngrid: int = 1000, log: bool = True, cosmo: LambdaCDM = FlatLambdaCDM(name='Planck18', H0=<Quantity 67.66 km / (Mpc s)>, Om0=0.30966, Tcmb0=<Quantity 2.7255 K>, Neff=3.046, m_nu=<Quantity [0., 0., 0.06] eV>, Ob0=0.04897)) Array | dict[str, Array][source]#

Calculate the isotropic emission energy of model.

Warning

The \(E_\mathrm{iso}\) is calculated by trapezoidal rule, and is accurate only if enough numbers of energy grids are used.

Parameters:
emin_restfloat or int

Minimum value of rest-frame energy range, in units of keV.

emax_restfloat or int

Maximum value of rest-frame energy range, in units of keV.

zfloat or int

Redshift of the source.

durationfloat or int

Observed duration of the source, in units of second.

compsbool, optional

Whether to return the result of each component. The default is False.

ngridint, optional

The energy grid number to use in integration. The default is 1000.

logbool, optional

Whether to use logarithmically regular energy grid. The default is True.

paramsdict, optional

Parameters dict to overwrite the fitted parameters.

cosmoLambdaCDM, optional

Cosmology model used to calculate luminosity. The default is Planck18.

Returns:
jax.Array, or dict[str, jax.Array]

The isotropic emission energy of the model.

simulate_from_data(data: ObservationData, spec_exposure: float | None = None, back_exposure: float | None = None, params: Sequence | Mapping | None = None, seed: int = 42, **kwargs: dict) ObservationData[source]#

Simulate observation based on the configuration of existing data.

Parameters:
dataObservationData

Observation data to read observation configuration.

spec_exposurefloat, optional

Exposure time of the source. Defaults to the exposure time of spec_data.

back_exposurefloat, optional

Exposure time of the background. Defaults to the exposure time of back_data.

paramssequence or mapping, optional

Parameter sequence or mapping for the model.

seedint, optional

Random seed for the simulation. The default is 42.

**kwargsdict, optional

Additional keyword arguments passed to ObservationData.

Returns:
ObservationData

Simulated observation data.

simulate(photon_egrid: ndarray, channel_emin: ndarray, channel_emax: ndarray, response_matrix: ndarray | sparray, spec_exposure: float, spec_poisson: bool = True, spec_errors: ndarray | None = None, back_counts: ndarray | None = None, back_errors: ndarray | None = None, back_exposure: float | None = None, back_poisson: bool | None = None, spec_area_scale: float | ndarray = 1.0, spec_back_scale: float | ndarray = 1.0, back_area_scale: float | ndarray = 1.0, back_back_scale: float | ndarray = 1.0, quality: ndarray | None = None, grouping: ndarray | None = None, channel: ndarray | None = None, channel_type: str = 'Ch', response_sparse: bool = False, params: Sequence | Mapping | None = None, name: str = 'simulation', seed: int = 42, **kwargs: dict) ObservationData[source]#

Simulate observation data.

Parameters:
photon_egridndarray

Photon energy grid in units of keV.

channel_eminndarray

Lower energy bounds of the detector channels.

channel_emaxndarray

Upper energy bounds of the detector channels.

response_matrixndarray

Response matrix of the detector.

spec_exposurefloat

Exposure time of the source.

spec_poissonbool, optional

Whether the source spectrum is Poisson distributed. If false, spec_errors must be provided. The default is True.

spec_errorsndarray, optional

Errors of the source spectrum. Must be provided if spec_poisson is False.

back_countsndarray, optional

Background counts in each channel.

back_errorsndarray, optional

Errors of the background counts. Must be provided if back_poisson is False.

back_exposurefloat, optional

Exposure time of the background.

back_poissonbool, optional

Whether the background spectrum is Poisson distributed. If false, back_errors must be provided.

spec_area_scalefloat or ndarray, optional

Area scale factor of the source. The default is 1.0.

spec_back_scalefloat or ndarray, optional

Background scale factor of the source. The default is 1.0.

back_area_scalefloat or ndarray, optional

Area scale factor of the background. The default is 1.0.

back_back_scalefloat or ndarray, optional

Background scale factor of the background. The default is 1.0.

qualityndarray, optional

Quality flags of the data.

groupingndarray, optional

Grouping flags of the data.

channelndarray, optional

Channel numbers.

channel_typestr, optional

Channel type. The default is ‘Ch’.

response_sparsebool, optional

Whether the response matrix is sparse. The default is False.

paramssequence or mapping, optional

Parameter sequence or mapping for the model.

namestr, optional

Name of the simulation data. The default is ‘simulation’.

seedint, optional

Random seed for simulation. The default is 42.

**kwargsdict, optional

Additional keyword arguments passed to ObservationData.

Returns:
ObservationData

Simulated observation data.

class UniComponentModel(component: Component)[source]#

Bases: Model

Model defined by a single additive or multiplicative component.

Attributes

comp_names

Component names.

eval

Get side-effect free model evaluation function.

latex

\(\LaTeX\) format of the model.

name

Model name.

type

Model type.

Methods

compile(*[, model_info])

Compile the model for fast evaluation.

property eval: Callable[[Array, dict[str, dict[str, Array]]], Array]#

Get side-effect free model evaluation function.

property type: Literal['add', 'mul']#

Model type.

class CompositeModel(lhs: Model, rhs: Model, op: Literal['+', '*'])[source]#

Bases: Model

Model defined by sum or product of two models.

Attributes

comp_names

Component names.

eval

Get side-effect free model evaluation function.

latex

\(\LaTeX\) format of the model.

name

Model name.

type

Model type.

Methods

compile(*[, model_info])

Compile the model for fast evaluation.

property eval: Callable[[Array, dict[str, dict[str, Array]]], Array]#

Get side-effect free model evaluation function.

property type: Literal['add', 'mul']#

Model type.

class ComponentMeta(name, bases, dct, **kwargs) None[source]#

Bases: ABCMeta

Avoid cumbersome coding for subclass __init__.

Methods

__call__(*args, **kwargs)

Call self as a function.

mro(/)

Return a type's method resolution order.

register(subclass)

Register a virtual subclass of an ABC.

class ParamConfig(name: str, latex: str, unit: str, default: float, min: float, max: float, log: bool = False, fixed: bool = False)[source]#

Bases: NamedTuple

Configuration of a uniform parameter for spectral component.

Methods

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

name: str#

Plain name of the parameter.

latex: str#

\(\LaTeX\) of the parameter.

unit: str#

Physical unit.

default: float#

Default value of the parameter.

min: float#

Minimum value of the parameter.

max: float#

Maximum value of the parameter.

log: bool#

Whether the parameter is parameterized in a logarithmic scale.

fixed: bool#

Whether the parameter is fixed.

class Component(params: dict, latex: str | None)[source]#

Bases: ABC

Base class to define a spectral component.

Attributes

eval

Get side-effect free component evaluation function.

latex

\(\LaTeX\) format of the component.

name

Component name.

param_names

Component's parameter names.

type

Component type.

abstract property eval: Callable[[Array, dict[str, Array]], Array]#

Get side-effect free component evaluation function.

property name: str#

Component name.

property latex: str#

\(\LaTeX\) format of the component.

abstract property type: Literal['add', 'mul', 'conv']#

Component type.

property param_names: tuple[str, ...]#

Component’s parameter names.

class AdditiveComponent(params: dict, latex: str | None)[source]#

Bases: Component

Prototype class to define an additive component.

Attributes

eval

Get side-effect free component evaluation function.

latex

\(\LaTeX\) format of the component.

name

Component name.

param_names

Component's parameter names.

type

Component type is additive.

property type: Literal['add']#

Component type is additive.

class MultiplicativeComponent(params: dict, latex: str | None)[source]#

Bases: Component

Prototype class to define a multiplicative component.

Attributes

eval

Get side-effect free component evaluation function.

latex

\(\LaTeX\) format of the component.

name

Component name.

param_names

Component's parameter names.

type

Component type is multiplicative.

property type: Literal['mul']#

Component type is multiplicative.

class AnalyticalIntegral(params: dict, latex: str | None)[source]#

Bases: Component

Prototype component to calculate model integral analytically.

Attributes

eval

Get side-effect free component evaluation function.

latex

\(\LaTeX\) format of the component.

name

Component name.

param_names

Component's parameter names.

type

Component type.

Methods

integral(*args, **kwargs)

Calculate the model value over grid.

property eval: Callable[[Array, dict[str, Array]], Array]#

Get side-effect free component evaluation function.

abstractmethod static integral(*args, **kwargs) Array[source]#

Calculate the model value over grid.

class NumericalIntegral(params: dict, latex: str | None, method: Literal['trapz', 'simpson'] | None = None)[source]#

Bases: Component

Prototype component to calculate model integral numerically.

Attributes

eval

Get side-effect free component evaluation function.

latex

\(\LaTeX\) format of the component.

method

Numerical integration method.

name

Component name.

param_names

Component's parameter names.

type

Component type.

Methods

continuum(*args, **kwargs)

Calculate the model value at the energy grid.

property eval: Callable[[Array, dict[str, Array]], Array]#

Get side-effect free component evaluation function.

abstractmethod static continuum(*args, **kwargs) Array[source]#

Calculate the model value at the energy grid.

property method: Literal['trapz', 'simpson']#

Numerical integration method.

class AnaIntAdditive(params: dict, latex: str | None)[source]#

Bases: AnalyticalIntegral, AdditiveComponent

Prototype additive component with integral expression defined.

Attributes

eval

Get side-effect free component evaluation function.

latex

\(\LaTeX\) format of the component.

name

Component name.

param_names

Component's parameter names.

type

Component type is additive.

Methods

integral(*args, **kwargs)

Calculate the photon flux integrated over the energy grid.

abstractmethod static integral(*args, **kwargs) Array[source]#

Calculate the photon flux integrated over the energy grid.

Parameters:
egridndarray

Photon energy grid in units of keV.

paramsdict

Parameter dict for the model.

Returns:
jax.Array

The photon flux integrated over egrid, in units of ph cm⁻² s⁻¹.

class NumIntAdditive(params: dict, latex: str | None, method: Literal['trapz', 'simpson'] | None = None)[source]#

Bases: NumericalIntegral, AdditiveComponent

Prototype additive component with continuum expression defined.

Attributes

eval

Get side-effect free component evaluation function.

latex

\(\LaTeX\) format of the component.

method

Numerical integration method.

name

Component name.

param_names

Component's parameter names.

type

Component type is additive.

Methods

continuum(*args, **kwargs)

Calculate the photon flux at the energy grid.

abstractmethod static continuum(*args, **kwargs) Array[source]#

Calculate the photon flux at the energy grid.

Parameters:
egridndarray

Photon energy grid in units of keV.

paramsdict

Parameter dict for the model.

Returns:
jax.Array

The photon flux at egrid, in units of ph cm⁻² s⁻¹ keV⁻¹.

class AnaIntMultiplicative(params: dict, latex: str | None)[source]#

Bases: AnalyticalIntegral, MultiplicativeComponent

Prototype multiplicative component with integral expression defined.

Attributes

eval

Get side-effect free component evaluation function.

latex

\(\LaTeX\) format of the component.

name

Component name.

param_names

Component's parameter names.

type

Component type is multiplicative.

Methods

integral(*args, **kwargs)

Calculate the average value of the model between the grid.

abstractmethod static integral(*args, **kwargs) Array[source]#

Calculate the average value of the model between the grid.

Parameters:
egridndarray

Photon energy grid in units of keV.

paramsdict

Parameter dict for the model.

Returns:
jax.Array

The model value, dimensionless.

class NumIntMultiplicative(params: dict, latex: str | None, method: Literal['trapz', 'simpson'] | None = None)[source]#

Bases: NumericalIntegral, MultiplicativeComponent

Prototype multiplicative component with continuum expression defined.

Attributes

eval

Get side-effect free component evaluation function.

latex

\(\LaTeX\) format of the component.

method

Numerical integration method.

name

Component name.

param_names

Component's parameter names.

type

Component type is multiplicative.

Methods

continuum(*args, **kwargs)

Calculate the model value at the energy grid.

abstractmethod static continuum(*args, **kwargs) Array[source]#

Calculate the model value at the energy grid.

Parameters:
egridndarray

Photon energy grid in units of keV.

paramsdict

Parameter dict for the model.

Returns:
jax.Array

The model value at egrid, dimensionless.

class ConvolutionModel(component: ConvolutionComponent)[source]#

Bases: Model

Model defined by a convolution component.

Attributes

comp_names

Component names.

eval

Get side-effect free model evaluation function.

latex

\(\LaTeX\) format of the model.

name

Model name.

type

Model type is convolution.

Methods

__call__(model)

Call self as a function.

compile(*[, model_info])

Compile the model for fast evaluation.

property eval#

Get side-effect free model evaluation function.

property type: Literal['conv']#

Model type is convolution.

class ConvolvedModel(op: ConvolutionComponent, model: Model)[source]#

Bases: Model

Model created by convolution.

Attributes

comp_names

Component names.

eval

Get side-effect free model evaluation function.

latex

\(\LaTeX\) format of the model.

name

Model name.

type

Model type.

Methods

compile(*[, model_info])

Compile the model for fast evaluation.

property eval: Callable[[Array, dict[str, dict[str, Array]]], Array]#

Get side-effect free model evaluation function.

property type: Literal['add', 'mul']#

Model type.

class ConvolutionComponent(params: dict, latex: str | None)[source]#

Bases: Component

Prototype class to define a convolution component.

Attributes

eval

Get side-effect free component evaluation function.

latex

\(\LaTeX\) format of the component.

name

Component name.

param_names

Component's parameter names.

type

Component type.

Methods

convolve(*args, **kwargs)

Convolve a model function.

property type: Literal['conv']#

Component type.

property eval: Callable[[Array, dict[str, Array], Callable[[Array], Array]], Array]#

Get side-effect free component evaluation function.

abstractmethod static convolve(*args, **kwargs) Array[source]#

Convolve a model function.

Parameters:
egridndarray

Photon energy grid in units of keV.

paramsdict

Parameter dict for the convolution model.

model_fncallable()

The model function to be convolved, which takes the energy grid as input and returns the model value over the grid.

Returns:
jax.Array

The convolved model value over egrid.

class PyComponent(params: dict, latex: str | None, grad_method: Literal['central', 'forward'] | None)[source]#

Bases: Component

Prototype component with pure Python expression defined.

Attributes

eval

Get side-effect free component evaluation function.

grad_method

Numerical differentiation method.

latex

\(\LaTeX\) format of the component.

name

Component name.

param_names

Component's parameter names.

type

Component type.

property grad_method: Literal['central', 'forward']#

Numerical differentiation method.

class PyAnaInt(params: dict, latex: str | None, grad_method: Literal['central', 'forward'] | None)[source]#

Bases: PyComponent, AnalyticalIntegral

Prototype component with python integral expression defined.

Attributes

eval

Get side-effect free component evaluation function.

grad_method

Numerical differentiation method.

latex

\(\LaTeX\) format of the component.

name

Component name.

param_names

Component's parameter names.

type

Component type.

Methods

integral(*args, **kwargs)

Calculate the model value over grid.

property eval: Callable[[Array, dict[str, Array]], Array]#

Get side-effect free component evaluation function.

class PyNumInt(params: dict, latex: str | None, method: Literal['trapz', 'simpson'] | None, grad_method: Literal['central', 'forward'] | None)[source]#

Bases: PyComponent, NumericalIntegral

Prototype component with python continuum expression defined.

Attributes

eval

Get side-effect free component evaluation function.

grad_method

Numerical differentiation method.

latex

\(\LaTeX\) format of the component.

method

Numerical integration method.

name

Component name.

param_names

Component's parameter names.

type

Component type.

Methods

continuum(*args, **kwargs)

Calculate the model value at the energy grid.

property eval: Callable[[Array, dict[str, Array]], Array]#

Get side-effect free component evaluation function.

get_mtype_str(model: Model | CompiledModel) str[source]#

Get the model type string.

get_model_info(comps: Sequence[Component], cid_to_name: dict[str, str], cid_to_latex: dict[str, str]) ModelInfo[source]#

Get the model information.

Parameters:
compssequence of Component

The sequence of components.

cid_to_namemapping

The mapping of component id to component name.

cid_to_latexmapping

The mapping of component id to component LaTeX format.

Returns:
ModelInfo

The model parameter information dict.

class ModelInfo(info: tuple[tuple[str, str, str, str, str, str], ...], name: ParamIDStrMapping, latex: ParamIDStrMapping, unit: ParamIDStrMapping, sample: dict[ParamID, Distribution], default: ParamIDValMapping, deterministic: dict[ParamID, Callable[[ParamIDValMapping], JAXFloat]], fixed: ParamIDValMapping, log: dict[ParamID, bool], pid_to_comp_latex: dict[ParamID, str], cid_to_name: dict[CompID, CompName], cid_to_latex: dict[CompID, str], cid_to_params: dict[CompID, Callable[[ParamIDValMapping], NameValMapping]], integrate: dict[ParamID, IntegralFactory], setup: dict[CompParamName, tuple[ParamID, ParamSetup]])[source]#

Bases: NamedTuple

Model information.

Methods

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

info: tuple[tuple[str, str, str, str, str, str], ...]#

The model parameter information.

Each row contains (No., Component, Parameter, Value, Bound, Prior).

name: dict[str, str]#

The mapping of parameter id to parameter name.

latex: dict[str, str]#

The mapping of component parameters name to \(\LaTeX\) format.

unit: dict[str, str]#

The mapping of component parameters name to physical unit.

sample: dict[str, Distribution]#

The mapping of free parameter id to numpyro Distribution.

default: dict[str, Array]#

The mapping of free parameter id to default value.

deterministic: dict[str, Callable[[dict[str, Array]], Array]]#

The mapping of deterministic parameters id to value getter.

fixed: dict[str, Array]#

The mapping of fixed parameter id to fixed parameter value.

log: dict[str, bool]#

The mapping of parameter id to logarithmic flag.

pid_to_comp_latex: dict[str, str]#

The mapping of parameter id to component LaTeX format.

cid_to_name: dict[str, str]#

The mapping of component id to component name.

cid_to_latex: dict[str, str]#

The mapping of component id to component LaTeX format.

cid_to_params: dict[str, Callable[[dict[str, Array]], dict[str, Array]]]#

The mapping of component id to parameter value getter function.

integrate: dict[str, Callable[[Callable[[Array, dict[str, Array]], Array]], Callable[[Array, dict[str, Array]], Array]]]#

The mapping of interval parameter id to integral operator.

setup: dict[str, tuple[str, ParamSetup]]#

The mapping of component parameter setup.

class ParamSetup(*values)[source]#

Bases: Enum

Model parameter setup.

Free = 0#

Parameter is free to vary.

Composite = 1#

Parameter is composed of other free parameters.

Forwarded = 2#

Parameter is directly forwarded to another model parameter.

Fixed = 3#

Parameter is fixed to a value.

Integrated = 4#

Parameter is integrated out.