Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions skyfield/earthlib.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Formulae for specific earth behaviors and effects."""

from numpy import (abs, arcsin, arccos, arctan2, array, clip, cos,
minimum, pi, sin, sqrt, tan, where, zeros_like)
minimum, pi, sin, sqrt, tan, where, zeros_like, dot)

from .constants import (AU_M, ANGVEL, DAY_S, DEG2RAD, ERAD,
IERS_2010_INVERSE_EARTH_FLATTENING, RAD2DEG, T0, tau)
Expand Down Expand Up @@ -91,7 +91,7 @@ def compute_limb_angle(position_au, observer_au):

# Compute zenith distance of observed object.

coszd = dots(position_au, observer_au) / (disobj * disobs)
coszd = dot(observer_au, position_au) / (disobj * disobs)
coszd = clip(coszd, -1.0, 1.0)
zdobj = arccos(coszd)

Expand Down
5 changes: 4 additions & 1 deletion skyfield/relativity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from numpy import abs, einsum, sqrt, where
from numpy import abs, einsum, sqrt, where, diagonal

from .constants import C, AU_M, C_AUDAY, GS
from .functions import _AVOID_DIVIDE_BY_ZERO, dots, length_of
Expand Down Expand Up @@ -110,6 +110,9 @@ def light_time_difference(position, observer_position):
# Light-time returned is the projection of vector 'pos_obs' onto the
# unit vector 'u1' (formed from 'pos1'), divided by the speed of light.

if observer_position.shape == (3,3):
observer_position = diagonal(observer_position)

diflt = einsum('a...,a...', u1, observer_position) / C_AUDAY
return diflt

Expand Down
10 changes: 7 additions & 3 deletions skyfield/vectorlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .constants import C_AUDAY
from .descriptorlib import reify
from .errors import DeprecationError
from .functions import length_of
from .functions import length_of, _reconcile
from .positionlib import build_position
from .timelib import Time

Expand Down Expand Up @@ -215,8 +215,10 @@ def _at(self, t):
p2, v2, _, message = vf._at(t)
if vf.center == 399:
gcrs_position = -p
p += p2
v += v2
p, p2 = _reconcile(p, p2)
p = p + p2
v, v2 = _reconcile(v, v2)
v = v + v2
if vfs[0].center == 0 and vf.center == 399:
gcrs_position = p2
return p, v, gcrs_position, message
Expand All @@ -241,6 +243,7 @@ def _correct_for_light_travel_time(observer, target):

tposition, tvelocity, gcrs_position, message = target._at(t)

tposition, cposition = _reconcile(tposition, cposition)
distance = length_of(tposition - cposition)
light_time0 = 0.0
for i in range(10):
Expand All @@ -259,6 +262,7 @@ def _correct_for_light_travel_time(observer, target):
light_time0 = light_time
else:
raise ValueError('light-travel time failed to converge')
tvelocity, cvelocity = _reconcile(tvelocity, cvelocity)
return tposition - cposition, tvelocity - cvelocity, t, light_time

def _jpl_name(target):
Expand Down