Priors

class orbitize.priors.GaussianPrior(mu, sigma, no_negatives=True)[source]

Gaussian prior.

\[log(p(x|\sigma, \mu)) \propto \frac{(x - \mu)}{\sigma}\]
Parameters
  • mu (float) – mean of the distribution

  • sigma (float) – standard deviation of the distribution

  • no_negatives (bool) – if True, only positive values will be drawn from this prior, and the probability of negative values will be 0 (default:True).

(written) Sarah Blunt, 2018

compute_lnprob(element_array)[source]

Compute log(probability) of an array of numbers wrt a Gaussian distibution. Negative numbers return a probability of -inf.

Parameters

element_array (float or np.array of float) – array of numbers. We want the probability of drawing each of these from the appopriate Gaussian distribution

Returns

array of log(probability) values, corresponding to the probability of drawing each of the numbers in the input element_array.

Return type

numpy array of float

draw_samples(num_samples)[source]

Draw positive samples from a Gaussian distribution. Negative samples will not be returned.

Parameters

num_samples (float) – the number of samples to generate

Returns

samples drawn from the appropriate Gaussian distribution. Array has length num_samples.

Return type

numpy array of float

class orbitize.priors.LinearPrior(m, b)[source]

Draw samples from the probability distribution:

\[p(x) \propto mx+b\]

where m is negative, b is positive, and the range is [0,-b/m].

Parameters
  • m (float) – slope of line. Must be negative.

  • b (float) – y intercept of line. Must be positive.

draw_samples(num_samples)[source]

Draw samples from a descending linear distribution.

Parameters

num_samples (float) – the number of samples to generate

Returns

samples ranging from [0, -b/m) as floats.

Return type

samples (np.array)

class orbitize.priors.LogUniformPrior(minval, maxval)[source]

This is the probability distribution \(p(x) \propto 1/x\)

The __init__ method should take in a “min” and “max” value of the distribution, which correspond to the domain of the prior. (If this is not implemented, the prior has a singularity at 0 and infinite integrated probability).

Parameters
  • minval (float) – the lower bound of this distribution

  • maxval (float) – the upper bound of this distribution

compute_lnprob(element_array)[source]

Compute the prior probability of each element given that its drawn from a Log-Uniofrm prior

Parameters

element_array (float or np.array of float) – array of paramters to compute the prior probability of

Returns

array of prior probabilities

Return type

np.array

draw_samples(num_samples)[source]

Draw samples from this 1/x distribution.

Parameters

num_samples (float) – the number of samples to generate

Returns

samples ranging from [minval, maxval) as floats.

Return type

np.array

class orbitize.priors.Prior[source]

Abstract base class for prior objects. All prior objects should inherit from this class.

Written: Sarah Blunt, 2018

class orbitize.priors.SinPrior[source]

This is the probability distribution \(p(x) \propto sin(x)\)

The domain of this prior is [0,pi].

compute_lnprob(element_array)[source]

Compute the prior probability of each element given that its drawn from a sine prior

Parameters

element_array (float or np.array of float) – array of paramters to compute the prior probability of

Returns

array of prior probabilities

Return type

np.array

draw_samples(num_samples)[source]

Draw samples from a Sine distribution.

Parameters

num_samples (float) – the number of samples to generate

Returns

samples ranging from [0, pi) as floats.

Return type

np.array

class orbitize.priors.UniformPrior(minval, maxval)[source]

This is the probability distribution p(x) propto constant.

Parameters
  • minval (float) – the lower bound of the uniform prior

  • maxval (float) – the upper bound of the uniform prior

compute_lnprob(element_array)[source]

Compute the prior probability of each element given that its drawn from this uniform prior

Parameters

element_array (float or np.array of float) – array of paramters to compute the prior probability of

Returns

array of prior probabilities

Return type

np.array

draw_samples(num_samples)[source]

Draw samples from this uniform distribution.

Parameters

num_samples (float) – the number of samples to generate

Returns

samples ranging from [0, pi) as floats.

Return type

np.array

orbitize.priors.all_lnpriors(params, priors)[source]

Calculates log(prior probability) of a set of parameters and a list of priors

Parameters
  • params (np.array) – size of N parameters

  • priors (list) – list of N prior objects corresponding to each parameter

Returns

prior probability of this set of parameters

Return type

float