# Distance¶

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


## Relevant Parameters¶

The ‘distance’ parameter lives in the ‘system’ context and is simply the distance between the center of the coordinate system and the observer (at t0)

print b.get_parameter(qualifier='distance', context='system')

Parameter: distance@system
Qualifier: distance
Description: Distance to the system
Value: 1.0 m
Constrained by:
Constrains: None
Related to: None

print b.get_parameter(qualifier='t0', context='system')

Parameter: t0@system
Qualifier: t0
Description: Time at which all values are provided
Value: 0.0 d
Constrained by:
Constrains: mean_anom@binary@component
Related to: t0_perpass@binary@component, period@binary@component, mean_anom@binary@component


## Influence on Orbits (Positions)¶

The distance has absolutely NO effect on the synthetic orbit as the origin of the orbit’s coordinate system is such that the barycenter of the system is at 0,0,0 at t0.

To demonstrate this, let’s create an ‘orb’ dataset and compute models at both 10 and 20 pc and then plot the resulting synthetic models.

b.add_dataset('orb', times=np.linspace(0,3,101), dataset='orb01')

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

b.set_value('distance', 10.0)

b.run_compute(model='dist10')

<ParameterSet: 14 parameters | components: primary, secondary>

b.set_value('distance', 20.0)

b.run_compute(model='dist20')

<ParameterSet: 14 parameters | components: primary, secondary>

fig = plt.figure()

axs, artists = b['orb01'].plot(model='dist10', ax=ax1)
axs, artists = b['orb01'].plot(model='dist20', ax=ax2)


## Influence on Light Curves (Fluxes)¶

Fluxes are, however, affected by distance exactly as you’d expect as inverse of distance squared.

To illustrate this, let’s add an ‘lc’ dataset and compute synthetic fluxes at 10 and 20 pc.

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

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


To make things easier to compare, let’s disable limb darkening

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

b.set_value('distance', 10.0)

b.run_compute(model='dist10')

Fri, 10 Feb 2017 16:37 BUNDLE       WARNING overwriting model: dist10

<ParameterSet: 16 parameters | kinds: orb, lc>

b.set_value('distance', 20.0)

b.run_compute(model='dist20')

Fri, 10 Feb 2017 16:38 BUNDLE       WARNING overwriting model: dist20

<ParameterSet: 16 parameters | kinds: orb, lc>


Since we doubled the distance from 10 to 20 pc, we expect the entire light curve at 20 pc to be divided by 4 (note the y-scales on the plots below).

fig = plt.figure()

axs, artists = b['lc01'].plot(model='dist10', ax=ax1)
axs, artists = b['lc01'].plot(model='dist20', ax=ax2)


Note that ‘pblum’ is defined such that a (spherical, non-eclipsed, non-limb darkened) star with a pblum of 4pi will contribute a flux of 1.0 at 10 pc (the default distance).

## Influence on Meshes (Intensities)¶

Distance does not affect the intensities stored in the mesh (including those in relative units). In other words, like third light, distance only scales the fluxes.

NOTE: this is different than pblums which DO affect the relative intensities. Again, see the pblum tutorial for more details.

To see this we can run both of our distances again and look at the values of the intensities in the mesh.

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

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

b.set_value('distance', 10)

b.run_compute(model='dist10')

Fri, 10 Feb 2017 16:39 BUNDLE       WARNING overwriting model: dist10

<ParameterSet: 90 parameters | kinds: mesh, orb, lc>

b.set_value('distance', 20)

b.run_compute(model='dist20')

Fri, 10 Feb 2017 16:40 BUNDLE       WARNING overwriting model: dist20

<ParameterSet: 90 parameters | kinds: mesh, orb, lc>

print "dist10 abs_intensities: ", b.get_value(qualifier='abs_intensities', component='primary', dataset='lc01', model='dist10').mean()
print "dist20 abs_intensities: ", b.get_value(qualifier='abs_intensities', component='primary', dataset='lc01', model='dist20').mean()

dist10 abs_intensities:  8.45989446288e+13
dist20 abs_intensities:  8.45989446288e+13

print "dist10 intensities: ", b.get_value(qualifier='intensities', component='primary', dataset='lc01', model='dist10').mean()
print "dist20 intensities: ", b.get_value(qualifier='intensities', component='primary', dataset='lc01', model='dist20').mean()

dist10 intensities:  6.51332461261e-19
dist20 intensities:  6.51332461261e-19

Prev: “Third” Light Next: Limb Darkening
.
Last update: 06/07/2017 11:30 a.m. (CET)