PHOEBE 2.0 Documentation

2.0 Docs

  • 1.0
  • 2.0a
  • ver: 2.0


Prev: Advanced: Alternate Backends Next: Adding new passbands to PHOEBE
.

IPython Notebook | Python Script

Advanced: Digging into the Backend

Setup

As always, let’s do imports and initialize a logger and a new Bundle. See Building a System for more details.

%matplotlib inline
import phoebe
from phoebe import u # units
import numpy as np
import matplotlib.pyplot as plt

logger = phoebe.logger()

b = phoebe.default_binary()
b['q'] = 0.8
b['ecc'] = 0.05
/usr/local/lib/python2.7/dist-packages/IPython/kernel/__init__.py:13: ShimWarning: The IPython.kernel package has been deprecated. You should import from ipykernel or jupyter_client instead.
  "You should import from ipykernel or jupyter_client instead.", ShimWarning)
WARNING: Constant u'Gravitational constant' is already has a definition in the u'si' system [astropy.constants.constant]
WARNING:astropy:Constant u'Gravitational constant' is already has a definition in the u'si' system
WARNING: Constant u'Solar mass' is already has a definition in the u'si' system [astropy.constants.constant]
WARNING:astropy:Constant u'Solar mass' is already has a definition in the u'si' system
WARNING: Constant u'Solar radius' is already has a definition in the u'si' system [astropy.constants.constant]
WARNING:astropy:Constant u'Solar radius' is already has a definition in the u'si' system
WARNING: Constant u'Solar luminosity' is already has a definition in the u'si' system [astropy.constants.constant]
WARNING:astropy:Constant u'Solar luminosity' is already has a definition in the u'si' system
WARNING: developer mode enabled, to disable 'rm ~/.phoebe_devel_enabled' and restart phoebe
/usr/local/lib/python2.7/dist-packages/astropy/units/quantity.py:732: FutureWarning: comparison to None will result in an elementwise object comparison in the future.
  return super(Quantity, self).__eq__(other)

And we’ll attach some dummy datasets. See Datasets for more details.

b.add_dataset(phoebe.dataset.orb, times=np.linspace(0,40,1000), dataset='orb01', component=['primary', 'secondary'])

times, fluxes, sigmas = np.loadtxt('test.lc.in', unpack=True)
b.add_dataset(phoebe.dataset.lc, times=times, fluxes=fluxes, sigmas=sigmas, dataset='lc01')
<ParameterSet: 15 parameters | contexts: compute, dataset>

From the Bundle

There is a middle-layer that translates the system in the Bundle into the parameters (with correct units) required by the backend functions themselves and returns the results (again with units).

Interaction with this middle-layer is much nicer than manually building the system hierarchy, but doesn’t avoid the overhead introduced by the frontend.

Dynamics

Let’s say that you want to access (without adding a dataset) the dynamics packages for the system you have setup in the Bundle.

First we’ll look at Nbody dynamics, and later show the same for Keplerian.

b.add_compute(compute='default_options')
<ParameterSet: 25 parameters | datasets: lc01, orb01>
ts, xs, ys, zs, vxs, vys, vzs =\
    phoebe.dynamics.nbody.dynamics_from_bundle(b, np.linspace(0, 20, 500), compute='default_options')

The first returned item is an array of times - not surprisingly these match the times we just sent.

The rest of the returned items (xs, ys, etc) are each a list of arrays. The list contains an entry for each component in the system. So in this case, since we have a binary, each is a list of two arrays.

Now we can plot any of this information by pulling the correct array from these lists.

artist, = plt.plot(xs[0], zs[0], 'b-') # primary
artist, = plt.plot(xs[1], zs[1], 'r-') # secondary
../../_images/backend_11_0.png

For Keplerian dynamics, there is an additional option whether to return the Euler angles as well. Since we’ll later be using these to place the mesh in orbit, we’ll set this to True.

ts, xs, ys, zs, vxs, vys, vzs, ethetas, elongans, eincls =\
    phoebe.dynamics.keplerian.dynamics_from_bundle(b, np.linspace(0, 6, 500), compute='default_options', return_euler=True)
plt.cla()
artist, = plt.plot(xs[0], zs[0], 'b-') # primary
artist, = plt.plot(xs[1], zs[1], 'r-') # secondary
../../_images/backend_14_0.png

Meshing

Similarly, we can create a backend “system” directly from the Bundle

system = phoebe.backend.universe.System.from_bundle(b, compute='default_options')

This “system” object is just a container of multiple “bodies” which are also accessible

print system.bodies
[<phoebe.backend.universe.Star object at 0x7fb873613950>, <phoebe.backend.universe.Star object at 0x7fb873652ad0>]

First we need to initialize the mesh “standard”. By default this is done at periastron and stores a copy of each unscaled mesh at periastron. This mesh is later scaled, placed in orbit, and reprojected if necessary (for volume conservation in eccentric orbits, for example).

system.initialize_meshes()

These standards can then be accessed:

system.bodies[0].get_standard_mesh(scaled=False)
<phoebe.backend.mesh.ProtoMesh at 0x7fb86f1f30d0>
system.bodies[0].get_standard_mesh(scaled=True)
<phoebe.backend.mesh.ScaledProtoMesh at 0x7fb86f1f3090>

We then simply need to pass positions, velocities, and euler angles at a given time to have the meshes scaled and placed in orbit for us.

From the dynamics, we have lists of arrays. So for the first time, we want ts[0] and xs[:,0], etc.

xi, yi, zi, vxi, vyi, vzi, ethetai, elongani, eincli = phoebe.dynamics.dynamics_at_i(xs, ys, zs, vxs, vys, vzs, ethetas, elongans, eincls, i=0)
system.update_positions(ts[0], xi, yi, zi,
                        vxi, vyi, vzi,
                        ethetai, eincli, elongani)

The meshes are now placed in orbit at the current time. These meshes are accessible via:

system.meshes
<phoebe.backend.mesh.Meshes at 0x7fb86f1e9b50>

which acts like a dictionary to get a mesh from a single component (if desired)

system.meshes.keys()
['primary', 'secondary']

We can pull any column out of the mesh in a similar dictionary style (with an entry for each component)

system.meshes.get_column('teffs')
{'primary': array([ 5981.89316536,  5981.92428971,  5981.89316536, ...,  6004.97162367,
         6005.40471058,  6005.4111827 ]),
 'secondary': array([ 5972.23966136,  5972.28009067,  5972.23966136, ...,  6008.67309542,
         6009.36351685,  6008.29461574])}

or as a single flat array

system.meshes.get_column_flat('teffs')
array([ 5981.89316536,  5981.92428971,  5981.89316536, ...,  6008.67309542,
        6009.36351685,  6008.29461574])

Note that the column names are not identical to those exposed in the frontend (since tags do not exist in the backend). To access the list of available keys in the mesh, we can directly inspect the mesh.

system.meshes['primary'].keys()
['pvertices',
 'vertices',
 'triangles',
 'centers',
 'coords_for_computations',
 'normals_for_computations',
 'rs',
 'rprojs',
 'cosbetas',
 'areas',
 'tareas',
 'areas_si',
 'velocities',
 'vnormals',
 'tnormals',
 'normgrads',
 'volume',
 'phis',
 'thetas',
 'env_comp',
 'env_comp3',
 'compute_at_vertices',
 'loggs',
 'gravs',
 'teffs',
 'abuns',
 'frac_refls',
 'mus',
 'visibilities',
 'weights',
 'observables']

update_positions places the meshes in their orbits, handles volume conservation (for eccentric orbits), and computes instantaneous physical quantities (teff, logg, etc), but does NOT handle eclipse detection or subdivision.

We can now update the ‘visibility’ column by running eclipse detection.

system.handle_eclipses(eclipse_alg='native')
[array([[ -1.97877337e-01,   1.00675781e+00,  -2.33501302e+00],
        [ -1.43692415e-01,   1.00237705e+00,  -2.39336106e+00],
        [ -7.50879663e-02,   9.94071020e-01,  -2.30269741e+00],
        [ -3.31342047e-02,   9.86411625e-01,  -2.39290900e+00],
        [  2.83597199e-02,   9.72352986e-01,  -2.31685960e+00],
        [  1.03525016e-01,   9.49475783e-01,  -2.36820911e+00],
        [  1.52200349e-01,   9.30454776e-01,  -2.31155291e+00],
        [  1.95028979e-01,   9.11988640e-01,  -2.38140365e+00],
        [  2.41887296e-01,   8.89153739e-01,  -2.32582583e+00],
        [  2.83082354e-01,   8.65659269e-01,  -2.38865568e+00],
        [  3.27791097e-01,   8.38424771e-01,  -2.32612874e+00],
        [  3.66197639e-01,   8.10964363e-01,  -2.39597741e+00],
        [  4.08400264e-01,   7.79651736e-01,  -2.32719621e+00],
        [  4.43549346e-01,   7.48365379e-01,  -2.40321800e+00],
        [  4.82868220e-01,   7.13279844e-01,  -2.32910747e+00],
        [  5.50444275e-01,   6.39931157e-01,  -2.33204976e+00],
        [  6.10394096e-01,   5.60309417e-01,  -2.33672249e+00],
        [  6.60134923e-01,   4.78872150e-01,  -2.34371613e+00],
        [  7.03539133e-01,   3.89068921e-01,  -2.34626330e+00],
        [  7.37739530e-01,   2.95352586e-01,  -2.34780818e+00],
        [  7.62098393e-01,   2.00057436e-01,  -2.34967644e+00],
        [  7.77035395e-01,   1.01408510e-01,  -2.34967644e+00],
        [  7.81957658e-01,   1.75683280e-03,  -2.34967644e+00],
        [  7.77059618e-01,  -9.52480530e-02,  -2.34731244e+00],
        [  7.63836646e-01,  -1.85268118e-01,  -2.33895566e+00],
        [  7.42792353e-01,  -2.71858947e-01,  -2.32320047e+00],
        [  7.26024600e-01,  -3.22285159e-01,  -2.39825719e+00],
        [  7.13664878e-01,  -3.56527687e-01,  -2.30537873e+00],
        [  6.93389541e-01,  -4.06571102e-01,  -2.37920049e+00],
        [  6.49049106e-01,  -4.94312709e-01,  -2.36216998e+00],
        [  6.01920812e-01,  -5.68677750e-01,  -2.33303341e+00],
        [  5.59879673e-01,  -6.23008874e-01,  -2.40154140e+00],
        [  5.41395374e-01,  -6.46691158e-01,  -2.31871975e+00],
        [  5.01617043e-01,  -6.89695850e-01,  -2.39946547e+00],
        [  4.73059405e-01,  -7.19313683e-01,  -2.31559730e+00],
        [  4.19041197e-01,  -7.68694063e-01,  -2.34711065e+00],
        [  3.54980530e-01,  -8.17341618e-01,  -2.38465389e+00],
        [  2.81094927e-01,  -8.66393937e-01,  -2.33291644e+00],
        [  1.93638871e-01,  -9.12181289e-01,  -2.34757560e+00],
        [  1.02047115e-01,  -9.48903335e-01,  -2.38176562e+00],
        [  4.77038642e-02,  -9.65927040e-01,  -2.30739317e+00],
        [  6.82034481e-03,  -9.77071198e-01,  -2.39150543e+00],
        [ -4.53536931e-02,  -9.89078649e-01,  -2.33491865e+00],
        [ -9.11219085e-02,  -9.96106087e-01,  -2.39094312e+00],
        [ -1.43892591e-01,  -1.00316330e+00,  -2.32812423e+00],
        [ -2.48843862e-01,  -1.00759728e+00,  -2.32476443e+00],
        [ -3.48480428e-01,  -1.00183900e+00,  -2.32381588e+00],
        [ -4.35802585e-01,  -9.88207153e-01,  -2.37015605e+00],
        [ -5.22520022e-01,  -9.67444016e-01,  -2.35539886e+00],
        [ -6.16178511e-01,  -9.34871384e-01,  -2.36645983e+00],
        [ -6.81133802e-01,  -9.06276891e-01,  -2.34007811e+00],
        [ -7.60411663e-01,  -8.63181509e-01,  -2.38264151e+00],
        [ -8.35686980e-01,  -8.13925901e-01,  -2.34278122e+00],
        [ -9.05702859e-01,  -7.58278762e-01,  -2.33927718e+00],
        [ -9.59163693e-01,  -7.06081532e-01,  -2.40109759e+00],
        [ -9.90513216e-01,  -6.74133347e-01,  -2.31193150e+00],
        [ -1.04498691e+00,  -6.09142762e-01,  -2.33571131e+00],
        [ -1.09858214e+00,  -5.31383844e-01,  -2.36787933e+00],
        [ -1.13607332e+00,  -4.64716596e-01,  -2.31224646e+00],
        [ -1.17050958e+00,  -3.92945987e-01,  -2.33621405e+00],
        [ -1.20434171e+00,  -3.01321344e-01,  -2.34302683e+00],
        [ -1.22568917e+00,  -2.20487314e-01,  -2.32548668e+00],
        [ -1.23953992e+00,  -1.45685744e-01,  -2.34172762e+00],
        [ -1.24706759e+00,  -7.50699898e-02,  -2.38147678e+00],
        [ -1.25036386e+00,  -2.23397669e-03,  -2.32891621e+00],
        [ -1.24524871e+00,   9.73957827e-02,  -2.33085727e+00],
        [ -1.23544101e+00,   1.68142895e-01,  -2.37233546e+00],
        [ -1.23040097e+00,   1.91473474e-01,  -2.30116102e+00],
        [ -1.21539392e+00,   2.59059481e-01,  -2.38912149e+00],
        [ -1.18845932e+00,   3.45327232e-01,  -2.34684703e+00],
        [ -1.15963791e+00,   4.15038257e-01,  -2.35616511e+00],
        [ -1.12043220e+00,   4.92720674e-01,  -2.32888414e+00],
        [ -1.06903218e+00,   5.74024384e-01,  -2.35539845e+00],
        [ -1.01163322e+00,   6.48847357e-01,  -2.33954914e+00],
        [ -9.59417334e-01,   7.05564920e-01,  -2.32772851e+00],
        [ -9.24838804e-01,   7.38105567e-01,  -2.38953134e+00],
        [ -8.98162330e-01,   7.61005381e-01,  -2.29616688e+00],
        [ -8.48608103e-01,   8.02535942e-01,  -2.36970503e+00],
        [ -7.75719587e-01,   8.52673535e-01,  -2.35541213e+00],
        [ -7.11598670e-01,   8.89251676e-01,  -2.33099918e+00],
        [ -6.75308515e-01,   9.06543755e-01,  -2.39583647e+00],
        [ -6.42027846e-01,   9.21717948e-01,  -2.30303444e+00],
        [ -5.86328260e-01,   9.45162666e-01,  -2.36947676e+00],
        [ -5.48725904e-01,   9.57027028e-01,  -2.30405076e+00],
        [ -4.91047341e-01,   9.74783571e-01,  -2.37018233e+00],
        [ -4.16197112e-01,   9.91065131e-01,  -2.35104718e+00],
        [ -3.51533855e-01,   1.00001270e+00,  -2.30807755e+00],
        [ -2.81106155e-01,   1.00642275e+00,  -2.35652936e+00],
        [ -1.97877337e-01,   1.00675781e+00,  -2.33501302e+00]]),
 array([[  1.30856831e+00,   1.20425646e-01,   2.92775086e+00],
        [  1.31399792e+00,   4.57841686e-02,   2.96623760e+00],
        [  1.31473475e+00,  -1.45653029e-02,   2.91754976e+00],
        [  1.31254149e+00,  -6.01604529e-02,   2.97621925e+00],
        [  1.30626967e+00,  -1.31795389e-01,   2.95167666e+00],
        [  1.29071373e+00,  -2.18518073e-01,   2.96228790e+00],
        [  1.27719017e+00,  -2.65780907e-01,   2.87542755e+00],
        [  1.25813913e+00,  -3.31339577e-01,   2.96469896e+00],
        [  1.22253604e+00,  -4.19204479e-01,   2.95056150e+00],
        [  1.18643086e+00,  -4.89856591e-01,   2.94689544e+00],
        [  1.14659163e+00,  -5.54213722e-01,   2.95851742e+00],
        [  1.09878747e+00,  -6.19732927e-01,   2.90040541e+00],
        [  1.05661902e+00,  -6.70721419e-01,   2.93284086e+00],
        [  9.86847996e-01,  -7.41642717e-01,   2.92485505e+00],
        [  9.11824367e-01,  -8.03382582e-01,   2.95427872e+00],
        [  8.42280973e-01,  -8.50585993e-01,   2.90047629e+00],
        [  7.69954739e-01,  -8.92945968e-01,   2.95465379e+00],
        [  6.79367515e-01,  -9.34489503e-01,   2.94918692e+00],
        [  6.09361886e-01,  -9.59643947e-01,   2.93475916e+00],
        [  5.41493134e-01,  -9.78608681e-01,   2.90466628e+00],
        [  4.53072907e-01,  -9.96880918e-01,   2.94719721e+00],
        [  3.92018254e-01,  -1.00388042e+00,   2.90102754e+00],
        [  3.56877578e-01,  -1.00659447e+00,   2.97195727e+00],
        [  2.94887122e-01,  -1.00906068e+00,   2.92338474e+00],
        [  2.14323576e-01,  -1.00624535e+00,   2.93673486e+00],
        [  1.22939942e-01,  -9.94829663e-01,   2.95727157e+00],
        [  3.62670779e-02,  -9.75999428e-01,   2.96578153e+00],
        [ -3.10321991e-02,  -9.56921653e-01,   2.93343605e+00],
        [ -1.25927413e-01,  -9.19988303e-01,   2.97010246e+00],
        [ -1.59313270e-01,  -9.03710681e-01,   2.89622603e+00],
        [ -2.13645753e-01,  -8.76541479e-01,   2.95052868e+00],
        [ -2.69121420e-01,  -8.41984037e-01,   2.90318246e+00],
        [ -3.11605869e-01,  -8.13396104e-01,   2.97174984e+00],
        [ -3.48337333e-01,  -7.84540800e-01,   2.88355691e+00],
        [ -3.84243609e-01,  -7.54575569e-01,   2.99442801e+00],
        [ -4.30604592e-01,  -7.13503457e-01,   2.91616973e+00],
        [ -4.98314803e-01,  -6.40237396e-01,   2.91915882e+00],
        [ -5.58480318e-01,  -5.60749178e-01,   2.92390849e+00],
        [ -6.08408489e-01,  -4.79487190e-01,   2.93101511e+00],
        [ -6.52041160e-01,  -3.89769526e-01,   2.93361329e+00],
        [ -6.86431953e-01,  -2.96099258e-01,   2.93518990e+00],
        [ -7.10910146e-01,  -2.00843137e-01,   2.93709555e+00],
        [ -7.25894703e-01,  -1.02179722e-01,   2.93709555e+00],
        [ -7.30773131e-01,  -2.50441568e-03,   2.93709555e+00],
        [ -7.25753591e-01,   9.44628497e-02,   2.93468619e+00],
        [ -7.12384150e-01,   1.84319999e-01,   2.92618355e+00],
        [ -6.91183306e-01,   2.70708371e-01,   2.91017695e+00],
        [ -6.74315282e-01,   3.21171071e-01,   2.98507973e+00],
        [ -6.61894006e-01,   3.55171868e-01,   2.89209848e+00],
        [ -6.41537440e-01,   4.05271050e-01,   2.96576145e+00],
        [ -5.97016834e-01,   4.92904233e-01,   2.94848542e+00],
        [ -5.49820039e-01,   5.67044429e-01,   2.91902172e+00],
        [ -5.07673310e-01,   6.21563315e-01,   2.98731586e+00],
        [ -4.89198816e-01,   6.44988711e-01,   2.90452992e+00],
        [ -4.49431984e-01,   6.88148828e-01,   2.98522964e+00],
        [ -4.20830952e-01,   7.17622682e-01,   2.90137873e+00],
        [ -3.67059525e-01,   7.66905473e-01,   2.93317442e+00],
        [ -3.10192329e-01,   8.10545196e-01,   2.97217041e+00],
        [ -2.62764346e-01,   8.43687043e-01,   2.91721624e+00],
        [ -1.96498957e-01,   8.82709000e-01,   2.90663598e+00],
        [ -1.30496574e-01,   9.15432598e-01,   2.97394171e+00],
        [ -1.06898206e-01,   9.25523425e-01,   2.89679115e+00],
        [ -4.69522132e-02,   9.50030841e-01,   2.93171954e+00],
        [  3.58791917e-02,   9.74840764e-01,   2.98157972e+00],
        [  1.16528353e-01,   9.93059739e-01,   2.90901561e+00],
        [  1.92035754e-01,   1.00373235e+00,   2.91266945e+00],
        [  2.31754584e-01,   1.00633202e+00,   2.98327884e+00],
        [  2.88723001e-01,   1.00934415e+00,   2.93671159e+00],
        [  3.59347199e-01,   1.00718139e+00,   2.90351378e+00],
        [  4.12862004e-01,   1.00294702e+00,   2.96649350e+00],
        [  4.89968657e-01,   9.91793609e-01,   2.92994631e+00],
        [  5.72745719e-01,   9.71606696e-01,   2.98192041e+00],
        [  6.62293750e-01,   9.42551521e-01,   2.97566880e+00],
        [  6.99350853e-01,   9.28027144e-01,   2.91094972e+00],
        [  8.02239232e-01,   8.78049565e-01,   2.94006191e+00],
        [  8.82200243e-01,   8.26980164e-01,   2.90087569e+00],
        [  9.48936258e-01,   7.76905286e-01,   2.95563188e+00],
        [  1.00426487e+00,   7.27945596e-01,   2.92811700e+00],
        [  1.06643125e+00,   6.63164710e-01,   2.93797652e+00],
        [  1.12182898e+00,   5.94068329e-01,   2.93545383e+00],
        [  1.17856673e+00,   5.07999130e-01,   2.93656023e+00],
        [  1.21832910e+00,   4.29285036e-01,   2.98328641e+00],
        [  1.22900942e+00,   4.07348123e-01,   2.89992905e+00],
        [  1.25604851e+00,   3.40956211e-01,   2.96937444e+00],
        [  1.28403223e+00,   2.46296999e-01,   2.88093292e+00],
        [  1.28890991e+00,   2.28027575e-01,   2.97895037e+00],
        [  1.30856831e+00,   1.20425646e-01,   2.92775086e+00]])]

We can easily check to make sure an eclipse happened by computing the ratio of triangles for each component that are currently visible.

visibilities = system.meshes.get_column('visibilities')
print "primary visibility:", visibilities['primary'].sum() / len(visibilities['primary'])
print "secondary visibility:", visibilities['secondary'].sum() / len(visibilities['secondary'])
primary visibility: 0.203726012502
secondary visibility: 0.487134502924

Without the Bundle

Now let’s look at how we would setup the backend without a bundle. Once created, all of the capabilities described above are also available.

Dynamics

Dynamics without the bundle is nearly as simple, but special care needs to be made with passing values in the right units.

Once again, let’s look at Nbody first and then Keplerian.

times = np.linspace(0,10,500) # days
masses = [1.0, 0.8] # solar masses
smas = [1.0, 1.0] # AU
eccs = [0.8, 0.8] # unitless
incls = [np.pi/2, np.pi/2] # radians
per0s = [0, 0] # radians
long_ans = [0, 0] # radians
mean_anoms = [0, 0]
t0 = 0.0 # days
ts, xs, ys, zs, vxs, vys, vzs =\
    phoebe.dynamics.nbody.dynamics(times, masses, smas,
                                    eccs, incls, per0s,
                                    long_ans, mean_anoms,
                                    t0, stepsize=0.01,
                                    gr=False,
                                    ltte=False)
xi, yi, zi, vxi, vyi, vzi, ethetai, elongani, eincli = phoebe.dynamics.dynamics_at_i(xs, ys, zs, vxs, vys, vzs, ethetas, elongans, eincls, i=0)
artist, = plt.plot(xs[0], zs[0], 'b-') # primary
artist, = plt.plot(xs[1], zs[1], 'r-') # secondary
../../_images/backend_45_0.png

Now let’s look at Keplerian dynamics. Here we need to provide information for the parent orbit of each star. In the case of a simple binary, this can seem quite redundant.

times = np.linspace(0,10,500) # days
periods = [3.0, 3.0] # days
eccs = [0.0, 0.0]
smas = [1.0, 0.8] # Rsol (sma of the STAR about the CENTER OF MASS)
t0_perpasses = [0.0, 0.0] # days
per0s = [0.0, 0.0] # radians
long_ans = [0.0, 0.0] # radians
incls = [np.pi/2, np.pi/2] # radians
dpdts = [0.0, 0.0] # days/day
deccdts = [0.0, 0.0] # 1/day
dperdts = [0.0, 0.0] # radians/day
components = ['primary', 'secondary']
t0 = 0.0 # days
vgamma = 0.0 # solRad/day (TODO: double check!!!)
ts, xs, ys, zs, vxs, vys, vzs, ethetas, elongans, eincls =\
    phoebe.dynamics.keplerian.dynamics(times, periods,
                                        eccs, smas, t0_perpasses,
                                        per0s, long_ans, incls,
                                        dpdts, deccdts, dperdts,
                                        components,
                                        t0, vgamma=vgamma,
                                        ltte=False,
                                        return_euler=True)
plt.cla()
artist, = plt.plot(xs[0], ys[0], 'b-') # primary
artist, = plt.plot(xs[1], ys[1], 'r-') # secondary
../../_images/backend_49_0.png

Meshing

F = 1.0
Phi = 9.5
masses = [1.0, 0.8]  # solar Masses
sma = 8.0   # solar radii
ecc = 0.0
freq_rot = 2*np.pi/1  # radians/day
abun = 0.0
alb_ref = 0.0
teff = 6000  # K
gravb_bol = 0.2
gravb_law = 'zeipel'
primarymesh = phoebe.backend.universe.Star(F, Phi, masses, sma, ecc,
                                           freq_rot, teff, gravb_bol,
                                           abun, alb_ref,
                                           delta=0.1, maxpoints=1e5,
                                           ind_self=0,
                                           ind_sibling=1,
                                           comp_no=1)
secondarymesh = primarymesh.copy()
system = phoebe.backend.universe.System({'primary': primarymesh, 'secondary': secondarymesh})

Now that the “system” object is created, see the section in the “From the Bundle” section for details on initializing the meshes, placing them in orbit, eclipse detection, and accessing columns.

system.initialize_meshes()
system.update_positions(ts, xi, yi, zi,
                        vxi, vyi, vzi,
                        ethetai, eincli, elongani)
system.handle_eclipses(eclipse_alg='native')
/home/kyle/.local/lib/python2.7/site-packages/phoebe/backend/eclipse.py:14: DeprecationWarning: PyArray_FromDims: use PyArray_SimpleNew.
  hull, inside = ceclipse.graham_scan_inside_hull(front[sa], back)
/home/kyle/.local/lib/python2.7/site-packages/phoebe/backend/eclipse.py:14: DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use PyArray_NewFromDescr.
  hull, inside = ceclipse.graham_scan_inside_hull(front[sa], back)
/home/kyle/.local/lib/python2.7/site-packages/phoebe/backend/eclipse.py:14: DeprecationWarning: PyArray_FromDims: use PyArray_SimpleNew.
  hull, inside = ceclipse.graham_scan_inside_hull(front[sa], back)
/home/kyle/.local/lib/python2.7/site-packages/phoebe/backend/eclipse.py:14: DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use PyArray_NewFromDescr.
  hull, inside = ceclipse.graham_scan_inside_hull(front[sa], back)
Prev: Advanced: Alternate Backends Next: Adding new passbands to PHOEBE
.
Last update: 06/07/2017 11:30 a.m. (CET)