How to use the phoebe.logger 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_limits / test_limits.py View on Github external
phoebe.logger('DEBUG')

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

if __name__ == '__main__':
    logger = phoebe.logger(clevel='INFO')


    b = test_limits()
github phoebe-project / phoebe2 / tests / nosetests / test_distortion_method_none / test_distortion_method_none.py View on Github external
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

if __name__ == '__main__':
    logger = phoebe.logger(clevel='INFO')


    b = test_binary(plot=True)
github phoebe-project / phoebe2 / tests / nosetests / test_limits / test_limits.py View on Github external
"""
"""

import phoebe
from phoebe import u
import numpy as np
import matplotlib.pyplot as plt

from nose.tools import assert_raises

phoebe.logger('DEBUG')

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

if __name__ == '__main__':
    logger = phoebe.logger(clevel='INFO')
github phoebe-project / phoebe2 / tests / nosetests / test_hierarchy / test_hierarchy.py View on Github external
"""
"""

import phoebe

def test_binary():
    b = phoebe.Bundle.default_binary()

    b.set_hierarchy()

    b.set_hierarchy('orbit:binary(star:secondary, star:primary)')

    return b

if __name__ == '__main__':
    logger = phoebe.logger(clevel='DEBUG')

    b = test_binary()
github phoebe-project / phoebe2 / tests / nosetests / test_ecc / test_ecc.py View on Github external
b.run_compute(compute='phoebe1', refl_num=0, model='phoebe1model', overwrite=True)

        phoebe2_val = b.get_value('fluxes@phoebe2model')
        phoebe1_val = b.get_value('fluxes@phoebe1model')

        if plot:
            print("ecc: {} max (rel): {}".format(ecc , abs((phoebe2_val-phoebe1_val)/phoebe1_val).max()))

            b.plot(dataset='lc01', show=True)

        assert(np.allclose(phoebe2_val, phoebe1_val, rtol=1e-3 if ecc < 0.5 else 5e-3, atol=0.))

    return b

if __name__ == '__main__':
    logger = phoebe.logger(clevel='DEBUG')


    b = test_binary(plot=True)
github phoebe-project / phoebe2 / tests / nosetests / test_rpole_pot / test_rpole_pot.py View on Github external
Omega = b.get_value('pot', component=component, context='component')

                        pot = phoebe.distortions.roche.rpole2potential(rpole, q, e, F, component=comp_no)
                        rp = phoebe.distortions.roche.potential2rpole(pot, q, e, F, component=comp_no)

                        if plot:
                            print("pot", Omega, pot)
                            print("rpole", rpole, rp)

                        assert(abs(Omega-pot) < 1e-6)
                        assert(abs(rpole-rp)< 1e-6)

    return b

if __name__ == '__main__':
    logger = phoebe.logger(clevel='INFO')


    b = test_binary(plot=True)
github phoebe-project / phoebe2 / tests / nosetests / test_interp_value / test_interp_value.py View on Github external
# import matplotlib.pyplot as plt


def test_interp_value():
    b = phoebe.default_binary()
    b.add_dataset('lc', times=[0, 1], fluxes=[0.8, 0.7])

    assert(abs(b.get_parameter('fluxes').interp_value(times=0.5)-0.75) < 1e-12)

    times_in_s = (0.5*u.d).to(u.s)
    assert(abs(b.get_parameter('fluxes').interp_value(times=times_in_s)-0.75) < 1e-12)

    assert(abs(b.get_parameter('fluxes').interp_quantity(times=times_in_s).value-0.75) < 1e-12)

if __name__ == '__main__':
    logger = phoebe.logger(clevel='debug')

    test_interp_value()
github phoebe-project / phoebe2 / tests / nosetests / test_dpdt / test_dpdt.py View on Github external
b.run_compute(compute='phoebe1', model='phoebe1model', overwrite=True)

        phoebe2_val = b.get_value('fluxes@phoebe2model')
        phoebe1_val = b.get_value('fluxes@phoebe1model')

        if plot:
            b.plot(dataset='lc01', show=True)

            print("max (rel):", abs((phoebe2_val-phoebe1_val)/phoebe1_val).max())

        assert(np.allclose(phoebe2_val, phoebe1_val, rtol=5e-3, atol=0.))

    return b

if __name__ == '__main__':
    logger = phoebe.logger(clevel='INFO')


    b = test_binary(plot=True)
github phoebe-project / phoebe2 / tests / nosetests / test_ld / test_ld.py View on Github external
med_fluxes = np.array(med_fluxes)
            diff_med_fluxes = med_fluxes.max() - med_fluxes.min()
            if plot:
                print("atm={} ld_func={} range(med_fluxes): {}".format(atm, ld_func, diff_med_fluxes))

            if plot:
                b.show()

            assert(diff_med_fluxes < 0.035)



    return b

if __name__ == '__main__':
    logger = phoebe.logger(clevel='INFO')


    b = test_binary(plot=False)
github phoebe-project / phoebe2 / tests / nosetests / test_dynamics / test_dynamics.py View on Github external
# TODO: once ps.copy is implemented, just send b.copy() to each of these

    b = phoebe.default_binary()
    _keplerian_v_nbody(b, plot=plot)

    b = phoebe.default_binary()
    _phoebe_v_photodynam(b, plot=plot)

    b = phoebe.default_binary()
    _frontend_v_backend(b, plot=plot)

    phoebe.devel_off() # reset for future tests


if __name__ == '__main__':
    logger = phoebe.logger(clevel='INFO')


    test_binary(plot=True)