Beispiel #1
0
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')

    # TODO: include constraint_func?  Shouldn't matter since they're not in twigs
    should_be_forbidden = b.qualifiers + b.contexts + b.kinds + [c.split('@')[0] for c in b.get_parameter('columns').choices]

    if verbose:
        for l in should_be_forbidden:
            if l not in phoebe.parameters.parameters._forbidden_labels:
                print(l)

    for l in should_be_forbidden:
        assert(l in phoebe.parameters.parameters._forbidden_labels)

    phoebe.reset_settings()
    return b
Beispiel #2
0
def test_mpi(verbose=False, plot=False, npoints=8, turn_mpi_off_after=True):
    phoebe.reset_settings()
    phoebe.mpi_on(4)

    b = phoebe.Bundle.default_binary()

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

    if verbose: print("calling compute")
    b.run_compute(irrad_method='none', ntriangles=1000, detach=True)
    if verbose:
        print("attaching to model")
        print(b['model'].status)
    b['model'].attach()

    if verbose: print("model received")

    if plot:
        b.plot(show=True)

    phoebe.reset_settings()
    if turn_mpi_off_after:
        # we need to turn this off for the next test in nosetests... but
        # if running from python or mpirun, we don't want to release all the
        # workers or they'll just pickup all the previous tasks
        phoebe.mpi_off()

    return b
Beispiel #3
0
def test_forbidden(verbose=False):

    phoebe.devel_on()

    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')
    b.add_solver('estimator.rv_geometry')
    b.add_solver('estimator.ebai')
    b.add_solver('optimizer.nelder_mead')
    b.add_solver('optimizer.differential_evolution')
    b.add_solver('optimizer.cg')
    b.add_solver('optimizer.powell')
    b.add_solver('sampler.emcee')
    b.add_solver('sampler.dynesty')


    # TODO: include constraint_func?  Shouldn't matter since they're not in twigs
    should_be_forbidden = b.qualifiers + b.contexts + b.kinds + [c.split('@')[0] for c in b.get_parameter(qualifier='columns').choices]

    if verbose:
        for l in should_be_forbidden:
            if l not in phoebe.parameters.parameters._forbidden_labels:
                print(l)

    for l in should_be_forbidden:
        assert(l in phoebe.parameters.parameters._forbidden_labels)

    phoebe.reset_settings()
    return b
Beispiel #4
0
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
Beispiel #5
0
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', ntriangles=1000, detach=True)
    if plot:
        print "attaching to model"
        print b['model'].status
    b['model'].attach()

    if plot: print "model received"

    if plot:
        b.plot(show=True)

    phoebe.reset_settings()
    phoebe.mpi_off()

    return b
Beispiel #6
0
print(b.filter('mass', component='primary'))

# No need to worry though - all constraints will be run automatically before passing to the backend.  If you need to access the value of a constrained parameter, you can explicitly ask for all delayed constraints to be executed via [b.run_delayed_constraints()](../api/phoebe.frontend.bundle.Bundle.run_delayed_constraints).

# In[18]:

b.run_delayed_constraints()

# In[19]:

print(b.filter('mass', component='primary'))

# In[20]:

phoebe.reset_settings()

# Filtering Options
# -------------------------
#
# ### check_visible
#
# By default, everytime you call filter or set_value, PHOEBE checks to see if the current value is visible (meaning it is relevant given the value of other parameters).  Although not terribly expensive, these checks can add up... so disabling these checks can save time.  Note that these are automatically *temporarily* disabled during [run_compute](../api/phoebe.frontend.bundle.Bundle.run_compute.md).  If disabling these checks, be aware that changing the value of some parameters may have no affect on the resulting computations.  You can always manually check the visibility/relevance of a parameter by calling [parameter.is_visible](../api/phoebe.parameters.Parameter.is_visible.md).
#
# This default behavior can be changed via [phoebe.check_visible_on()](../api/phoebe.check_visible_on.md) or [phoebe.check_visible_off()](../api/phoebe.check_visible_off.md).
#
# Let's first look at the default behavior with check_visible on.

# In[21]:

b.add_dataset('lc')