jesterTOV.inference.base.prior.Prior#

class Prior(parameter_names)[source]#

Bases: object

Base class for JESTER prior distributions.

Note: This class follows the Jim/jimgw architecture. Should not be used directly since it does not implement any of the real methods.

The rationale behind this is to have a class that can be used to keep track of the names of the parameters and the transforms that are applied to them.

This class was previously inherited from flowMC’s Distribution, but that dependency has been removed to avoid interface conflicts.

__init__(parameter_names)[source]#
Parameters:

parameter_names (list[str]) – A list of names for the parameters of the prior.

Methods

__init__(parameter_names)

add_name(x)

Turn an array into a dictionary.

log_prob(z)

Evaluate the log probability of the prior.

sample(rng_key, n_samples)

Sample from the prior distribution.

Attributes

add_name(x)[source]#

Turn an array into a dictionary.

Parameters:

x (Array) – An array of parameters. Shape (n_dim,).

Return type:

dict[str, Float]

Returns:

dict[str, Float] – Dictionary mapping parameter names to values.

composite: bool#
log_prob(z)[source]#

Evaluate the log probability of the prior.

Parameters:

z (dict[str, Array]) – Dictionary of parameter names to values.

Return type:

Float

Returns:

log_prob (Float) – The log probability.

property n_dim: int#
parameter_names: list[str]#
sample(rng_key, n_samples)[source]#

Sample from the prior distribution.

Parameters:
  • rng_key (PRNGKeyArray) – A random key to use for sampling.

  • n_samples (int) – The number of samples to draw.

Return type:

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

Returns:

samples (dict[str, Float[Array, “ n_samples”]]) – Samples from the distribution. The keys are the names of the parameters.