Priors
MultipleIndependent
max_log_pdf_per_axis(n_grid=1024)
Per-axis upper bound on logpdf over the prior support.
Used by least-squares MAP fits to shift the prior log-density into a
non-negative range, so that the prior contribution can be encoded as
extra residuals whose sum of squares equals
-2 * log_prior + const. The grid combines an inverse-CDF
sweep (denser where the prior is concentrated) with the support
endpoints, which suffices for the priors in this package
(uniform, loguniform, truncated norm).
build_prior(define_prior)
Build the joint prior from a list of XSPEC prior specifications.
For a single-model fit, each item must be a 3-tuple:
(component_name, parameter_name, distribution)
For a multi-model fit, each item must be a 4-tuple:
(model_name, component_name, parameter_name, distribution)
distribution can be and must behave like a SciPy continuous
distribution and provide at least support(), ppf(),
cdf(), rvs(), and logpdf().
Component and parameter names must match the names exposed by xspec.
Repeated components can be addressed with suffixed names such as powerlaw_3.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
define_prior
|
Sequence describing one prior per free XSPEC parameter. |
required |
Returns:
| Type | Description |
|---|---|
|
|
|
|
|
|
|
distribution over all unfrozen, unlinked fitted parameters. Its |
|
|
per-parameter support bounds are available on |
loguniform(low, high)
Create a log-uniform prior on a positive interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
low
|
Strictly positive lower bound. |
required | |
high
|
Upper bound. |
required |
Returns:
| Type | Description |
|---|---|
|
A SciPy |
norm(loc, scale, low, high)
Create a truncated Gaussian prior.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loc
|
Mean of the underlying Gaussian distribution. |
required | |
scale
|
Standard deviation of the underlying Gaussian distribution. |
required | |
low
|
Lower truncation bound, expressed in SciPy |
required | |
high
|
Upper truncation bound, expressed in SciPy |
required |
Returns:
| Type | Description |
|---|---|
|
A SciPy |
|
|
scale, and truncation limits. |
uniform(low, high)
Create a uniform prior on a finite interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
low
|
Lower bound of the interval. |
required | |
high
|
Upper bound of the interval. |
required |
Returns:
| Type | Description |
|---|---|
|
A SciPy |