PHOEBE 2.0 Documentation

2.0 Docs

  • 1.0
  • 2.0a
  • ver: 2.0


IPython Notebook | Python Script

‘mesh’ Datasets and Options

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

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 ParameterSet which would be added to the Bundle when calling add_dataset. Later we’ll call add_dataset, which will create and attach this ParameterSet for us.

ps, constraints = phoebe.dataset.mesh()
print ps
ParameterSet: 1 parameters
                           times: [] d

times

print ps['times']
Parameter: times
                       Qualifier: times
                     Description: Observed times
                           Value: [] d
                  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 meshes

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

mesh_method

print ps_compute['mesh_method']
Parameter: mesh_method@_default
                       Qualifier: mesh_method
                     Description:
                           Value: marching
                         Choices: marching

The ‘mesh_method’ parameter determines how each component in the system is discretized into its mesh, but currently only has one option: * marching (default): this is the new method introduced in PHOEBE 2. The star is discretized into triangles, with the attempt to make them each of equal-area and nearly equilateral. Although not as fast as ‘wd’, this method is more robust and will always form a closed surface (when possible).

ntriangles

The ‘ntriangles’ parameter is only relevenat if mesh_method==’marching’ (so will not be available unless that is the case).

print ps_compute['ntriangles']
Parameter: ntriangles@_default
                       Qualifier: ntriangles
                     Description: Requested number of triangles (won't be exact).
                           Value: 1000
                 Only visible if: mesh_method:marching

gridsize

The ‘gridsize’ parameter is only relevant if mesh_method==’wd’ (so will not be available unless that is the case).

print ps_compute['gridsize']
ParameterSet: 0 parameters
NO PARAMETERS

Synthetics

b.add_dataset('mesh', times=[0], dataset='mesh01')
<ParameterSet: 2 parameters | contexts: compute, dataset>
b.run_compute()
<ParameterSet: 62 parameters | components: primary, secondary>
b['mesh@model'].twigs
['times@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@xs@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@ys@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@zs@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@pot@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@rpole@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@volume@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@vxs@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@vys@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@vzs@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@horizon_xs@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@horizon_ys@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@horizon_zs@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@horizon_analytic_xs@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@horizon_analytic_ys@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@horizon_analytic_zs@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@areas@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@tareas@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@vertices@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@visible_centroids@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@normals@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@nxs@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@nys@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@nzs@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@cosbetas@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@loggs@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@teffs@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@rs@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@r_projs@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@mus@primary@mesh01@phoebe01@latest@mesh@model',
 '0.0@visibilities@primary@mesh01@phoebe01@latest@mesh@model',
 'times@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@xs@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@ys@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@zs@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@pot@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@rpole@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@volume@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@vxs@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@vys@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@vzs@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@horizon_xs@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@horizon_ys@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@horizon_zs@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@horizon_analytic_xs@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@horizon_analytic_ys@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@horizon_analytic_zs@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@areas@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@tareas@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@vertices@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@visible_centroids@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@normals@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@nxs@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@nys@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@nzs@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@cosbetas@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@loggs@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@teffs@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@rs@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@r_projs@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@mus@secondary@mesh01@phoebe01@latest@mesh@model',
 '0.0@visibilities@secondary@mesh01@phoebe01@latest@mesh@model']

Per-Mesh Parameters

print b['times@primary@mesh01@model']
Parameter: times@primary@latest@model
                       Qualifier: times
                     Description: Synthetic times
                           Value: [ 0.] d
                  Constrained by:
                      Constrains: None
                      Related to: None

Per-Time Parameters

print b['volume@primary@mesh01@model']
Parameter: 0.0@volume@primary@latest@model
                       Qualifier: volume
                     Description: Volume of the stellar surface
                           Value: 4.2896942597 solRad3
                  Constrained by:
                      Constrains: None
                      Related to: None
print b['rpole@primary@mesh01@model']
Parameter: 0.0@rpole@primary@latest@model
                       Qualifier: rpole
                     Description: Polar radius of the stellar surface
                           Value: 1.0 solRad
                  Constrained by:
                      Constrains: None
                      Related to: None
print b['pot@primary@mesh01@model']
Parameter: 0.0@pot@primary@latest@model
                       Qualifier: pot
                     Description: Equipotential of the stellar surface
                           Value: 6.28266165375
                  Constrained by:
                      Constrains: None
                      Related to: None

Per-Element Parameters

print b['vertices@primary@mesh01@model']
Parameter: 0.0@vertices@primary@latest@model
                       Qualifier: vertices
                     Description: Vertices of triangles
                           Value: [[[  9.96605698e-17   9.96605698e-17  -1.62758062e+00]
  [ -1.69691766e-01   1.00564230e-16  -1.64233851e+00]
  [ -8.48394082e-02  -1.46919542e-01  -1.64241247e+00]]

 [[  9.96605698e-17   9.96605698e-17  -1.62758062e+00]
  [ -8.48394082e-02  -1.46919542e-01  -1.64241247e+00]
  [  8.48386387e-02  -1.46918191e-01  -1.64242131e+00]]

 [[  9.96605698e-17   9.96605698e-17  -1.62758062e+00]
  [  8.48386387e-02  -1.46918191e-01  -1.64242131e+00]
  [  1.69695243e-01   1.55068375e-16  -1.64231854e+00]]

 ...,
 [[ -1.90658044e-01   5.43806655e-01  -3.48619601e+00]
  [ -4.20131846e-01   4.46917903e-01  -3.45952871e+00]
  [ -3.98391925e-01   5.72932872e-01  -3.38436664e+00]]

 [[ -1.90658044e-01   5.43806655e-01  -3.48619601e+00]
  [ -2.92931913e-01   3.52497893e-01  -3.55803460e+00]
  [ -4.20131846e-01   4.46917903e-01  -3.45952871e+00]]

 [[ -2.92931913e-01   3.52497893e-01  -3.55803460e+00]
  [ -1.90658044e-01   5.43806655e-01  -3.48619601e+00]
  [ -1.64518034e-01   4.14435860e-01  -3.56269114e+00]]] solRad
                  Constrained by:
                      Constrains: None
                      Related to: None
print b['xs@primary@mesh01@model']
Parameter: 0.0@xs@primary@latest@model
                       Qualifier: xs
                     Description: X coordinate of center of triangles
                           Value: [ -8.50004623e-02   1.12478568e-16   8.50004623e-02 ...,
  -3.37822925e-01  -3.02651384e-01  -2.16490418e-01] solRad
                  Constrained by:
                      Constrains: None
                      Related to: None
print b['rs@primary@mesh01@model']
Parameter: 0.0@rs@primary@latest@model
                       Qualifier: rs
                     Description: Distance of each triangle from center of mass
                           Value: [ 0.19224183  0.19223212  0.19224183 ...,  0.19079693  0.19102911
  0.19113029] solRad
                  Constrained by:
                      Constrains: None
                      Related to: None
print b['r_projs@primary@mesh01@model']
Parameter: 0.0@r_projs@primary@latest@model
                       Qualifier: r_projs
                     Description: Projected distance (on plane of sky) of each triangle from center of mass
                           Value: [ 0.02127508  0.02127166  0.02127508 ...,  0.11829449  0.1032637
  0.09281007] solRad
                  Constrained by:
                      Constrains: None
                      Related to: None
print b['cosbetas@primary@mesh01@model']
Parameter: 0.0@cosbetas@primary@latest@model
                       Qualifier: cosbetas
                     Description:
                           Value: [] solRad
                  Constrained by:
                      Constrains: None
                      Related to: None
print b['normals@primary@mesh01@model']
Parameter: 0.0@normals@primary@latest@model
                       Qualifier: normals
                     Description: Normals of triangles
                           Value: [[ -8.65313333e-02  -5.04764494e-02   9.94969576e-01]
 [  5.26375024e-05  -1.00471791e-01   9.94939906e-01]
 [  8.64127714e-02  -5.06060762e-02   9.94973295e-01]
 ...,
 [ -3.13852914e-01   5.25724804e-01  -7.90638842e-01]
 [ -2.95162525e-01   4.70135508e-01  -8.31776225e-01]
 [ -2.50348668e-01   4.54783004e-01  -8.54691736e-01]]
                  Constrained by:
                      Constrains: None
                      Related to: None
print b['nxs@primary@mesh01@model']
Parameter: 0.0@nxs@primary@latest@model
                       Qualifier: nxs
                     Description: X component of normals
                           Value: [ -8.65313333e-02   5.26375024e-05   8.64127714e-02 ...,
  -3.13852914e-01  -2.95162525e-01  -2.50348668e-01]
                  Constrained by:
                      Constrains: None
                      Related to: None
print b['mus@primary@mesh01@model']
Parameter: 0.0@mus@primary@latest@model
                       Qualifier: mus
                     Description: Mu
                           Value: [ 0.99496958  0.99493991  0.9949733  ..., -0.79063884 -0.83177622
 -0.85469174]
                  Constrained by:
                      Constrains: None
                      Related to: None
print b['vxs@primary@mesh01@model']
Parameter: 0.0@vxs@primary@latest@model
                       Qualifier: vxs
                     Description: X velocity of center of triangles
                           Value: [-10.28836357 -10.28853699 -10.28834025 ..., -21.63529251
 -21.99902182 -22.21508469] solRad / d
                  Constrained by:
                      Constrains: None
                      Related to: None
print b['areas@primary@mesh01@model']
Parameter: 0.0@areas@primary@latest@model
                       Qualifier: areas
                     Description: Area of triangles
                           Value: [ 0.01252854  0.01252785  0.01252864 ...,  0.01695514  0.02043288
  0.01066587] solRad2
                  Constrained by:
                      Constrains: None
                      Related to: None
print b['loggs@primary@mesh01@model']
Parameter: 0.0@loggs@primary@latest@model
                       Qualifier: loggs
                     Description: Local surface gravity
                           Value: [ 4.40671951  4.40681138  4.40671951 ...,  4.42102299  4.41895477
  4.41807179]
                  Constrained by:
                      Constrains: None
                      Related to: None
print b['teffs@primary@mesh01@model']
Parameter: 0.0@teffs@primary@latest@model
                       Qualifier: teffs
                     Description: Local effective temperature
                           Value: [ 6027.23078251  6027.32923884  6027.23421699 ...,  5993.84913948
  5991.5661137   5990.59166869] K
                  Constrained by:
                      Constrains: None
                      Related to: None
print b['visibilities@primary@mesh01@model']
Parameter: 0.0@visibilities@primary@latest@model
                       Qualifier: visibilities
                     Description: Visiblity of triangles (1=visible, 0.5=partial, 0=hidden)
                           Value: [ 0.  0.  0. ...,  0.  0.  0.]
                  Constrained by:
                      Constrains: None
                      Related to: None

Plotting

By default, MESH datasets plot as ‘ys’ vx ‘xs’ (plane of sky) of just the surface elements, taken from the vertices vectors.

axs, artists = b['mesh@model'].plot()
../../_images/MESH_43_0.png

Any of the 1-D fields (ie not vertices or normals) or matplotlib-recognized colornames can be used to color either the faces or edges of the triangles. Passing none for edgecolor or facecolor turns off the coloring (you may want to set edgecolor=None if setting facecolor to disable the black outline).

axs, artists = b['mesh@model'].plot(facecolor='teffs', 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]:
../../_images/MESH_45_1.png

Alternatively, if you provide simple 1-D fields to plot, a 2D x-y plot will be created using the values from each element (always for a single time - if meshes exist for multiple times in the model, you must provide a single time either in the twig or as an argument to plot).

axs, artists = b['mesh@model'].plot(time=0.0, x='mus', y='teffs')
../../_images/MESH_47_0.png

The exception to needing to provide a time is for the per-time parameters mentioned above. For these, time can be the x-array (not very exciting in this case with only a single time).

For more examples see the following: - Passband Luminosity Tutorial

axs, artists = b['mesh@model'].plot(x='times', y='rpole', marker='s')
../../_images/MESH_49_0.png
Prev: ‘orb’ Datasets and Options Next: ‘lc’ Datasets and Options
.
Last update: 06/07/2017 11:30 a.m. (CET)