elisa.infer.results#

Subsequent analysis of maximum likelihood or Bayesian fit.

class FitResult(helper: Helper)[source]#

Bases: ABC

Fit result.

Attributes

dof

Degree of freedom.

gof

Goodness of fit p-value.

ndata

Data points number.

plot

Result plotter.

Methods

load(path[, decompress])

Load a previously saved fit result.

save(path[, compress])

Save the fit result to a file.

summary([file])

Print the summary of fit result.

eiso

flux

lumin

abstract property plot: Plotter#

Result plotter.

summary(file=None) None[source]#

Print the summary of fit result.

Parameters:
file: file-like

An object with a write(string) method. This is passed to print().

abstractmethod flux(*args, **kwargs) dict[str, Array] | dict[str, dict[str, Array]][source]#
abstractmethod lumin(*args, **kwargs) dict[str, Array] | dict[str, dict[str, Array]][source]#
abstractmethod eiso(*args, **kwargs) dict[str, Array] | dict[str, dict[str, Array]][source]#
property ndata: dict[str, int]#

Data points number.

property dof: int#

Degree of freedom.

abstract property gof: dict[str, float]#

Goodness of fit p-value.

save(path: str, compress: Literal['gzip', 'bz2', 'lzma'] = 'gzip', **kwargs: dict) None[source]#

Save the fit result to a file.

Parameters:
pathstr

The file path to save fit result.

compress{‘gzip’, ‘bz2’, ‘lzma’}

The compression algorithm to use.

**kwargsdict

Extra parameters passed to gzip.open(), bz2.open(), or lzma.open().

static load(path: str, decompress: Literal['gzip', 'bz2', 'lzma'] = 'gzip') FitResult[source]#

Load a previously saved fit result.

Parameters:
pathstr

The file path of previously saved fit result.

decompress{‘gzip’, ‘bz2’, ‘lzma’}

The decompression algorithm used to load the fit result.

Returns:
FitResult

The loaded fit result.

class MLEResult(minuit: Minuit, helper: Helper)[source]#

Bases: FitResult

Result of maximum likelihood fit.

Attributes

aic

Akaike information criterion with sample size correction.

bic

Bayesian information criterion.

deviance

Deviance of the model at MLE.

dof

Degree of freedom.

gof

Goodness of fit p-value.

mle

MLE and error of parameters.

ndata

Data points number.

plot

Result plotter.

status

Fit status of Minuit.

Methods

boot([n, seed, parallel, n_parallel, ...])

Preform parametric bootstrap.

ci([cl, params, fn, method, rtol, parallel])

Calculate confidence intervals.

covar([params, fn, method, parallel])

Calculate covariance matrix.

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

Calculate the isotropic emission energy of model.

flux(emin, emax[, energy, cl, method, ...])

Calculate the flux of model.

load(path[, decompress])

Load a previously saved fit result.

lumin(emin_rest, emax_rest, z, cl, method, ...)

Calculate the luminosity of model.

save(path[, compress])

Save the fit result to a file.

summary([file])

Print the summary of fit result.

property plot: MLEResultPlotter#

Result plotter.

boot(n: int = 10000, seed: int | None = None, parallel: bool = True, n_parallel: int | None = None, progress: bool = True, update_rate: int = 50)[source]#

Preform parametric bootstrap.

Parameters:
nint, optional

Number of parametric bootstraps based on the MLE. The default is 10000.

seedint, optional

The seed of random number generator used in parametric bootstrap.

parallelbool, optional

Whether to run simulation fit in parallel. The default is True.

n_parallelint, optional

Number of parallel processes to use when parallel is True. Defaults to jax.local_device_count().

progressbool, optional

Whether to display progress bar. The default is True.

update_rateint, optional

The update rate of progress bar. The default is 50.

covar(params: str | Sequence[str] | None = None, fn: dict[str, Callable] | None = None, method: Literal['hess', 'boot'] = 'hess', parallel: bool = True) ParamsCovar[source]#

Calculate covariance matrix.

Parameters:
paramsstr or sequence of str, optional

Parameters to calculate covariance matrix. If not specified, calculate for parameters of interest.

fndict

A dict containing functions to calculate the covariance matrix. The keys are the names of the function results, and the values are the functions whose input is a dict of model parameters.

method{‘hess’, ‘boot’}, optional

Method used to calculate covariance. Available options are:

  • 'hess': inverse of Hessian matrix from Minuit

  • 'boot': calculate covariance based on bootstrap samples, MLEResult.boot() must be called before using this method.

The default is 'hess'.

parallelbool, optional

Whether to evaluate fn in parallel when method is 'boot'. The default is True.

Returns:
ParamsCovar

The covariance matrix.

ci(cl: float | int = 1, params: str | Iterable[str] | None = None, fn: dict[str, Callable] | None = None, method: Literal['profile', 'boot'] = 'profile', rtol: float | dict[str, float] = 1e-06, parallel: bool = True) ConfidenceInterval[source]#

Calculate confidence intervals.

Parameters:
clfloat or int, optional

Confidence level for the confidence interval. If 0 < cl < 1, the value is interpreted as the confidence level. If cl >= 1, it is interpreted as the number of standard deviations. For example, cl=1 produces a 1-sigma or 68.3% confidence interval. The default is 1.

paramsstr or sequence of str, optional

Parameters to calculate confidence intervals. If not specified, calculate for parameters of interest.

fndict, optional

A dict containing functions to calculate the confidence intervals. The keys are the names of the function results, and the values are the functions whose input is a dict of model parameters.

method{‘profile’, ‘boot’}, optional

Method for calculating confidence intervals. Available options are:

  • 'profile': use Minos algorithm of Minuit to find the confidence intervals based on the profile likelihood

  • 'boot': use parametric bootstrap method to calculate the confidence intervals. MLEResult.boot() must be called before using this method.

The default is 'profile'.

rtolfloat, or dict of float, optional

The relative tolerance in determining the value of composite parameters and fn when method is 'profile'. The default is 1e-6.

parallelbool, optional

Whether to evaluate fn in parallel when method is 'boot'. The default is True.

Returns:
ConfidenceInterval

The confidence intervals.

flux(emin: float | int, emax: float | int, energy: bool = True, cl: float | int = 1, method: Literal['profile', 'boot'] = 'profile', ngrid: int = 1000, comps: bool = False, log: bool = True, params: dict[str, float | int] | None = None) MLEFlux[source]#

Calculate the flux of model.

Warning

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

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.

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.

clfloat or int, optional

Confidence level for the confidence interval. If 0 < cl < 1, the value is interpreted as the confidence level. If cl >= 1, it is interpreted as the number of standard deviations. For example, cl=1 produces a 1-sigma or 68.3% confidence interval. The default is 1.

method{‘profile’, ‘boot’}, optional

Method for calculating confidence intervals. Available options are:

  • 'profile': use Minos algorithm of Minuit to find the confidence intervals based on the profile likelihood

  • 'boot': use parametric bootstrap method to calculate the confidence intervals. MLEResult.boot() must be called before using this method.

The default is 'profile'.

ngridint, optional

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

Returns:
MLEFlux

The flux of the model.

Other Parameters:
compsbool, optional

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

logbool, optional

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

paramsdict, optional

Parameters dict to overwrite the fitted parameters.

lumin(emin_rest: float | int, emax_rest: float | int, z: float | int, cl: float | int = 1, method: Literal['profile', 'boot']='profile', ngrid: int = 1000, comps: bool = False, log: bool = True, params: dict[str, float | int] | None=None, 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)) MLELumin[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.

clfloat or int, optional

Confidence level for the confidence interval. If 0 < cl < 1, the value is interpreted as the confidence level. If cl >= 1, it is interpreted as the number of standard deviations. For example, cl=1 produces a 1-sigma or 68.3% confidence interval. The default is 1.

method{‘profile’, ‘boot’}, optional

Method for calculating confidence intervals. Available options are:

  • 'profile': use Minos algorithm of Minuit to find the confidence intervals based on the profile likelihood

  • 'boot': use parametric bootstrap method to calculate the confidence intervals. MLEResult.boot() must be called before using this method.

The default is 'profile'.

ngridint, optional

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

Returns:
MLELumin

The luminosity of the model.

Other Parameters:
compsbool, optional

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

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.

eiso(emin_rest: float | int, emax_rest: float | int, z: float | int, duration: float | int, cl: float | int = 1, method: Literal['profile', 'boot']='profile', ngrid: int = 1000, comps: bool = False, log: bool = True, params: dict[str, float | int] | None=None, 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)) MLEEiso[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 seconds.

clfloat or int, optional

Confidence level for the confidence interval. If 0 < cl < 1, the value is interpreted as the confidence level. If cl >= 1, it is interpreted as the number of standard deviations. For example, cl=1 produces a 1-sigma or 68.3% confidence interval. The default is 1.

method{‘profile’, ‘boot’}, optional

Method for calculating confidence intervals. Available options are:

  • 'profile': use Minos algorithm of Minuit to find the confidence intervals based on the profile likelihood

  • 'boot': use parametric bootstrap method to calculate the confidence intervals. MLEResult.boot() must be called before using this method

The default is 'profile'.

ngridint, optional

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

Returns:
MLEEiso

The isotropic emission energy of the model.

Other Parameters:
compsbool, optional

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

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.

property gof: dict[str, float]#

Goodness of fit p-value.

property mle: dict[str, tuple[float, float]]#

MLE and error of parameters.

property deviance: dict[str, float]#

Deviance of the model at MLE.

property aic: float#

Akaike information criterion with sample size correction.

property bic: float#

Bayesian information criterion.

property status: FMin#

Fit status of Minuit.

class PosteriorResult(helper: Helper, idata: InferenceData, ml_optimize: Callable, sampler_state: Any = None)[source]#

Bases: FitResult

Result obtained from Bayesian fit.

Attributes

deviance

Mean and median of model deviance.

divergence

Number of divergent samples.

dof

Degree of freedom.

ess

Effective MCMC sample size.

gof

Goodness of fit p-value.

idata

ArviZ InferenceData.

lnZ

Log model evidence and error.

loo

Pareto-smoothed importance sampling leave-one-out cross-validation (PSIS-LOO-CV).

mean

Mean of parameter samples.

median

Median of parameter samples.

mle

MLE parameters.

ndata

Data points number.

plot

Result plotter.

reff

Relative MCMC efficiency.

rhat

Computes split R-hat over MCMC chains.

sampler_state

The sampler state at the end of the sampling phase.

std

Standard deviation of parameter samples.

waic

The widely applicable information criterion (WAIC).

Methods

ci([cl, params, fn, hdi, parallel])

Calculate credible intervals.

covar([params, fn, parallel])

Calculate the covariance matrix.

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

Calculate the isotropic emission energy of model.

flux(emin, emax[, cl, energy, ngrid, hdi, ...])

Calculate the flux of model.

load(path[, decompress])

Load a previously saved fit result.

lumin(emin_rest, emax_rest, z, cl, ngrid, ...)

Calculate the luminosity of model.

ppc([n, seed, parallel, n_parallel, ...])

Perform posterior predictive check.

save(path[, compress])

Save the fit result to a file.

summary([file])

Print the summary of fit result.

property plot: PosteriorResultPlotter#

Result plotter.

covar(params: str | Iterable[str] | None = None, fn: dict[str, Callable] | None = None, parallel: bool = True) ParamsCovar[source]#

Calculate the covariance matrix.

Parameters:
paramsstr or sequence of str, optional

Parameters to calculate covariance matrix. If not specified, calculate for all parameters.

fndict, optional

A dict containing functions to calculate the covariance matrix. The keys are the names of the function results, and the values are the functions whose input is a dict of model parameters.

parallelbool, optional

Whether to use parallel computation for fn. The default is True.

Returns:
ParamsCovar

The covariance matrix.

ci(cl: float | int = 1, params: str | Iterable[str] | None = None, fn: dict[str, Callable] | None = None, hdi: bool = False, parallel: bool = True) CredibleInterval[source]#

Calculate credible intervals.

Parameters:
clfloat or int, optional

The credible level of samples within the credible interval. If 0 < cl < 1, the value is interpreted as the probability mass. If cl >= 1, it is interpreted as the number of standard deviations. For example, cl=1 produces a 1-sigma or 68.3% credible interval. The default is 1.

paramsstr or sequence of str, optional

Parameters to calculate confidence intervals. If not specified, calculate for parameters of interest.

fndict, optional

A dict containing functions to calculate the confidence intervals. The keys are the names of the function results, and the values are the functions whose input is a dict of model parameters.

hdibool, optional

Whether to return the highest density interval. The default is False, which means an equal tailed interval is returned.

parallelbool, optional

Whether to use parallel computation for fn. The default is True.

Returns:
CredibleInterval

The credible interval.

flux(emin: float | int, emax: float | int, cl: float | int = 1, energy: bool = True, ngrid: int = 1000, hdi: bool = False, comps: bool = False, log: bool = True, params: dict[str, float | int] | None = None) PosteriorFlux[source]#

Calculate the flux of model.

Warning

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

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.

clfloat or int, optional

The credible level of samples within the credible interval. If 0 < cl < 1, the value is interpreted as the probability mass. If cl >= 1, it is interpreted as the number of standard deviations. For example, cl=1 produces a 1-sigma or 68.3% credible interval. The default is 1.

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.

ngridint, optional

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

Returns:
PosteriorFlux

The flux of the model.

Other Parameters:
hdibool, optional

Whether to return the highest density interval. The default is False, which means an equal tailed interval is returned.

compsbool, optional

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

logbool, optional

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

paramsdict, optional

Parameters dict to overwrite the fitted parameters. Ignored when method is 'profile'.

lumin(emin_rest: float | int, emax_rest: float | int, z: float | int, cl: float | int = 1, ngrid: int = 1000, hdi: bool = False, comps: bool = False, log: bool = True, params: dict[str, float | int] | None=None, 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)) PosteriorLumin[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.

clfloat or int, optional

The credible level of samples within the credible interval. If 0 < cl < 1, the value is interpreted as the probability mass. If cl >= 1, it is interpreted as the number of standard deviations. For example, cl=1 produces a 1-sigma or 68.3% credible interval. The default is 1.

ngridint, optional

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

Returns:
PosteriorLumin

The luminosity of the model.

Other Parameters:
hdibool, optional

Whether to return the highest density interval. The default is False, which means an equal tailed interval is returned.

compsbool, optional

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

logbool, optional

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

paramsdict, optional

Parameters dict to overwrite the fitted parameters. Ignored when method is 'profile'.

cosmoLambdaCDM, optional

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

eiso(emin_rest: float | int, emax_rest: float | int, z: float | int, duration: float | int, cl: float | int = 1, ngrid: int = 1000, hdi: bool = False, comps: bool = False, log: bool = True, params: dict[str, float | int] | None=None, 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)) PosteriorEiso[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 seconds.

clfloat or int, optional

The credible level of samples within the credible interval. If 0 < cl < 1, the value is interpreted as the probability mass. If cl >= 1, it is interpreted as the number of standard deviations. For example, cl=1 produces a 1-sigma or 68.3% credible interval. The default is 1.

ngridint, optional

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

Returns:
PosteriorEiso

The isotropic emission energy of the model.

Other Parameters:
hdibool, optional

Whether to return the highest density interval. The default is False, which means an equal tailed interval is returned.

compsbool, optional

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

logbool, optional

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

paramsdict, optional

Parameters dict to overwrite the fitted parameters. Ignored when method is 'profile'.

cosmoLambdaCDM, optional

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

ppc(n: int = 10000, seed: int | None = None, parallel: bool = True, n_parallel: int | None = None, progress: bool = True, update_rate: int = 50)[source]#

Perform posterior predictive check.

Parameters:
nint, optional

The number of posterior predictions. The default is 10000.

seedint, optional

The seed of random number generator used in posterior predictions.

parallelbool, optional

Whether to run simulation fit in parallel. The default is True.

n_parallelint, optional

Number of parallel processes to use when parallel is True. Defaults to jax.local_device_count().

progressbool, optional

Whether to display progress bar. The default is True.

update_rateint, optional

The update rate of progress bar. The default is 50.

property gof: dict[str, float]#

Goodness of fit p-value.

property mle: dict[str, tuple[float, float]]#

MLE parameters.

property idata: InferenceData#

ArviZ InferenceData.

property sampler_state: Any#

The sampler state at the end of the sampling phase.

property mean: dict[str, float]#

Mean of parameter samples.

property std: dict[str, float]#

Standard deviation of parameter samples.

property median: dict[str, float]#

Median of parameter samples.

property deviance: dict#

Mean and median of model deviance.

property reff: float#

Relative MCMC efficiency.

property ess: dict[str, int]#

Effective MCMC sample size.

property rhat: dict[str, float]#

Computes split R-hat over MCMC chains.

In general, only fully trust the sample if R-hat is less than 1.01. In the early workflow, R-hat below 1.1 is often sufficient. See [1] for more information.

References

property divergence: int#

Number of divergent samples.

property waic: ELPDData#

The widely applicable information criterion (WAIC).

Estimates the expected log point-wise predictive density (elpd) using WAIC. Also calculates the WAIC’s standard error and the effective number of parameters. See [1] and [2] for more information.

References

property loo: ELPDData#

Pareto-smoothed importance sampling leave-one-out cross-validation (PSIS-LOO-CV).

Estimates the expected log point-wise predictive density (elpd) using PSIS-LOO-CV. Also calculates LOO’s standard error and the effective number of parameters. For more information, see [1], [2] and [3].

References

property lnZ: tuple[float, float]#

Log model evidence and error.

class ParamsCovar(names: tuple[str, ...], matrix: CovarMatrix)[source]#

Bases: NamedTuple

Covariance matrix of the model parameters.

Methods

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

names: tuple[str, ...]#

Parameter names.

matrix: Matrix#

Covariance matrix.

class ConfidenceInterval(mle: dict[str, float], se: dict[str, float], intervals: dict[str, tuple[float, float]], errors: dict[str, tuple[float, float]], cl: float, method: str, status: dict)[source]#

Bases: NamedTuple

Confidence interval result.

Methods

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

mle: dict[str, float]#

The maximum likelihood estimation.

se: dict[str, float]#

The standard errors of the MLE, calculated from Hessian matrix.

intervals: dict[str, tuple[float, float]]#

The confidence intervals.

errors: dict[str, tuple[float, float]]#

The confidence intervals in error form.

cl: float#

The confidence level.

method: str#

Method used to calculate the confidence interval.

status: dict#

Status of the calculation progress.

class MLEFlux(emin: float, emax: float, energy: bool, mle: dict[str, Q] | dict[str, dict[str, Q]], se: dict[str, Q] | dict[str, dict[str, Q]], intervals: dict[str, tuple[Q, Q]] | dict[str, dict[str, tuple[Q, Q]]], errors: dict[str, tuple[Q, Q]] | dict[str, dict[str, tuple[Q, Q]]], cl: float, method: str, status: dict)[source]#

Bases: NamedTuple

The flux of the MLE model.

Methods

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

emin: float#

Minimum value of energy range.

emax: float#

Maximum value of energy range.

energy: bool#

Whether the flux is in energy flux. False for photon flux.

mle: dict[str, Quantity] | dict[str, dict[str, Quantity]]#

The maximum likelihood estimation of flux.

se: dict[str, Quantity] | dict[str, dict[str, Quantity]]#

The standard errors of MLE, calculated from Hessian matrix.

intervals: dict[str, tuple[Quantity, Quantity]] | dict[str, dict[str, tuple[Quantity, Quantity]]]#

The confidence intervals of the model flux.

errors: dict[str, tuple[Quantity, Quantity]] | dict[str, dict[str, tuple[Quantity, Quantity]]]#

The confidence intervals of the model flux in error form.

cl: float#

The confidence level.

method: str#

Method used to calculate the confidence interval.

status: dict#

Status of the calculation progress.

class MLELumin(emin_rest: float, emax_rest: float, z: float, cosmo: LambdaCDM, mle: dict[str, Q] | dict[str, dict[str, Q]], se: dict[str, Q] | dict[str, dict[str, Q]], intervals: dict[str, tuple[Q, Q]] | dict[str, dict[str, tuple[Q, Q]]], errors: dict[str, tuple[Q, Q]] | dict[str, dict[str, tuple[Q, Q]]], cl: float, method: str, status: str)[source]#

Bases: NamedTuple

The luminosity of the MLE model.

Methods

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

emin_rest: float#

Minimum value of rest-frame energy range.

emax_rest: float#

Maximum value of rest-frame energy range.

z: float#

Redshift of the source.

cosmo: LambdaCDM#

Cosmology model used to calculate luminosity.

mle: dict[str, Quantity] | dict[str, dict[str, Quantity]]#

The maximum likelihood estimation of luminosity.

se: dict[str, Quantity] | dict[str, dict[str, Quantity]]#

The standard errors of MLE, calculated from Hessian matrix.

intervals: dict[str, tuple[Quantity, Quantity]] | dict[str, dict[str, tuple[Quantity, Quantity]]]#

The confidence intervals of the model luminosity.

errors: dict[str, tuple[Quantity, Quantity]] | dict[str, dict[str, tuple[Quantity, Quantity]]]#

The confidence intervals of the model luminosity in error form.

cl: float#

The confidence level.

method: str#

Method used to calculate the confidence interval.

status: str#

Status of the calculation progress.

class MLEEiso(emin_rest: float, emax_rest: float, z: float, duration: float, cosmo: LambdaCDM, mle: dict[str, Q] | dict[str, dict[str, Q]], se: dict[str, Q] | dict[str, dict[str, Q]], intervals: dict[str, tuple[Q, Q]] | dict[str, dict[str, tuple[Q, Q]]], errors: dict[str, tuple[Q, Q]] | dict[str, dict[str, tuple[Q, Q]]], cl: float, method: str, status: str)[source]#

Bases: NamedTuple

The isotropic emission energy of the MLE model.

Methods

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

emin_rest: float#

Minimum value of rest-frame energy range.

emax_rest: float#

Maximum value of rest-frame energy range.

z: float#

Redshift of the source.

duration: float#

Observed duration of the source.

cosmo: LambdaCDM#

Cosmology model used to calculate Eiso.

mle: dict[str, Quantity] | dict[str, dict[str, Quantity]]#

The maximum likelihood estimation of Eiso.

se: dict[str, Quantity] | dict[str, dict[str, Quantity]]#

The standard errors of MLE, calculated from Hessian matrix.

intervals: dict[str, tuple[Quantity, Quantity]] | dict[str, dict[str, tuple[Quantity, Quantity]]]#

The confidence intervals of the model Eiso.

errors: dict[str, tuple[Quantity, Quantity]] | dict[str, dict[str, tuple[Quantity, Quantity]]]#

The confidence intervals of the model Eiso in error form.

cl: float#

The confidence level.

method: str#

Method used to calculate the confidence interval.

status: str#

Status of the calculation progress.

class BootstrapResult(mle: dict, data: dict, models: dict, params: dict, deviance: dict, p_value: dict, n: int, n_valid: int, seed: int)[source]#

Bases: NamedTuple

Parametric bootstrap result.

Methods

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

mle: dict#

The maximum likelihood estimation.

data: dict#

Simulation data based on MLE.

models: dict#

Bootstrap models.

params: dict#

Bootstrap parameters.

deviance: dict#

Bootstrap deviance.

p_value: dict#

Model fitness \(p\)-value.

n: int#

Numbers of bootstrap.

n_valid: int#

Numbers of valid bootstrap.

seed: int#

Seed of random number generator used in simulation.

class CredibleInterval(median: dict[str, float], intervals: dict[str, tuple[float, float]], errors: dict[str, tuple[float, float]], cl: float, method: str, dist: dict[str, JAXArray])[source]#

Bases: NamedTuple

Credible interval result.

Methods

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

median: dict[str, float]#

Median of the posterior distribution.

intervals: dict[str, tuple[float, float]]#

The credible intervals.

errors: dict[str, tuple[float, float]]#

The credible intervals in error form.

cl: float#

The credible level.

method: str#

Highest Density Interval (HDI), or equal tailed interval (ETI).

dist: dict[str, Array]#

Posterior distribution.

class PosteriorFlux(emin: float, emax: float, energy: bool, mean: dict[str, Q] | dict[str, dict[str, Q]], std: dict[str, Q] | dict[str, dict[str, Q]], median: dict[str, Q] | dict[str, dict[str, Q]], intervals: dict[str, tuple[Q, Q]] | dict[str, dict[str, tuple[Q, Q]]], errors: dict[str, tuple[Q, Q]] | dict[str, dict[str, tuple[Q, Q]]], cl: float, method: str, dist: dict[str, Q] | dict[str, dict[str, Q]])[source]#

Bases: NamedTuple

Posterior flux.

Methods

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

emin: float#

Minimum value of energy range.

emax: float#

Maximum value of energy range.

energy: bool#

Whether the flux is in energy flux. False for photon flux.

mean: dict[str, Quantity] | dict[str, dict[str, Quantity]]#

The posterior mean of the flux.

std: dict[str, Quantity] | dict[str, dict[str, Quantity]]#

The standard deviation of posterior distribution of flux.

median: dict[str, Quantity] | dict[str, dict[str, Quantity]]#

The posterior median of the flux.

intervals: dict[str, tuple[Quantity, Quantity]] | dict[str, dict[str, tuple[Quantity, Quantity]]]#

The credible intervals of the flux.

errors: dict[str, tuple[Quantity, Quantity]] | dict[str, dict[str, tuple[Quantity, Quantity]]]#

The credible intervals of the flux in error form.

cl: float#

The credible level.

method: str#

Highest Density Interval (HDI), or equal tailed interval (ETI).

dist: dict[str, Quantity] | dict[str, dict[str, Quantity]]#

Posterior flux distribution.

class PosteriorLumin(emin_rest: float, emax_rest: float, z: float, cosmo: LambdaCDM, mean: dict[str, Q] | dict[str, dict[str, Q]], std: dict[str, Q] | dict[str, dict[str, Q]], median: dict[str, Q] | dict[str, dict[str, Q]], intervals: dict[str, tuple[Q, Q]] | dict[str, dict[str, tuple[Q, Q]]], errors: dict[str, tuple[Q, Q]] | dict[str, dict[str, tuple[Q, Q]]], cl: float, method: str, dist: dict[str, Q] | dict[str, dict[str, Q]])[source]#

Bases: NamedTuple

Posterior luminosity.

Methods

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

emin_rest: float#

Minimum value of rest-frame energy range.

emax_rest: float#

Maximum value of rest-frame energy range.

z: float#

Redshift of the source.

cosmo: LambdaCDM#

Cosmology model used to calculate luminosity.

mean: dict[str, Quantity] | dict[str, dict[str, Quantity]]#

The posterior mean of luminosity.

std: dict[str, Quantity] | dict[str, dict[str, Quantity]]#

The posterior standard deviation of the luminosity.

median: dict[str, Quantity] | dict[str, dict[str, Quantity]]#

The posterior median of the luminosity.

intervals: dict[str, tuple[Quantity, Quantity]] | dict[str, dict[str, tuple[Quantity, Quantity]]]#

The credible intervals of the luminosity.

errors: dict[str, tuple[Quantity, Quantity]] | dict[str, dict[str, tuple[Quantity, Quantity]]]#

The credible intervals of the luminosity in error form.

cl: float#

The credible level.

method: str#

Highest Density Interval (HDI), or equal tailed interval (ETI).

dist: dict[str, Quantity] | dict[str, dict[str, Quantity]]#

Posterior distribution of luminosity.

class PosteriorEiso(emin_rest: float, emax_rest: float, z: float, duration: float, cosmo: LambdaCDM, mean: dict[str, Q] | dict[str, dict[str, Q]], std: dict[str, Q] | dict[str, dict[str, Q]], median: dict[str, Q] | dict[str, dict[str, Q]], intervals: dict[str, tuple[Q, Q]] | dict[str, dict[str, tuple[Q, Q]]], errors: dict[str, tuple[Q, Q]] | dict[str, dict[str, tuple[Q, Q]]], cl: float, method: str, dist: dict[str, Q] | dict[str, dict[str, Q]])[source]#

Bases: NamedTuple

Posterior isotropic emission energy.

Methods

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

emin_rest: float#

Minimum value of rest-frame energy range.

emax_rest: float#

Maximum value of rest-frame energy range.

z: float#

Redshift of the source.

duration: float#

Observed duration of the source.

cosmo: LambdaCDM#

Cosmology model used to calculate Eiso.

mean: dict[str, Quantity] | dict[str, dict[str, Quantity]]#

The posterior mean of the Eiso.

std: dict[str, Quantity] | dict[str, dict[str, Quantity]]#

The posterior standard deviation of the Eiso.

median: dict[str, Quantity] | dict[str, dict[str, Quantity]]#

The posterior median of the Eiso.

intervals: dict[str, tuple[Quantity, Quantity]] | dict[str, dict[str, tuple[Quantity, Quantity]]]#

The credible intervals of the Eiso.

errors: dict[str, tuple[Quantity, Quantity]] | dict[str, dict[str, tuple[Quantity, Quantity]]]#

The credible intervals of the Eiso in error form.

cl: float#

The credible level.

method: str#

Highest Density Interval (HDI), or equal tailed interval (ETI).

dist: dict[str, Quantity] | dict[str, dict[str, Quantity]]#

Posterior distribution of Eiso.

class PPCResult(params_rep: dict, models_rep: dict, data: dict, params_fit: dict, deviance: dict, models_fit: dict, p_value: dict, n: int, n_valid: int, seed: int)[source]#

Bases: NamedTuple

Posterior predictive check result.

Methods

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

params_rep: dict#

Posterior of free parameters used to perform ppc.

models_rep: dict#

Models’ values corresponding to params_rep.

data: dict#

Posterior predictive data.

params_fit: dict#

Best fit parameters of posterior predictive data.

deviance: dict#

Deviance of posterior predictive data and best fit models.

models_fit: dict#

Best fit models’ values of posterior predictive data.

p_value: dict#

Posterior predictive \(p\)-value.

n: int#

Numbers of posterior prediction.

n_valid: int#

Numbers of valid ppc.

seed: int#

Seed of random number generator used in simulation.