How to use the phoebe.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 / nosetests / test_dynamics / test_cartesian_to_keplerian.py View on Github external
def test_binary(verbose=False):
    """
    """
    b = phoebe.default_binary()

    b.add_dataset('orb', times=[0])

    for t0 in [0, 3.67]:
        b.set_value('t0', context='system', value=t0)
        b.set_value_all('compute_times', context='dataset', value=[b.get_value('t0', context='system')])
        for ecc in [0.0, 0.2]:
            b.set_value('ecc', value=ecc)
            for p in [3]:
                b.set_value('period', component='binary', context='component', value=p)
                for per0 in [0, 15]:
                    b.set_value('per0', value=per0)
                    for incl in [90, 45, 0]:
                        b.set_value('incl', component='binary', value=incl)

                        if verbose:
github phoebe-project / phoebe2 / tests / nosetests / test_cached_bundles / test_cached_bundles.py View on Github external
def test_binary():
    b1 = phoebe.default_binary(force_build=True)
    b2 = phoebe.default_binary()
github phoebe-project / phoebe2 / tests / nosetests / test_forbidden_labels / test_forbidden_parameters.py View on Github external
def test_forbidden(verbose=False):

    phoebe.devel_on()
    phoebe.check_visible_off()

    b = phoebe.default_binary(contact_binary=True)
    b.add_dataset('lc')
    b.add_dataset('rv')
    b.add_dataset('mesh')
    b.add_dataset('lp')

    b.add_compute('legacy')
    b.add_compute('photodynam')
    b.add_compute('jktebop')
    b.add_compute('ellc')

    b.add_spot(component='primary')
    b.add_gaussian_process(dataset='lc01')

    b.add_solver('estimator.lc_periodogram')
    b.add_solver('estimator.rv_periodogram')
    b.add_solver('estimator.lc_geometry')
github phoebe-project / phoebe2 / tests / nosetests / test_t0s / test_t0s.py View on Github external
# b.run_delayed_constraints()

        p2_t0_ref = b.get_value('t0_ref@component')
        p2_t0_supconj = b.get_value('t0_supconj@component')
        p2_t0_perpass = b.get_value('t0_perpass@component')

        if verbose:
            print("{}=={}, {}=={}, {}=={}".format(p1_t0_ref, p2_t0_ref, p1_t0_supconj, p2_t0_supconj, p1_t0_perpass, p2_t0_perpass))

        assert(abs(p2_t0_ref-p1_t0_ref) < tol)
        assert(abs(p2_t0_supconj-p1_t0_supconj) < tol)
        assert(abs(p2_t0_perpass-p1_t0_perpass) < tol)

    b = phoebe.Bundle.default_binary()

    b = phoebe.default_binary()
    # ecc = 0, per0 = 0
    # compare against values in PHOEBE 1 by manually setting the HJD0 in PHOEBE 1
    # so that supconj matches the prescribed 0.0
    p1_ref = 0.0 # SET
    p1_supconj = 0.0
    p1_perpass = -0.25
    assert_t0s(p1_ref, p1_supconj, p1_perpass)

    b['ecc'] = 0.2
    p1_ref = 0.063235 # SET
    p1_supconj = 0.0
    p1_perpass = -0.186765
    assert_t0s(p1_ref, p1_supconj, p1_perpass)

    b['per0'] = 90
    p1_ref = 0.0 # SET
github phoebe-project / phoebe2 / tests / nosetests / test_legacy_parser / test_legacy_export_import.py View on Github external
def test_reimport(filename=None):

#import data

    if filename:
        b = phb2.from_legacy(filename)
    else:
        b = phb2.default_binary()
        b.add_compute(kind='legacy')

    b.export_legacy('test.legacy')
    b2 = phb2.from_legacy('test.legacy')

# compare data

# check to see if datasets are attached and the right number
    Nlcs = len(b.get_dataset(kind='lc').datasets)
    Nlcs2 = len(b2.get_dataset(kind='lc').datasets)
    Nrvs = len(b.get_dataset(kind='rv').datasets)
    Nrvs2 = len(b2.get_dataset(kind='rv').datasets)

    # must be equal
    assert(Nlcs==Nlcs2)
    assert(2*Nrvs==Nrvs2)
github phoebe-project / phoebe2 / tests / nosetests / test_constraints / test_constraints.py View on Github external
def test_pot_filloutfactor(verbose=False):
    if verbose: print("b=phoebe.default_binary(contact_binary=True)")
    b = phoebe.default_binary(contact_binary=True)

    b.flip_constraint('pot', solve_for='requiv@primary')
    b.flip_constraint('fillout_factor', solve_for='pot')

    b.set_value('fillout_factor', 0.45)
    b.set_value('q', 0.25)

    assert(b.run_checks().passed)
github phoebe-project / phoebe2 / tests / nosetests / test_constraints / test_constraints.py View on Github external
def test_esinw_ecosw(verbose=False):
    if verbose: print("b=phoebe.default_binary()")
    b = phoebe.default_binary()

    if verbose: print("b.set_value('ecc', 0.5)")
    b.set_value('ecc', 0.5)

    if verbose: print(b.filter(qualifier=['ecosw', 'esinw', 'ecc', 'per0']))

    assert(b.get_value('ecosw', context='component')==0.5)
    assert(b.get_value('esinw', context='component')==0.0)
    assert(b.run_checks().passed)

    if verbose: print("b.flip_constraint('esinw', solve_for='ecc')")
    b.flip_constraint('esinw', solve_for='ecc')

    if verbose: print(b.filter(qualifier=['ecosw', 'esinw', 'ecc', 'per0']))

    assert(b.run_checks().passed==False)
github phoebe-project / phoebe2 / tests / nosetests / test_constructors / test_constructors.py View on Github external
def test_all():
    print("phoebe.Bundle() ...")
    b = phoebe.Bundle()
    print("phoebe.default_star()) ...")
    b = phoebe.default_star()
    print("phoebe.default_binary() ...")
    b = phoebe.default_binary()
    print("phoebe.default_binary(contact_binary=True) ...")
    b = phoebe.default_binary(contact_binary=True)
    # b = phoebe.default_triple(inner_as_primary=True)