How to use the phoebe.Bundle.default_binary function in phoebe

To help you get started, we’ve selected a few phoebe 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 phoebe-project / phoebe2 / tests / robust_vs_legacy / test_sample.py View on Github external
for name, param in params.items():
            plt.cla()
            plt.plot(param, chi2lc, 'b.')
            plt.plot(param, chi2rv, 'r.')
            plt.xlabel(name)
            plt.ylabel('chi2')
            plt.show()



    if 'sample' in argv:
        f = open('sample.results', 'a')
        N = 501

        b = phoebe.Bundle.default_binary()
        # NOTE: we'll set the time arrays later
        b.add_dataset('LC', dataset='lc01')
        b.add_dataset('RV', dataset='rv01')


        b.add_compute(compute='phoebe', atm='extern_planckint')
        b.add_compute('legacy', compute='phoebe1', atm='blackbody')

        # TODO: eventually test over ld_coeffs - but right now ld seems to be broken vs legacy
        b.set_value_all('ld_coeffs', [0,0])

        i = 0
        while True:
            try:
                period = draw_period()
                b.set_value('period@binary', period)
github phoebe-project / phoebe2 / tests / nosetests / test_cbs / test_cbs.py View on Github external
def test_binary(plot=False):

    cb = phoebe.Bundle.default_binary(contact_binary=True)
    cb.flip_constraint('pot', solve_for='requiv@primary')
    cb['pot@contact_envelope@component'] = 3.5
    cb['q'] = 1.0
    cb['teff@primary'] = 5000.
    cb['teff@secondary'] = 5000.

    # cb.set_value_all('incl',90.0)

    times = cb.to_time(np.linspace(-.1,1.1,100))
    cb.add_dataset('lc', times=times, dataset='lc01')
    cb.add_dataset('rv', time=times, dataset='rv01')

    cb.add_compute('phoebe', ntriangles=4000, compute='phoebe2', mesh_method='marching')
    cb.add_compute('legacy', gridsize=100, compute='phoebe1')

    cb.set_value_all('atm', 'extern_planckint')
github phoebe-project / phoebe2 / tests / nosetests / test_distortion_method_none / test_distortion_method_none.py View on Github external
def test_binary(plot=False):


    b = phoebe.Bundle.default_binary()
    b.add_dataset('lc', times=[0])
    b.add_dataset('lp', times=[0])
    b.add_dataset('rv', times=[0])
    b.add_dataset('mesh', times=[0])

    for comp in ['primary', 'secondary']:
        b.set_value_all('distortion_method', value='roche')
        b.set_value('distortion_method', component=comp, value='none')

        b.run_compute()

    return b
github phoebe-project / phoebe2 / tests / nosetests / test_mpi / test_mpi.py View on Github external
def test_mpi(plot=False, npoints=8):
    phoebe.reset_settings()
    phoebe.mpi_on(4)

    b = phoebe.Bundle.default_binary()

    b.add_dataset('lc', times=np.linspace(0,1,npoints))

    if plot: print "calling compute"
    b.run_compute(irrad_method='none', model='phoebe2model')
    if plot: print "model received"

    if plot:
        b.plot(show=True)

    phoebe.reset_settings()
    phoebe.mpi_off()

    return b
github phoebe-project / phoebe2 / tests / benchmark / frontend_default_binary_add_dataset.py View on Github external
import phoebe

b = phoebe.Bundle.default_binary()
b.add_dataset('lc')
github phoebe-project / phoebe2 / tests / benchmark / binary_circular_atm_lc.py View on Github external
import numpy as np
import phoebe

b = phoebe.Bundle.default_binary()

b.add_dataset('lc', time=np.linspace(0,3,101), dataset='lc01')

b.run_compute(atm='ck2004')
github phoebe-project / phoebe2 / tests / rvs_test1.py View on Github external
#system = [sma (solRad), period (d)]
    logger = phoebe.utils.get_basic_logger()

    system1 = [8., 3.]
    system2 = [215., 257.5]
    system3 = [8600., 65000.]

    fig = plt.figure()
    ax1 = fig.add_subplot(211)
    ax2 = fig.add_subplot(212)

    system = system1
    q = 1.
    ecc = 0.01

    b = phoebe.Bundle.default_binary()

    for twig in b['potential@constraint'].twigs:
        b.flip_constraint(twig, 'rpole')

    b.set_value('sma@binary',system[0])
    b.set_value('period@binary', system[1])
    b.set_value('q', q)
    b.set_value('ecc',ecc)

    imagename = 'q_'+str(q)+'_sma_'+str(system[0])+'_period_'+str(system[1])+'_ecc_'+str(ecc)+'.png'
    frametitle = 'q = '+str(q)+', sma = '+str(system[0])+', period = '+str(system[1])+', ecc = '+str(ecc)

    times, rv1_ph2, rv2_ph2, rv1_leg, rv2_leg = _beta_vs_legacy(b,frametitle,imagename,ltte=False,plot=False)

    return times, rv1_ph2, rv2_ph2, rv1_leg, rv2_leg
github phoebe-project / phoebe2 / tests / nosetests / test_gravb / test_gravb.py View on Github external
def test_binary(plot=False):
    b = phoebe.Bundle.default_binary()

    period = b.get_value('period@binary')
    b.add_dataset('lc', times=np.linspace(0,period,21))
    b.add_compute('phoebe', irrad_method='none', compute='phoebe2')
    b.add_compute('legacy', refl_num=0, compute='phoebe1')

    # set matching atmospheres
    b.set_value_all('atm', 'extern_planckint')

    # set matching limb-darkening, both bolometric and passband
    b.set_value_all('ld_func_bol', 'linear')
    b.set_value_all('ld_coeffs_bol', [0.0])

    b.set_value_all('ld_func', 'linear')
    b.set_value_all('ld_coeffs', [0.0])
github phoebe-project / phoebe2 / tests / nosetests / test_limits / test_limits.py View on Github external
def test_limits():
    b = phoebe.Bundle.default_binary()


    assert_raises(ValueError, b.set_value, 'teff@primary', -10)
    assert_raises(ValueError, b.set_value, 'teff@primary', -10*u.Celsius)

    assert_raises(ValueError, b.set_value, 'ecc@binary', 1.2)

    return b
github phoebe-project / phoebe2 / tests / nosetests / test_sun_earth / test_sun_earth.py View on Github external
def initiate_sun_earth_system(pb_str):

    b = phoebe.Bundle.default_binary()

    b.add_dataset('lc', times=[0.75,], dataset='lc01', passband=pb_str)
    b.add_dataset('mesh', times=[0.0], columns=['areas', 'mus', 'visibilities', 'abs_intensities@lc01'], dataset='mesh01')

    b['pblum@primary'] = 1.*u.solLum #* 0.99 # 0.99 is bolometric correction
    b['teff@primary'] = 1.*u.solTeff
    b['requiv@primary'] = 1.*u.solRad
    b['syncpar@primary'] = 14.61

    b['period@orbit'] = 1.*u.yr
    b['q@orbit'] = 3.986004e14/1.3271244e20   # (GM)_E / (GM)_Sun
    b['sma@orbit'] = 1.*u.au

    b['teff@secondary'] = (300, 'K')
    b['requiv@secondary'] = 1.*c.R_earth
    b['syncpar@secondary'] = 365.25