TheJoker

class thejoker.sampler.TheJoker(params, pool=None, random_state=None)[source]

Bases: object

A custom Monte-Carlo sampler for two-body systems.

Parameters:

params : JokerParams

Object specifying hyper-parameters for The Joker.

pool : schwimmbad.BasePool (optional)

A processing pool (default is a schwimmbad.SerialPool instance).

random_state : numpy.random.RandomState (optional)

A RandomState instance to serve as a parent for the random number generators. See the random numbers page for more information.

Methods Summary

iterative_rejection_sample(data, …[, …]) For now: prior_cache_file is required
rejection_sample(data[, n_prior_samples, …]) Run The Joker’s rejection sampling on prior samples to get posterior samples for the input data.
sample_prior([size, return_logprobs]) Generate samples from the prior.
unpack_full_samples(samples, t_offset, …) Unpack an array of Joker samples into a dictionary of Astropy Quantity objects (with units).

Methods Documentation

iterative_rejection_sample(data, n_requested_samples, prior_cache_file, n_prior_samples=None, return_logprobs=False, magic_fudge=128)[source]

For now: prior_cache_file is required

rejection_sample(data, n_prior_samples=None, prior_cache_file=None, start_idx=0)[source]

Run The Joker’s rejection sampling on prior samples to get posterior samples for the input data.

Parameters:

data : RVData

The radial velocity.

n_prior_samples : int (optional)

prior_cache_file : str (optional)

start_idx : int (optional)

Index to start reading from in the prior cache file.

sample_prior(size=1, return_logprobs=False)[source]

Generate samples from the prior. Logarithmic in period, uniform in phase and argument of pericenter, Beta distribution in eccentricity.

Parameters:

size : int

Number of samples to generate.

return_logprobs : bool (optional)

If True, will also return the log-value of the prior at each sample.

Returns:

samples : JokerSamples

Keys: ['P', 'phi0', 'ecc', 'omega'], each as astropy.units.Quantity objects (i.e. with units).

unpack_full_samples(samples, t_offset, prior_units)[source]

Unpack an array of Joker samples into a dictionary of Astropy Quantity objects (with units). Note that the phase of pericenter returned here is now relative to BMJD = 0.

Parameters:

samples : numpy.ndarray

t_offset : numeric TODO

prior_units : list

List of units for the prior samples.

Returns:

samples : JokerSamples