PHOEBE 2.0 Documentation

2.0 Docs

  • 1.0
  • 2.0a
  • ver: 2.0


IPython Notebook | Python Script

Complete Binary Animation

Setup

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

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

times = np.linspace(0,1,51)
b.add_dataset('lc', times=times, dataset='lc01')
<ParameterSet: 15 parameters | contexts: compute, dataset>
b.add_dataset('rv', times=times, dataset='rv01')
<ParameterSet: 15 parameters | contexts: compute, dataset>

Running Compute

b.run_compute(irrad_method='none', pbmesh=True)
<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.

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


Once Loop Reflect