Complete Binary Animation

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]:
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: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)

Adding Datasets


In [2]:
times = np.linspace(0,1,51)

In [3]:
b.add_dataset('lc', times=times, dataset='lc01')


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

In [4]:
b.add_dataset('rv', times=times, dataset='rv01')


Out[4]:
<ParameterSet: 15 parameters | contexts: compute, dataset>

Running Compute


In [5]:
b.run_compute(irrad_method='none', pbmesh=True)


Out[5]:
<ParameterSet: 4394 parameters | kinds: rv, mesh, lc>

Plotting

See the Animations Tutorial for more examples and details.

Here we'll create a figure with multiple subplots. The top row will be the light curve and RV curve. The bottom three rows will be various representations of the mesh (intensities, rvs, and visibilities).

First we'll create the subplots, then we'll create a dictionary for each plotting command we want to call for each frame of the animation. These are then passed to animate as a list or tuple, along with the list of times.

NOTE: this call to animate is quite slow, mainly because of the need to check the maximum axes limits for each subplot for each time before beginning to plot. This may be optimized in the future - but for now is just the way its going to have to be.


In [6]:
fig = plt.figure()
ax1 = fig.add_subplot(221)
ax2 = fig.add_subplot(222)
ax3 = fig.add_subplot(425, aspect='equal')
ax4 = fig.add_subplot(427, aspect='equal')
ax5 = fig.add_subplot(224, aspect='equal')

plot1 = {'twig': 'lc01@model', 'ax': ax1}
plot2 = {'twig': 'rv01@model', 'ax': ax2}
plot3 = {'twig': 'mesh@model', 'facecolor': 'intensities@lc01', 'edgecolor': None, 'ax': ax3}
plot4 = {'twig': 'mesh@model', 'facecolor': 'rvs@rv01', 'edgecolor': None, 'ax': ax4}
plot5 = {'twig': 'mesh@model', 'facecolor': 'visibilities', 'edgecolor': None, 'y': 'zs', 'ax': ax5}

plots = (plot1, plot2, plot3, plot4, plot5)

b.animate(plots, times=times[:-1])


/home/kyle/.local/lib/python2.7/site-packages/phoebe/frontend/plotting.py:257: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  if pckwargs['edgecolors'] in ['none', 'None', None] and pckwargs['facecolors'] not in ['none', 'None', None]:
/home/kyle/.local/lib/python2.7/site-packages/phoebe/frontend/plotting.py:257: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
  if pckwargs['edgecolors'] in ['none', 'None', None] and pckwargs['facecolors'] not in ['none', 'None', None]:
/usr/local/lib/python2.7/dist-packages/matplotlib/collections.py:590: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  if self._edgecolors == str('face'):
Out[6]:


Once Loop Reflect

In [ ]: