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()
In [3]:
ps, constraints = phoebe.dataset.orb()
print ps
In [4]:
print ps['times']
In [5]:
ps_compute = phoebe.compute.phoebe()
print ps_compute
In [6]:
print ps_compute['dynamics_method']
The 'dynamics_method' parameter controls how stars and components are placed in the coordinate system as a function of time and has several choices:
In [7]:
print ps_compute['ltte']
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.
In [8]:
b.add_dataset('orb', times=np.linspace(0,3,201))
Out[8]:
In [9]:
b.run_compute()
Out[9]:
In [10]:
b['orb@model'].twigs
Out[10]:
In [11]:
print b['times@primary@orb01@orb@model']
In [12]:
print b['xs@primary@orb01@orb@model']
In [13]:
print b['vxs@primary@orb01@orb@model']
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))