JokerPrior#

class thejoker.JokerPrior(pars=None, poly_trend=1, v0_offsets=None, model=None)#

Bases: object

Attributes Summary

n_offsets

par_names

par_units

Methods Summary

default([P_min, P_max, sigma_K0, P0, ...])

An alternative initializer to set up the default prior for The Joker.

sample([size, generate_linear, ...])

Generate random samples from the prior.

Attributes Documentation

n_offsets#
par_names#
par_units#

Methods Documentation

classmethod default(P_min=None, P_max=None, sigma_K0=None, P0=<Quantity 1. yr>, sigma_v=None, s=None, poly_trend=1, v0_offsets=None, model=None, pars=None)#

An alternative initializer to set up the default prior for The Joker.

The default prior is:

\[\begin{split}p(P) \propto \frac{1}{P} \quad ; \quad P \in (P_{\rm min}, P_{\rm max})\\ p(e) = B(a_e, b_e)\\ p(\omega) = \mathcal{U}(0, 2\pi)\\ p(M_0) = \mathcal{U}(0, 2\pi)\\ p(s) = 0\\ p(K) = \mathcal{N}(K \,|\, \mu_K, \sigma_K)\\ \sigma_K = \sigma_{K, 0} \, \left(\frac{P}{P_0}\right)^{-1/3} \, \left(1 - e^2\right)^{-1/2}\end{split}\]

and the priors on any polynomial trend parameters are assumed to be independent, univariate Normals.

This prior has sensible choices for typical binary star or exoplanet use cases, but if you need more control over the prior distributions you might need to use the standard initializer (i.e. JokerPrior(...)`) and specify all parameter distributions manually. See the documentation for tutorials that demonstrate this functionality.

Parameters:
  • P_min (~astropy.units.Quantity [time]) – Minimum period for the default period prior.

  • P_max (~astropy.units.Quantity [time]) – Maximum period for the default period prior.

  • sigma_K0 (~astropy.units.Quantity [speed]) – The scale factor, \(\sigma_{K, 0}\) in the equation above that sets the scale of the semi-amplitude prior at the reference period, P0.

  • P0 (~astropy.units.Quantity [time]) – The reference period, \(P_0\), used in the prior on velocity semi-amplitude (see equation above).

  • sigma_v (~astropy.units.Quantity (or iterable of)) – The standard deviations of the velocity trend priors.

  • s (~astropy.units.Quantity [speed]) – The jitter value, assuming it is constant.

  • poly_trend (int (optional)) – Specifies the number of coefficients in an additional polynomial velocity trend, meant to capture long-term trends in the data. The default here is polytrend=1, meaning one term: the (constant) systemtic velocity. For example, poly_trend=3 will sample over parameters of a long-term quadratic velocity trend.

  • v0_offsets (list (optional)) – A list of additional Gaussian parameters that set systematic offsets of subsets of the data. TODO: link to tutorial here

  • model (pymc.Model (optional)) – If not specified, this will create a model instance and store it on the prior object.

  • pars (dict, list (optional)) – Either a list of pymc variables, or a dictionary of variables with keys set to the variable names. If any of these variables are defined as deterministic transforms from other variables, see the next parameter below.

sample(size=1, generate_linear=False, return_logprobs=False, rng=None, dtype=None, **kwargs)#

Generate random samples from the prior.

Parameters:
  • size (int (optional)) – The number of samples to generate.

  • generate_linear (bool (optional)) – Also generate samples in the linear parameters.

  • return_logprobs (bool (optional)) – Generate the log-prior probability at the position of each sample.

  • **kwargs – Additional keyword arguments are passed to the ~thejoker.JokerSamples initializer.

Returns:

samples – The random samples.

Return type:

thejoker.Jokersamples