'rv' Datasets and Options

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]:
%matplotlib inline

In [2]:
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: Constant u'Solar mass' is already has a definition in the u'si' system [astropy.constants.constant]
WARNING: Constant u'Solar radius' is already has a definition in the u'si' system [astropy.constants.constant]
WARNING: Constant u'Solar luminosity' is already has a definition in the u'si' system [astropy.constants.constant]
/usr/local/lib/python2.7/dist-packages/astropy/units/quantity.py:782: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
  return super(Quantity, self).__eq__(other)

Dataset Parameters

Let's create the ParameterSets which would be added to the Bundle when calling add_dataset. Later we'll call add_dataset, which will create and attach both these ParameterSets for us.


In [3]:
ps, constraints = phoebe.dataset.rv()
print ps


ParameterSet: 3 parameters
                  times@_default: [] d
                    rvs@_default: [] km / s
                 sigmas@_default: [] km / s

In [4]:
ps_dep = phoebe.dataset.rv_dep()
print ps_dep


ParameterSet: 4 parameters
                ld_func@_default: interp
              ld_coeffs@_default: [ 0.5  0.5]
                        passband: Johnson:V
                intens_weighting: energy

For information on these passband-dependent parameters, see the section on the lc dataset (these are used only to compute fluxes when rv_method=='flux-weighted')

times


In [5]:
print ps['times']


Parameter: times@_default
                       Qualifier: times
                     Description: Observed times
                           Value: [] d
                  Constrained by: 
                      Constrains: None
                      Related to: None

rvs


In [6]:
print ps['rvs']


Parameter: rvs@_default
                       Qualifier: rvs
                     Description: Observed radial velocity
                           Value: [] km / s
                  Constrained by: 
                      Constrains: None
                      Related to: None

sigmas


In [7]:
print ps['sigmas']


Parameter: sigmas@_default
                       Qualifier: sigmas
                     Description: Observed uncertainty on rv
                           Value: [] km / s
                  Constrained by: 
                      Constrains: None
                      Related to: None

Compute Options

Let's look at the compute options (for the default PHOEBE 2 backend) that relate to the RV dataset.

Other compute options are covered elsewhere:

  • parameters related to dynamics are explained in the section on the orb dataset
  • parameters related to meshing, eclipse detection, and subdivision (used if rv_method=='flux-weighted') are explained in the section on the mesh dataset
  • parameters related to computing fluxes (used if rv_method=='flux-weighted') are explained in the section on the lc dataset

In [8]:
ps_compute = phoebe.compute.phoebe()
print ps_compute


ParameterSet: 19 parameters
                enabled@_default: True
                 dynamics_method: keplerian
                            ltte: False
                    irrad_method: wilson
                 boosting_method: none
                       protomesh: False
                          pbmesh: False
                         horizon: False
            mesh_method@_default: marching
             ntriangles@_default: 1000
      distortion_method@_default: roche
                  eclipse_method: native
                  horizon_method: boolean
                    atm@_default: ck2004
              lc_method@_default: numerical
             fti_method@_default: none
         fti_oversample@_default: 5
     rv_method@_default@_default: flux-weighted
       rv_grav@_default@_default: False

rv_method


In [9]:
print ps_compute['rv_method']


Parameter: rv_method@_default@_default
                       Qualifier: rv_method
                     Description: Method to use for computing RVs (must be flux-weighted for Rossiter-McLaughlin)
                           Value: flux-weighted
                         Choices: flux-weighted, dynamical

If rv_method is set to 'dynamical' then the computed radial velocities are simply the z-velocities of the centers of mass of each component. In this case, only the dynamical options are relevant. For more details on these, see the section on the orb dataset.

If rv_method is set to 'flux-weighted' then radial velocities are determined by the z-velocity of each visible surface element of the mesh, weighted by their respective intensities. Since the stars are placed in their orbits by the dynamic options, the section on the orb dataset is still applicable. So are the meshing options described in mesh dataset and the options for computing fluxes in lc dataset.

rv_grav


In [10]:
print ps_compute['rv_grav']


Parameter: rv_grav@_default@_default
                       Qualifier: rv_grav
                     Description: Whether gravitational redshift effects are enabled for RVs
                           Value: False
                 Only visible if: rv_method:flux-weighted

See the Gravitational Redshift Example Script for more details on the influence this parameter has on radial velocities.

Synthetics


In [11]:
b.add_dataset('rv', times=np.linspace(0,1,101), dataset='rv01')


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

In [12]:
b.run_compute(irrad_method='none')


Out[12]:
<ParameterSet: 4 parameters | components: primary, secondary>

In [13]:
b['rv@model'].twigs


Out[13]:
['times@primary@rv01@phoebe01@latest@rv@model',
 'rvs@primary@rv01@phoebe01@latest@rv@model',
 'times@secondary@rv01@phoebe01@latest@rv@model',
 'rvs@secondary@rv01@phoebe01@latest@rv@model']

In [14]:
print b['times@primary@rv@model']


Parameter: times@primary@latest@model
                       Qualifier: times
                     Description: Observed times
                           Value: [ 0.    0.01  0.02 ...,  0.98  0.99  1.  ] d
                  Constrained by: 
                      Constrains: None
                      Related to: None


In [15]:
print b['rvs@primary@rv@model']


Parameter: rvs@primary@latest@model
                       Qualifier: rvs
                     Description: Observed radial velocity
                           Value: [ -2.82884432 -40.47397864 -40.48182383 ...,  40.49507575
  40.48401145  -2.82884432] km / s
                  Constrained by: 
                      Constrains: None
                      Related to: None

Plotting

By default, RV datasets plot as 'rvs' vs 'times'.


In [16]:
axs, artists = b['rv@model'].plot()


Since these are the only two columns available in the synthetic model, the only other options is to plot in phase instead of time.


In [17]:
axs, artists = b['rv@model'].plot(x='phases')


In system hierarchies where there may be multiple periods, it is also possible to determine whose period to use for phasing.


In [18]:
b['period'].components


Out[18]:
['binary', 'primary', 'secondary']

In [19]:
axs, artists = b['rv@model'].plot(x='phases:binary')


Mesh Fields

If a mesh dataset exists at any of the same times as the time array in the rv dataset, or if pbmesh is set to True in the compute options, then radial velocities for each surface element will be available in the model as well (only if mesh_method=='flux_weighted').

Since the radial velocities are flux-weighted, the flux-related quantities are also included. For a description of these, see the section on the lc dataset.

Let's add a single mesh at the first time of the rv dataset and re-call run_compute


In [20]:
b.add_dataset('mesh', times=[0], dataset='mesh01')


Out[20]:
<ParameterSet: 2 parameters | contexts: compute, dataset>

In [21]:
b.run_compute(irrad_method='none')


Fri, 10 Feb 2017 14:29 BUNDLE       WARNING overwriting model: latest
Out[21]:
<ParameterSet: 80 parameters | kinds: rv, mesh>

In [22]:
print b['model'].datasets


['mesh01', 'rv01']

These new columns are stored with the rv's dataset tag, but with the mesh model-kind.


In [23]:
b.filter(dataset='rv01', kind='mesh', context='model').twigs


Out[23]:
['0.0@pblum@primary@rv01@phoebe01@latest@mesh@model',
 '0.0@normal_intensities@primary@rv01@phoebe01@latest@mesh@model',
 '0.0@abs_intensities@primary@rv01@phoebe01@latest@mesh@model',
 '0.0@abs_normal_intensities@primary@rv01@phoebe01@latest@mesh@model',
 '0.0@rvs@primary@rv01@phoebe01@latest@mesh@model',
 '0.0@normal_intensities@primary@rv01@phoebe01@latest@mesh@model',
 '0.0@intensities@primary@rv01@phoebe01@latest@mesh@model',
 '0.0@boost_factors@primary@rv01@phoebe01@latest@mesh@model',
 '0.0@pblum@secondary@rv01@phoebe01@latest@mesh@model',
 '0.0@normal_intensities@secondary@rv01@phoebe01@latest@mesh@model',
 '0.0@abs_intensities@secondary@rv01@phoebe01@latest@mesh@model',
 '0.0@abs_normal_intensities@secondary@rv01@phoebe01@latest@mesh@model',
 '0.0@rvs@secondary@rv01@phoebe01@latest@mesh@model',
 '0.0@intensities@secondary@rv01@phoebe01@latest@mesh@model',
 '0.0@boost_factors@secondary@rv01@phoebe01@latest@mesh@model']

Any of these columns are then available to use as edge or facecolors when plotting the mesh (see the section on the MESH dataset), but since the mesh elements are stored with the 'mesh01' dataset tag, and the rv (including flux-related) quantities are stored with the 'rv01' dataset tag, it is important not to provide the 'mesh01' dataset tag before plotting.


In [24]:
axs, artists = b['mesh@model'].plot(facecolor='rvs', edgecolor=None)
# NOT:
# axs, artists = b['mesh01@model'].plot(facecolor='rvs', edgecolor=None)


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

rvs


In [25]:
print b['rvs@primary@rv01@mesh@model']


Parameter: 0.0@rvs@primary@latest@model
                       Qualifier: rvs
                     Description: Per-element value for rv01 dataset
                           Value: [ -5.33088819e-01  -1.61164079e-06   5.33094490e-01 ...,
  -2.11362535e+00  -1.89275043e+00  -1.35739414e+00] solRad / d
                  Constrained by: 
                      Constrains: None
                      Related to: None