PHOEBE 2.1 Documentation

2.1 Docs

IPython Notebook | Python Script

Complete Binary Animation

NOTE: animating within Jupyter notebooks can be very resource intensive. This script will likely run quicker as a Python script.


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()

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>
b.add_dataset('mesh', times=times, columns=['visibilities', 'intensities@lc01', 'rvs@rv01'], dataset='mesh01')
<ParameterSet: 4 parameters | contexts: compute, dataset>

Running Compute

<ParameterSet: 518 parameters | kinds: rv, mesh, lc>


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).

We’ll do this by making separate calls to plot, passing the matplotlib subplot location for each axes we want to create. We can then call or'anim.gif', animate=True).

b['rv01@model'].plot(c={'primary': 'blue', 'secondary': 'red'}, linestyle='solid', axpos=222)
b['mesh@model'].plot(fc='intensities@lc01', ec='None', axpos=425)
b['mesh@model'].plot(fc='rvs@rv01', ec='None', axpos=427)
b['mesh@model'].plot(fc='visibilities', ec='None', y='ws', axpos=224)

b.savefig('animation_binary_complete.gif', tight_layouot=True, draw_sidebars=False, animate=True, save_kwargs={'writer': 'imagemagick'})
/usr/lib/python2.7/dist-packages/matplotlib/ RuntimeWarning: invalid value encountered in less
  np.copyto(xa, -1, where=xa < 0.0)


Prev: Minimal Example to Produce a Synthetic Light Curve Next: Rossiter-McLaughlin Effect
Last update: 10/29/2018 9:20 a.m. (CET)