The Posterior Object
- class radvel.posterior.Posterior(likelihood: Likelihood)[source]
Posterior object Posterior object to be sent to the fitting routines. It is essentially the same as the Likelihood object, but priors are applied here. :param likelihood: Likelihood object :type likelihood: radvel.likelihood.Likelihood :param params: parameters object :type params: radvel.model.Parameters
Note
Append radvel.prior.Prior objects to the Posterior.priors list to apply priors in the likelihood calculations.
- check_proper_priors() None[source]
Checks that the priors are proper for nested sampling. Checks that the priors are properly normalized and that there is only one prior per parameter. Runs internally before nested sampling.
- extra_likelihood() float[source]
Computes “extra constraint” priors to add them to the likelihood This runs internally to add priors such as PositiveK as likelihood constraint for nested sampling. Called by Posterior.likelihood_ns_array and Posterior.extra_likelihood_array.
- Returns:
float for the extra priors’ contribution to the likelihood
- extra_likelihood_array(param_values_array: ndarray) float[source]
Calls Posterior.extra_likelihood with a vector of parameter values.
- Parameters:
param_values_array (np.ndarray) – Array of parameter values
- Returns:
float for the extra priors’ contribution to the likelihood
- get_prior_dict() dict[str, list['Prior']][source]
Prior dictionary :returns: Dictionary mapping parameters to a list of their priors :rtype: dict
- likelihood_ns_array(param_values_array: ndarray) float[source]
Likelihood of the model, with ‘extra prior’ constraints applied.
This is basically a combined call to self.likelihood.logprob() and self.extra_likelihood().
- Parameters:
param_values_array (np.ndarray) – Array of parameter values
- Returns:
Log probability of the likelihood + extra priors
- logprob() float[source]
Log probability Log-probability for the likelihood given the list of priors in Posterior.priors. :returns: log probability of the likelihood + priors :rtype: float
- logprob_array(param_values_array: ndarray) float[source]
Log probability for parameter vector Same as self.logprob, but will take a vector of parameter values. Useful as the objective function for routines that optimize a vector of parameter values instead of the dictionary-like format of the radvel.model.Parameters object. :returns: log probability of the likelihood + priors :rtype: float
- prior_transform(u: ndarray, inplace: bool = False) ndarray[source]
Prior transform for all model parameters Takes an array of uniform values between 0 and 1 and converts them to parametre values through each parameter’s prior transform.
Note: If using this outside of RadVel’s nested sampling module, make sure to call `check_proper_priors` first!
- Parameters:
u (np.ndarray) – Array of uniform values between 0 and 1 for each parameter
- Returns:
Array of parameter values derived