PHOEBE 2.0 Documentation

2.0 Docs

  • 1.0
  • 2.0a
  • ver: 2.0


IPython Notebook | Python Script

Minimal Contact Binary System

Setup

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

%matplotlib inline
import phoebe
from phoebe import u # units
import numpy as np
import matplotlib.pyplot as plt

logger = phoebe.logger()
/usr/local/lib/python2.7/dist-packages/IPython/kernel/__init__.py:13: ShimWarning: The IPython.kernel package has been deprecated. You should import from ipykernel or jupyter_client instead.
  "You should import from ipykernel or jupyter_client instead.", ShimWarning)
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

Here we’ll initialize a default binary, but ask for it to be created as an overcontact

b_cb = phoebe.default_binary(contact_binary=True)
/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)

We’ll compare this to the default detached binary

b_detached = phoebe.default_binary()

Hierarchy

Let’s first look at the hierarchy of the default detached binary, and then compare that to the hierarchy of the overcontact system

print b_detached.hierarchy
orbit:binary

    star:primary
    star:secondary
print b_cb.hierarchy
orbit:binary

    star:primary
    star:secondary
    envelope:contact_envelope

As you can see, the overcontact system has an additional “component” with method “envelope” and component label “contact_envelope”.

Next let’s look at the parameters in this envelope component

print b_cb.filter(component='contact_envelope', kind='envelope', context='component')
ParameterSet: 9 parameters
  abun@contact_envelope@compo...: 0.0
  pot@contact_envelope@component: 3.5
  intens_coeff1@contact_envel...: 1.0
  intens_coeff2@contact_envel...: 1.0
  intens_coeff3@contact_envel...: 1.0
  intens_coeff4@contact_envel...: 1.0
  intens_coeff5@contact_envel...: 1.0
  ld_func_bol@contact_envelop...: logarithmic
  ld_coeffs_bol@contact_envel...: [ 0.5  0.5]
b_cb['pot@contact_envelope'] = 3.5
b_cb['pot@contact_envelope']
<Parameter: pot=3.5 | keys: description, value, quantity, default_unit, limits, visible_if, copy_for>

The individual stars are still there, but since the surface is being defined by the contact envelope, most of the parameters are no longer relevant.

print b_cb.filter(component='primary', kind='star', context='component')
ParameterSet: 8 parameters
          teff@primary@component: 6000.0 K
     gravb_bol@primary@component: 0.32
  irrad_frac_refl_bol@primary...: 0.6
* irrad_frac_lost_bol@primary...: 0.4
   ld_func_bol@primary@component: logarithmic
  ld_coeffs_bol@primary@compo...: [ 0.5  0.5]
*         mass@primary@component: 0.998813135806 solMass
*          sma@primary@component: 2.65 solRad

Now, of course, if we didn’t originally know we wanted a contact binary and built the default detached system, we could still turn it into an contact binary just by changing the hierarchy.

b_detached.add_component('envelope', component='contact_envelope')
<ParameterSet: 9 parameters | qualifiers: abun, pot, ld_func_bol, ld_coeffs_bol, intens_coeff1, intens_coeff2, intens_coeff3, intens_coeff4, intens_coeff5>
hier = phoebe.hierarchy.binaryorbit(b_detached['binary'], b_detached['primary'], b_detached['secondary'], b_detached['contact_envelope'])
print hier
orbit:binary(star:primary, star:secondary, envelope:contact_envelope)
b_detached.set_hierarchy(hier)
print b_detached.hierarchy
orbit:binary

    star:primary
    star:secondary
    envelope:contact_envelope

Likewise, we can make a contact system detached again simply by removing the envelope from the hierarchy. The parameters themselves will still exist (unless you remove them), so you can always just change the hierarchy again to change back to an overcontact system.

hier = phoebe.hierarchy.binaryorbit(b_detached['binary'], b_detached['primary'], b_detached['secondary'])
print hier
orbit:binary(star:primary, star:secondary)
b_detached.set_hierarchy(hier)
print b_detached.hierarchy
orbit:binary

    star:primary
    star:secondary

Adding Datasets

b_cb.add_dataset('mesh', times=[0], dataset='mesh01')
<ParameterSet: 2 parameters | contexts: compute, dataset>
b_cb.add_dataset('orb', times=np.linspace(0,3,201), dataset='orb01')
<ParameterSet: 3 parameters | contexts: compute, dataset>
b_cb.add_dataset('lc', times=np.linspace(0,3,21), dataset='lc01')
<ParameterSet: 16 parameters | contexts: compute, dataset>
b_cb.add_dataset('rv', times=np.linspace(0,3,21), dataset='rv01')
<ParameterSet: 16 parameters | contexts: compute, dataset>

For comparison, we’ll do the same to our detached system

b_detached.add_dataset('mesh', times=[0], dataset='mesh01')
<ParameterSet: 2 parameters | contexts: compute, dataset>
b_detached.add_dataset('orb', times=np.linspace(0,3,201), dataset='orb01')
<ParameterSet: 3 parameters | contexts: compute, dataset>
b_detached.add_dataset('lc', times=np.linspace(0,3,21), dataset='lc01')
<ParameterSet: 16 parameters | contexts: compute, dataset>
b_detached.add_dataset('rv', times=np.linspace(0,3,21), dataset='rv01')
<ParameterSet: 16 parameters | contexts: compute, dataset>

Running Compute

b_cb.run_compute(irrad_method='none')
<ParameterSet: 64 parameters | kinds: rv, mesh, orb, lc>
b_detached.run_compute(irrad_method='none')
<ParameterSet: 108 parameters | kinds: rv, mesh, orb, lc>

Synthetics

The synthetic meshes for our overcontact system are attached to the envelope component, whereas the detached system are attached to the two star components

print b_cb['mesh01@model'].components
['contact_envelope']
print b_detached['mesh01@model'].components
['primary', 'secondary']

But dynamical quantities are still attached for each star component - regardless of whether they’re in a detached or overcontact system

print b_cb['orb01@model'].components
['primary', 'secondary']
print b_detached['orb01@model'].components
['primary', 'secondary']

Plotting

Meshes

axs, artists = b_cb['mesh01@model'].plot(x='zs')
../../_images/minimal_contact_binary_50_0.png
axs, artists = b_detached['mesh01@model'].plot(x='zs')
../../_images/minimal_contact_binary_51_0.png

Orbits

axs, artists = b_cb['orb01@model'].plot()
../../_images/minimal_contact_binary_53_0.png
axs, artists = b_detached['orb01@model'].plot()
../../_images/minimal_contact_binary_54_0.png

Light Curves

axs, artists = b_cb['lc01@model'].plot()
../../_images/minimal_contact_binary_56_0.png
axs, artists = b_detached['lc01@model'].plot()
../../_images/minimal_contact_binary_57_0.png

RVs

axs, artists = b_cb['rv01@model'].plot()
../../_images/minimal_contact_binary_59_0.png
axs, artists = b_detached['rv01@model'].plot()
../../_images/minimal_contact_binary_60_0.png
Prev: Binary with Spots Next: Comparing Contacts Binaries in PHOEBE 2.0 vs PHOEBE Legacy
.
Last update: 06/07/2017 11:30 a.m. (CET)