rxmc.priors.TruncatedNormalPrior#
- class rxmc.priors.TruncatedNormalPrior(mu, sigma, lower, upper, seed=123)[source]#
Bases:
objectIndependent truncated-normal prior for a vector of parameters.
Each component
jfollows:theta_j ~ Normal(mu_j, sigma_j), truncated to [lower_j, upper_j]
The components are treated as independent, so the joint log-density is the sum of the marginal log-densities.
- Parameters:
mu (array-like, shape (ndim,)) – Mean of the untruncated normal for each component.
sigma (array-like, shape (ndim,)) – Standard deviation of the untruncated normal for each component.
lower (array-like, shape (ndim,)) – Lower truncation bound for each component.
upper (array-like, shape (ndim,)) – Upper truncation bound for each component.
seed (int, optional) – Seed for the internal random-number generator used in
rvs(). Default is123.
Methods
__init__(mu, sigma, lower, upper[, seed])logpdf(theta)Evaluate the joint log prior density.
Map unit-cube coordinates to physical parameters (Dynesty interface).
rvs(n)Draw
nindependent samples from the prior.- logpdf(theta)[source]#
Evaluate the joint log prior density.
- Parameters:
theta (array-like) – Parameter vector of shape
(ndim,)for a single evaluation, or(n, ndim)for a batch ofnvectors.- Returns:
float or ndarray – Scalar log-density when
thetahas shape(ndim,); array of shape(n,)whenthetahas shape(n, ndim).- Raises:
ValueError – If the trailing dimension of
thetadoes not equalself.dim.
- rvs(n)[source]#
Draw
nindependent samples from the prior.- Parameters:
n (int) – Number of samples to draw.
- Returns:
ndarray, shape (n, ndim) – Matrix of samples, one row per draw.
- prior_transform(u)[source]#
Map unit-cube coordinates to physical parameters (Dynesty interface).
- Parameters:
u (array-like, shape (ndim,)) – Unit-cube coordinates, each in
[0, 1).- Returns:
ndarray, shape (ndim,) – Physical parameter vector obtained by applying the component-wise percent-point function of each truncated normal.