# Path: skyfield/constants.py
# C = 299792458.0                            # m/s
# 
# AU_M = 149597870700             # per IAU 2012 Resolution B2
# 
# C_AUDAY = C * DAY_S / AU_M
# 
# GS = 1.32712440017987e+20
# 
# Path: skyfield/functions.py
# _AVOID_DIVIDE_BY_ZERO = finfo(float64).tiny
# 
# def dots(v, u):
#     """Given one or more vectors in `v` and `u`, return their dot products.
# 
#     This works whether `v` and `u` each have the shape ``(3,)``, or
#     whether they are each whole arrays of corresponding x, y, and z
#     coordinates and have shape ``(3, N)``.
# 
#     """
#     return (v * u).sum(axis=0)
# 
# def length_of(xyz):
#     """Given a 3-element array |xyz|, return its length.
# 
#     The three elements can be simple scalars, or the array can be two
#     dimensions and offer three whole series of x, y, and z coordinates.
# 
#     """
#     return sqrt((xyz * xyz).sum(axis=0))


from numpy import abs, einsum, sqrt, where
from .constants import C, AU_M, C_AUDAY, GS
from .functions import _AVOID_DIVIDE_BY_ZERO, dots, length_of
        rmass = rmasses[name]
        _add_deflection(position, observer, bposition, rmass)

    # If observer is not at geocenter, add in deflection due to Earth.

    if include_earth_deflection.any():
        deflector = ephemeris['earth']
        bposition = deflector.at(ts.tdb(jd=tclose)).position.au  # TODO
        rmass = rmasses['earth']
        # TODO: Make the following code less messy, maybe by having
        # _add_deflection() return a new vector instead of modifying the
        # old one in-place.
        deflected_position = position.copy()
        _add_deflection(deflected_position, observer, bposition, rmass)
        if include_earth_deflection.shape:
            position[:,include_earth_deflection] = (
                deflected_position[:,include_earth_deflection])
        else:
            position[:] = deflected_position[:]

def light_time_difference(position, observer_position):
    """Returns the difference in light-time, for a star,
      between the barycenter of the solar system and the observer (or
      the geocenter).

    """
    # From 'pos1', form unit vector 'u1' in direction of star or light
    # source.

    dis = length_of(position)

# Path: skyfield/constants.py
# C = 299792458.0                            # m/s
# 
# AU_M = 149597870700             # per IAU 2012 Resolution B2
# 
# C_AUDAY = C * DAY_S / AU_M
# 
# GS = 1.32712440017987e+20
# 
# Path: skyfield/functions.py
# _AVOID_DIVIDE_BY_ZERO = finfo(float64).tiny
# 
# def dots(v, u):
#     """Given one or more vectors in `v` and `u`, return their dot products.
# 
#     This works whether `v` and `u` each have the shape ``(3,)``, or
#     whether they are each whole arrays of corresponding x, y, and z
#     coordinates and have shape ``(3, N)``.
# 
#     """
#     return (v * u).sum(axis=0)
# 
# def length_of(xyz):
#     """Given a 3-element array |xyz|, return its length.
# 
#     The three elements can be simple scalars, or the array can be two
#     dimensions and offer three whole series of x, y, and z coordinates.
# 
#     """
#     return sqrt((xyz * xyz).sum(axis=0))


# Path: skyfield/relativity.py
from numpy import abs, einsum, sqrt, where
from .constants import C, AU_M, C_AUDAY, GS
from .functions import _AVOID_DIVIDE_BY_ZERO, dots, length_of

        rmass = rmasses[name]
        _add_deflection(position, observer, bposition, rmass)

    # If observer is not at geocenter, add in deflection due to Earth.

    if include_earth_deflection.any():
        deflector = ephemeris['earth']
        bposition = deflector.at(ts.tdb(jd=tclose)).position.au  # TODO
        rmass = rmasses['earth']
        # TODO: Make the following code less messy, maybe by having
        # _add_deflection() return a new vector instead of modifying the
        # old one in-place.
        deflected_position = position.copy()
        _add_deflection(deflected_position, observer, bposition, rmass)
        if include_earth_deflection.shape:
            position[:,include_earth_deflection] = (
                deflected_position[:,include_earth_deflection])
        else:
            position[:] = deflected_position[:]

def light_time_difference(position, observer_position):
    """Returns the difference in light-time, for a star,
      between the barycenter of the solar system and the observer (or
      the geocenter).

    """
    # From 'pos1', form unit vector 'u1' in direction of star or light
    # source.

    dis = length_of(position)

    u1 = position / (dis + _AVOID_DIVIDE_BY_ZERO)