Skip to content

Prior

jimgw.core.single_event.prior ¤

UniformComponentChirpMassPrior ¤

Bases: PowerLawPrior

Prior for chirp mass induced by a uniform distribution over component masses.

When both component masses are drawn uniformly, the chirp mass follows a power-law distribution with exponent alpha = 1:

.. math::

p(\mathcal{M}_c) \propto \mathcal{M}_c, \quad
\mathcal{M}_c \in [x_{\min}, x_{\max})
parameter_names = tuple(transform.propagate_name(self.parameter_names)) instance-attribute ¤
n_dims: int property ¤
base_prior: tuple[Prior, ...] = tuple(priors) instance-attribute ¤
transforms: tuple[BijectiveTransform, ...] = tuple(transforms) instance-attribute ¤
xmin: float = xmin instance-attribute ¤
xmax: float = xmax instance-attribute ¤
alpha: float = alpha instance-attribute ¤
__repr__() ¤
__init__(xmin: float, xmax: float) -> None ¤

Parameters:

Name Type Description Default
xmin float

Minimum chirp mass.

required
xmax float

Maximum chirp mass.

required
add_name(x: Float[Array, n_dims]) -> dict[str, Float] ¤

Turn an array into a dictionary.

Parameters:

Name Type Description Default
x Array

An array of parameters. Shape (n_dims,).

required
__call__(x: dict[str, Float]) -> Float ¤
log_prob(z: dict[str, Float]) -> Float ¤

Evaluate the log-probability of a transformed sample z.

Applies the inverse transforms in reverse order, accumulating log-Jacobian determinants, then evaluates the base prior.

Parameters:

Name Type Description Default
z dict[str, Float]

Sample in the transformed (output) space.

required

Returns:

Name Type Description
Float Float

Log-probability of z under the induced distribution.

sample(rng_key: Key, n_samples: int) -> dict[str, Float[Array, ' n_samples']] ¤

Sample by drawing from the base prior and applying all transforms.

Parameters:

Name Type Description Default
rng_key Key

JAX PRNG key.

required
n_samples int

Number of samples to draw.

required

Returns:

Type Description
dict[str, Float[Array, ' n_samples']]

dict[str, Float[Array, " n_samples"]]: Transformed samples keyed by parameter name.

trace_prior_parent(output: Optional[list[Prior]] = None) -> list[Prior] ¤

Recursively collect all leaf (non-composite) priors.

Parameters:

Name Type Description Default
output Optional[list[Prior]]

Accumulator list. If None, a new list is created. Defaults to None.

None

Returns:

Type Description
list[Prior]

list[Prior]: List of all leaf prior objects in this composite.

transform(x: dict[str, Float]) -> dict[str, Float] ¤

Apply all transforms sequentially (forward direction).

Parameters:

Name Type Description Default
x dict[str, Float]

Sample in the base prior space.

required

Returns:

Type Description
dict[str, Float]

dict[str, Float]: Transformed sample.