'orb' Datasets and Options

Setup

Let's first make sure we have the latest version of PHOEBE 2.0 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release).


In [ ]:
!pip install -I "phoebe>=2.0,<2.1"

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


In [1]:
%matplotlib inline

In [2]:
import phoebe
from phoebe import u # units
import numpy as np
import matplotlib.pyplot as plt

logger = phoebe.logger()

b = phoebe.default_binary()


WARNING: Constant u'Gravitational constant' is already has a definition in the u'si' system [astropy.constants.constant]
WARNING: Constant u'Solar mass' is already has a definition in the u'si' system [astropy.constants.constant]
WARNING: Constant u'Solar radius' is already has a definition in the u'si' system [astropy.constants.constant]
WARNING: Constant u'Solar luminosity' is already has a definition in the u'si' system [astropy.constants.constant]
/usr/local/lib/python2.7/dist-packages/astropy/units/quantity.py:782: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
  return super(Quantity, self).__eq__(other)

Dataset Parameters

Let's create the ParameterSet which would be added to the Bundle when calling add_dataset. Later we'll call add_dataset, which will create and attach this ParameterSet for us.


In [3]:
ps, constraints = phoebe.dataset.orb()
print ps


ParameterSet: 1 parameters
                  times@_default: [] d

times


In [4]:
print ps['times']


Parameter: times@_default
                       Qualifier: times
                     Description: Observed times
                           Value: [] d
                  Constrained by: 
                      Constrains: None
                      Related to: None

Compute Options

Let's look at the compute options (for the default PHOEBE 2 backend) that relate to dynamics and the ORB dataset


In [5]:
ps_compute = phoebe.compute.phoebe()
print ps_compute


ParameterSet: 19 parameters
                enabled@_default: True
                 dynamics_method: keplerian
                            ltte: False
                    irrad_method: wilson
                 boosting_method: none
                       protomesh: False
                          pbmesh: False
                         horizon: False
            mesh_method@_default: marching
             ntriangles@_default: 1000
      distortion_method@_default: roche
                  eclipse_method: native
                  horizon_method: boolean
                    atm@_default: ck2004
              lc_method@_default: numerical
             fti_method@_default: none
         fti_oversample@_default: 5
     rv_method@_default@_default: flux-weighted
       rv_grav@_default@_default: False

dynamics_method


In [6]:
print ps_compute['dynamics_method']


Parameter: dynamics_method
                       Qualifier: dynamics_method
                     Description: Which method to use to determine the dynamics of components
                           Value: keplerian
                         Choices: keplerian

The 'dynamics_method' parameter controls how stars and components are placed in the coordinate system as a function of time and has several choices:

  • keplerian (default): Use Kepler's laws to determine positions. If the system has more than two components, then each orbit is treated independently and nested (ie there are no dynamical/tidal effects - the inner orbit is treated as a single point mass in the outer orbit).
  • more coming soon

ltte


In [7]:
print ps_compute['ltte']


Parameter: ltte
                       Qualifier: ltte
                     Description: Correct for light travel time effects
                           Value: False

The 'ltte' parameter sets whether light travel time effects (Roemer delay) are included. If set to False, the positions and velocities are returned as they actually are for that given object at that given time. If set to True, they are instead returned as they were or will be when their light reaches the origin of the coordinate system.

See the Systemic Velocity Example Script for an example of how 'ltte' and 'vgamma' (systemic velocity) interplay.

Synthetics


In [8]:
b.add_dataset('orb', times=np.linspace(0,3,201))


Out[8]:
<ParameterSet: 3 parameters | contexts: compute, dataset>

In [9]:
b.run_compute()


Out[9]:
<ParameterSet: 14 parameters | components: primary, secondary>

In [10]:
b['orb@model'].twigs


Out[10]:
['times@primary@orb01@phoebe01@latest@orb@model',
 'xs@primary@orb01@phoebe01@latest@orb@model',
 'ys@primary@orb01@phoebe01@latest@orb@model',
 'zs@primary@orb01@phoebe01@latest@orb@model',
 'vxs@primary@orb01@phoebe01@latest@orb@model',
 'vys@primary@orb01@phoebe01@latest@orb@model',
 'vzs@primary@orb01@phoebe01@latest@orb@model',
 'times@secondary@orb01@phoebe01@latest@orb@model',
 'xs@secondary@orb01@phoebe01@latest@orb@model',
 'ys@secondary@orb01@phoebe01@latest@orb@model',
 'zs@secondary@orb01@phoebe01@latest@orb@model',
 'vxs@secondary@orb01@phoebe01@latest@orb@model',
 'vys@secondary@orb01@phoebe01@latest@orb@model',
 'vzs@secondary@orb01@phoebe01@latest@orb@model']

In [11]:
print b['times@primary@orb01@orb@model']


Parameter: times@primary@latest@model
                       Qualifier: times
                     Description: Synthetic times
                           Value: [ 0.     0.015  0.03  ...,  2.97   2.985  3.   ] d
                  Constrained by: 
                      Constrains: None
                      Related to: None


In [12]:
print b['xs@primary@orb01@orb@model']


Parameter: xs@primary@latest@model
                       Qualifier: xs
                     Description: X position
                           Value: [  1.62265701e-16  -2.49387030e-01  -4.96560484e-01 ...,
   4.96560484e-01   2.49387030e-01  -2.19140711e-15] solRad
                  Constrained by: 
                      Constrains: None
                      Related to: None


In [13]:
print b['vxs@primary@orb01@orb@model']


Parameter: vxs@primary@latest@model
                       Qualifier: vxs
                     Description: X velocity
                           Value: [-16.65044106 -16.57654582 -16.35551598 ..., -16.35551598
 -16.57654582 -16.65044106] solRad / d
                  Constrained by: 
                      Constrains: None
                      Related to: None

Plotting

By default, orb datasets plot as 'ys' vx 'xs' (plane of sky). Notice the y-scale here with inclination set to 90.


In [14]:
axs, artists = b['orb@model'].plot()


As always, you have access to any of the arrays for either axes, so if you want to plot 'vxs' vs 'times'


In [15]:
axs, artists = b['orb@model'].plot(x='times', y='vxs')


3d axes are not yet supported for orbits, but hopefully will be soon.

Once they are supported, they will default to x, y, and z positions plotted on their respective axes.


In [16]:
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

axs, artists = b['orb@model'].plot(xlim=(-4,4), ylim=(-4,4), zlim=(-4,4))