How to use the orbitize.priors function in orbitize

To help you get started, we’ve selected a few orbitize examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sblunt / orbitize / tests / test_priors.py View on Github external
threshold = 1e-1

initialization_inputs = {
	priors.GaussianPrior : [1000., 1.], 
	priors.LogUniformPrior : [1., 2.], 
	priors.UniformPrior : [0., 1.], 
	priors.SinPrior : [], 
	priors.LinearPrior : [-2., 2.]
}

expected_means_mins_maxes = {
	priors.GaussianPrior : (1000.,0.,np.inf), 
	priors.LogUniformPrior : (1/np.log(2),1., 2.), 
	priors.UniformPrior : (0.5, 0., 1.), 
	priors.SinPrior : (np.pi/2., 0., np.pi), 
	priors.LinearPrior : (1./3.,0.,1.0)
}

lnprob_inputs = {
	priors.GaussianPrior : np.array([-3.0, np.inf, 1000., 999.]),
	priors.LogUniformPrior : np.array([-1., 0., 1., 1.5, 2., 2.5]),
	priors.UniformPrior : np.array([0., 0.5, 1., -1., 2.]),
	priors.SinPrior : np.array([0., np.pi/2., np.pi, 10., -1.]),
	priors.LinearPrior : np.array([0., 0.5, 1., 2., -1.])
}

expected_probs = {
	priors.GaussianPrior : np.array([0., 0., nm(1000.,1.).pdf(1000.), nm(1000.,1.).pdf(999.)]),
	priors.LogUniformPrior : np.array([0., 0., 1., 2./3., 0.5, 0.])/np.log(2),
	priors.UniformPrior : np.array([1., 1., 1., 0., 0.]),
	priors.SinPrior : np.array([0., 0.5, 0., 0., 0.]),
	priors.LinearPrior : np.array([2., 1., 0., 0., 0.])
github sblunt / orbitize / tests / test_priors.py View on Github external
import numpy as np
import pytest
from scipy.stats import norm as nm

import orbitize.priors as priors

threshold = 1e-1

initialization_inputs = {
	priors.GaussianPrior : [1000., 1.], 
	priors.LogUniformPrior : [1., 2.], 
	priors.UniformPrior : [0., 1.], 
	priors.SinPrior : [], 
	priors.LinearPrior : [-2., 2.]
}

expected_means_mins_maxes = {
	priors.GaussianPrior : (1000.,0.,np.inf), 
	priors.LogUniformPrior : (1/np.log(2),1., 2.), 
	priors.UniformPrior : (0.5, 0., 1.), 
	priors.SinPrior : (np.pi/2., 0., np.pi), 
	priors.LinearPrior : (1./3.,0.,1.0)
}

lnprob_inputs = {
	priors.GaussianPrior : np.array([-3.0, np.inf, 1000., 999.]),
github sblunt / orbitize / tests / test_multiplanet.py View on Github external
astrom_dat = read_input.read_file(filename)
    sys = system.System(2, astrom_dat, m0, plx, tau_ref_epoch=tau_ref_epoch, fit_secondary_mass=True)

    # fix most of the orbital parameters to make the dimensionality a bit smaller
    sys.sys_priors[sys.param_idx['ecc1']] = b_params[1]
    sys.sys_priors[sys.param_idx['inc1']] = b_params[2]
    sys.sys_priors[sys.param_idx['aop1']] = b_params[3]
    sys.sys_priors[sys.param_idx['pan1']] = b_params[4]

    sys.sys_priors[sys.param_idx['ecc2']] = c_params[1]
    sys.sys_priors[sys.param_idx['inc2']] = c_params[2]
    sys.sys_priors[sys.param_idx['aop2']] = c_params[3]
    sys.sys_priors[sys.param_idx['pan2']] = c_params[4]

    sys.sys_priors[sys.param_idx['m1']] = priors.LogUniformPrior(mass_b*0.01, mass_b*100)
    sys.sys_priors[sys.param_idx['m2']] = priors.LogUniformPrior(mass_c*0.01, mass_c*100)

    n_walkers = 50
    samp = sampler.MCMC(sys, num_temps=1, num_walkers=n_walkers, num_threads=1)
    # should have 8 parameters
    assert samp.num_params == 6

    # start walkers near the true location for the orbital parameters
    np.random.seed(123)
    # planet b
    samp.curr_pos[:,0] = np.random.normal(b_params[0], 0.01, n_walkers) # sma
    samp.curr_pos[:,1] = np.random.normal(b_params[-1], 0.01, n_walkers) # tau
    # planet c
    samp.curr_pos[:,2] = np.random.normal(c_params[0], 0.01, n_walkers) # sma
    samp.curr_pos[:,3] = np.random.normal(c_params[-1], 0.01, n_walkers) # tau
    # we will make a fairly broad mass starting position
    samp.curr_pos[:,4] = np.random.uniform(mass_b * 0.25, mass_b * 4, n_walkers)