.

# Comparing PHOEBE 2 vs PHOEBE Legacy¶

NOTE: PHOEBE 1.0 legacy is an alternate backend and is not installed with PHOEBE 2.0. In order to run this backend, you’ll need to have PHOEBE 1.0 installed and manually build the python bindings in the phoebe-py directory.

## 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
import numpy as np
import matplotlib.pyplot as plt

phoebe.devel_on()  # needed to use WD-style meshing, which isn't fully supported yet

logger = phoebe.logger()

b = phoebe.default_binary()
b['q'] = 0.7
b['requiv@secondary'] = 0.7


## Adding Datasets and Compute Options¶

b.add_dataset('lc', times=np.linspace(0,1,101), dataset='lc01')

<ParameterSet: 15 parameters | contexts: compute, dataset>


Let’s add compute options for phoebe using both the new (marching) method for creating meshes as well as the WD method which imitates the format of the mesh used within legacy.

b.add_compute(compute='phoebe2marching', irrad_method='none', mesh_method='marching')

<ParameterSet: 29 parameters | datasets: lc01, rvdyn, rvnum>

b.add_compute(compute='phoebe2wd', irrad_method='none', mesh_method='wd', eclipse_method='graham')

<ParameterSet: 26 parameters | datasets: lc01, rvdyn, rvnum>


Now we add compute options for the ‘legacy’ backend.

b.add_compute('legacy', compute='phoebe1', irrad_method='none')

<ParameterSet: 13 parameters | datasets: lc01, rvdyn, rvnum>


And set the two RV datasets to use the correct methods (for both compute options)

b.set_value_all('rv_method', dataset='rvdyn', value='dynamical')

Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.

b.set_value_all('rv_method', dataset='rvnum', value='flux-weighted')

Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.


Let’s use the external atmospheres available for both phoebe1 and phoebe2

b.set_value_all('atm', 'extern_planckint')

Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.


Let’s make sure both ‘phoebe1’ and ‘phoebe2wd’ use the same value for gridsize

b.set_value_all('gridsize', 30)


Let’s also disable other special effect such as heating, gravity, and light-time effects.

b.set_value_all('ld_func', 'logarithmic')
b.set_value_all('ld_coeffs', [0.,0.])

Mon, 29 Oct 2018 10:10 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:11 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:11 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:11 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvdyn  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:11 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvnum  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:11 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvnum  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:11 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@primary or ld_func@primary@rvnum  If not addressed, this warning will continue to be raised and will throw an error at run_compute.
Mon, 29 Oct 2018 10:11 PARAMETERS   WARNING ld_func='interp' only supported by atm='ck2004'.  Either change atm@secondary or ld_func@secondary@rvnum  If not addressed, this warning will continue to be raised and will throw an error at run_compute.

b.set_value_all('rv_grav', False)

b.set_value_all('ltte', False)


Finally, let’s compute all of our models

b.run_compute(compute='phoebe2marching', model='phoebe2marchingmodel')

<ParameterSet: 10 parameters | kinds: rv, lc>

b.run_compute(compute='phoebe2wd', model='phoebe2wdmodel')

<ParameterSet: 10 parameters | kinds: rv, lc>

b.run_compute(compute='phoebe1', model='phoebe1model')

Mon, 29 Oct 2018 10:11 IO           WARNING requiv_max@primary@star@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING freq@primary@star@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING pitch@primary@star@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING yaw@primary@star@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING long_an@primary@star@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING irrad_frac_lost_bol@primary@star@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING ld_func_bol@primary@star@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING mass@primary@star@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING requiv_max@secondary@star@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING freq@secondary@star@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING pitch@secondary@star@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING yaw@secondary@star@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING long_an@secondary@star@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING irrad_frac_lost_bol@secondary@star@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING ld_func_bol@secondary@star@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING mass@secondary@star@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING pblum_ref@primary@lc01@lc_dep@dataset has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING lc_method@lc01@phoebe2wd@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING intens_weighting@lc01@lc_dep@dataset has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING fti_method@lc01@phoebe2marching@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING lc_method@lc01@phoebe2marching@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING lc_method@lc01@phoebe01@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING fti_method@lc01@phoebe2wd@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING pblum_ref@secondary@lc01@lc_dep@dataset has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING Finite integration Time is not fully supported and will be turned off by legacy wrapper before computation
Mon, 29 Oct 2018 10:11 IO           WARNING fti_method@lc01@phoebe01@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING intens_weighting@rvdyn@rv_dep@dataset has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_method@primary@rvdyn@phoebe2wd@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_method@primary@rvdyn@phoebe2marching@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_method@primary@rvdyn@phoebe1@legacy@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_method@primary@rvdyn@phoebe01@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_method@secondary@rvdyn@phoebe2wd@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_method@secondary@rvdyn@phoebe1@legacy@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING intens_weighting@rvdyn@rv_dep@dataset has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_method@secondary@rvdyn@phoebe01@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_method@secondary@rvdyn@phoebe2marching@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING intens_weighting@rvnum@rv_dep@dataset has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_grav@primary@rvnum@phoebe01@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_grav@primary@rvnum@phoebe2wd@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_method@primary@rvnum@phoebe01@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_method@primary@rvnum@phoebe2wd@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_method@primary@rvnum@phoebe2marching@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_method@primary@rvnum@phoebe1@legacy@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_grav@primary@rvnum@phoebe2marching@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING intens_weighting@rvnum@rv_dep@dataset has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_grav@secondary@rvnum@phoebe2marching@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_method@secondary@rvnum@phoebe1@legacy@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_method@secondary@rvnum@phoebe01@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_method@secondary@rvnum@phoebe2wd@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_grav@secondary@rvnum@phoebe2wd@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_grav@secondary@rvnum@phoebe01@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_method@secondary@rvnum@phoebe2marching@phoebe@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING freq@binary@orbit@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING deccdt@binary@orbit@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING t0_perpass@binary@orbit@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING t0_supconj@binary@orbit@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING mean_anom@binary@orbit@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING long_an@binary@orbit@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING asini@binary@orbit@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING ecosw@binary@orbit@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING esinw@binary@orbit@component has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING irrad_method@phoebe1@legacy@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_method@primary@rvdyn@phoebe1@legacy@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_method@primary@rvnum@phoebe1@legacy@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_method@secondary@rvdyn@phoebe1@legacy@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING rv_method@secondary@rvnum@phoebe1@legacy@compute has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING t0@system has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING ra@system has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING dec@system has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING epoch@system has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING distance@system has no phoebe 1 corollary
Mon, 29 Oct 2018 10:11 IO           WARNING hierarchy@system has no phoebe 1 corollary

<ParameterSet: 10 parameters | kinds: rv, lc>


## Plotting¶

### Light Curve¶

colors = {'phoebe2marchingmodel': 'g', 'phoebe2wdmodel': 'b', 'phoebe1model': 'r'}
afig, mplfig = b['lc01'].plot(c=colors, legend=True, show=True)


Now let’s plot the residuals between these two models

artist, = plt.plot(b.get_value('fluxes@lc01@phoebe2marchingmodel') - b.get_value('fluxes@lc01@phoebe1model'), 'g-')
artist, = plt.plot(b.get_value('fluxes@lc01@phoebe2wdmodel') - b.get_value('fluxes@lc01@phoebe1model'), 'b-')
artist = plt.axhline(0.0, linestyle='dashed', color='k')
ylim = plt.ylim(-0.003, 0.003)


### Dynamical RVs¶

Since the dynamical RVs don’t depend on the mesh, there should be no difference between the ‘phoebe2marching’ and ‘phoebe2wd’ synthetic models. Here we’ll just choose one to plot.

afig, mplfig = b.filter(dataset='rvdyn', model=['phoebe2wdmodel', 'phoebe1model']).plot(c=colors, legend=True, show=True)


And also plot the residuals of both the primary and secondary RVs (notice the scale on the y-axis)

artist, = plt.plot(b.get_value('rvs@rvdyn@primary@phoebe2wdmodel') - b.get_value('rvs@rvdyn@primary@phoebe1model'), color='b', ls=':')
artist, = plt.plot(b.get_value('rvs@rvdyn@secondary@phoebe2wdmodel') - b.get_value('rvs@rvdyn@secondary@phoebe1model'), color='b', ls='-.')
artist = plt.axhline(0.0, linestyle='dashed', color='k')
ylim = plt.ylim(-1.5e-12, 1.5e-12)


### Numerical (flux-weighted) RVs¶

afig, mplfig = b.filter(dataset='rvnum').plot(c=colors, show=True)

artist, = plt.plot(b.get_value('rvs@rvnum@primary@phoebe2marchingmodel', ) - b.get_value('rvs@rvnum@primary@phoebe1model'), color='g', ls=':')
artist, = plt.plot(b.get_value('rvs@rvnum@secondary@phoebe2marchingmodel') - b.get_value('rvs@rvnum@secondary@phoebe1model'), color='g', ls='-.')

artist, = plt.plot(b.get_value('rvs@rvnum@primary@phoebe2wdmodel', ) - b.get_value('rvs@rvnum@primary@phoebe1model'), color='b', ls=':')
artist, = plt.plot(b.get_value('rvs@rvnum@secondary@phoebe2wdmodel') - b.get_value('rvs@rvnum@secondary@phoebe1model'), color='b', ls='-.')

artist = plt.axhline(0.0, linestyle='dashed', color='k')
ylim = plt.ylim(-1e-2, 1e-2)

.
Last update: 10/29/2018 9:20 a.m. (CET)