Advanced: Built-In Constraints

Setup

Let's first make sure we have the latest version of PHOEBE 2.2 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 [1]:
!pip install -I "phoebe>=2.2,<2.3"


Traceback (most recent call last):
  File "/home/kyle/.local/bin/pip", line 7, in <module>
    from pip import main
ImportError: cannot import name 'main' from 'pip' (/usr/lib/python3/dist-packages/pip/__init__.py)

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


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

Built-in Constraints

There are a number of built-in constraints that can be applied to our system. Those added by default are listed below as well as in the API docs for b.add_constraint:

asini

This constraint handles computing the projected semi-major axis along the line of sight and can be automatically inverted to solve for either 'asini', 'sma', or 'incl'.


In [3]:
b['asini@constraint']


Out[3]:
<ParameterSet: 3 parameters | kinds: star, orbit>

esinw, ecosw

These constraints handle computing the projected eccentricity which can be helpful in that they are better representations of the geometry of a light curve and result in symmetric posteriors for near-circular orbits.

Both can be inverted to also automatically solve for 'ecc' or 'per0'.


In [4]:
b['esinw@constraint']


Out[4]:
<ConstraintParameter: {esinw@binary@component} = {ecc@binary@component} * (sin({per0@binary@component})) (solar units) => 0.0>

In [5]:
b['ecosw@constraint']


Out[5]:
<ConstraintParameter: {ecosw@binary@component} = {ecc@binary@component} * (cos({per0@binary@component})) (solar units) => 0.0>

t0

This constraint handles converting between different t0 conventions - namely providing a reference time at periastron passage (t0_perpass) and at superior conjunction (t0_supconj).

Currently, this constraint only supports inverting to be solved for 't0_supconj' (ie you cannot automatically invert this constraint to constraint phshift or per0).


In [6]:
b['t0_perpass@constraint']


Out[6]:
<ConstraintParameter: {t0_perpass@binary@component} = t0_supconj_to_perpass({t0_supconj@binary@component}, {period@binary@component}, {ecc@binary@component}, {per0@binary@component}, {dpdt@binary@component}, {dperdt@binary@component}, {t0@system}) (solar units) => -0.25 d>

freq

This constraint handles the simple conversion to frequency from period - whether that be rotational or orbital - and does support inversion to solve for 'period'.


In [7]:
b['freq@constraint']


Out[7]:
<ParameterSet: 3 parameters | kinds: star, orbit>

In [8]:
b['freq@binary@constraint']


Out[8]:
<ConstraintParameter: {freq@binary@component} = 6.283185 / {period@binary@component} (solar units) => 6.283185 rad / d>

In [9]:
b['freq@primary@constraint']


Out[9]:
<ConstraintParameter: {freq@primary@component} = 6.283185 / {period@primary@component} (solar units) => 6.283185 rad / d>

mass

This constraint handles solving for the mass of a component by obeying Kepler's third law within the parent orbit.

It can be inverted to solve for 'sma' or 'period' (in addition to 'mass'), but not 'q'.


In [10]:
b['mass@constraint']


Out[10]:
<ParameterSet: 2 parameters | components: secondary, primary>

In [11]:
b['mass@primary@constraint']


Out[11]:
<ConstraintParameter: {mass@primary@component} = (39.478418 * ({sma@binary@component} ** 3.000000)) / ((({period@binary@component} ** 2.000000) * (1.000000 + {q@binary@component})) * 2942.206217504418873431859537959099) (solar units) => 0.9988131358058302 solMass>

component sma

This constraint handles computing the semi-major axis of a component about the center of mass of its parent orbit. Note that this is not the same as the semi-major axis of the parent orbit.

This currently can be inverted to solve for 'sma' of the parent orbit, but not 'q'.


In [12]:
b['sma@constraint']


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

In [13]:
b['sma@primary@constraint']


Out[13]:
<ConstraintParameter: {sma@primary@component} = {sma@binary@component} / (1.000000 + (1.000000 / {q@binary@component})) (solar units) => 2.65 solRad>

component asini

This constraint handles computing the projected semi-major axis of a component about the center of mass of its parent orbit. Note that this is not the same as the asini of the parent orbit.

This currently can be inverted to solve for 'sma' of the parent orbit, but not 'q' or 'incl'.


In [14]:
b['asini@component']


Out[14]:
<ParameterSet: 3 parameters | kinds: star, orbit>

In [15]:
b['asini@primary@constraint']


Out[15]:
<ConstraintParameter: {asini@primary@component} = ({sma@binary@component} * (sin({incl@binary@component}))) / (1.000000 + (1.000000 / {q@binary@component})) (solar units) => 2.65 solRad>

requiv_max

This constraint handles solving for the maxium equivalent radius (for a detached system).


In [16]:
b['requiv_max@constraint']


Out[16]:
<ParameterSet: 2 parameters | components: secondary, primary>

In [17]:
b['requiv_max@primary@constraint']


Out[17]:
<ConstraintParameter: {requiv_max@primary@component} = requiv_L1({q@binary@component}, {syncpar@primary@component}, {ecc@binary@component}, {sma@binary@component}, {incl@primary@component}, {long_an@primary@component}, {incl@binary@component}, {long_an@binary@component}, 1) (solar units) => 2.013275176537638 solRad>

rotation period

This constraint handles computing the rotation period of a star given its synchronicity parameter (syncpar).

It can be inverted to solve for any of the three parameters 'period' (both rotational and orbital) and 'syncpar'.


In [18]:
b['period@constraint']


Out[18]:
<ParameterSet: 2 parameters | components: secondary, primary>

In [19]:
b['period@primary@constraint']


Out[19]:
<ConstraintParameter: {period@primary@component} = {period@binary@component} / {syncpar@primary@component} (solar units) => 1.0 d>

pitch/yaw (incl/long_an)

pitch constrains the relation between the orbital and rotational inclination whereas yaw constrains the relation between the orbital and rotational long_an. When pitch and yaw are set to 0, the system is aligned.


In [20]:
b['incl@constraint']


Out[20]:
<ParameterSet: 2 parameters | components: secondary, primary>

In [21]:
b['incl@primary@constraint']


Out[21]:
<ConstraintParameter: {incl@primary@component} = {incl@binary@component} + {pitch@primary@component} (solar units) => 90.0 deg>

In [22]:
b['long_an@constraint']


Out[22]:
<ParameterSet: 2 parameters | components: secondary, primary>

In [23]:
b['long_an@primary@constraint']


Out[23]:
<ConstraintParameter: {long_an@primary@component} = {long_an@binary@component} + {yaw@primary@component} (solar units) => 0.0 deg>

Next

Next up: let's add a dataset to our Bundle.


In [ ]: