mirror of
https://github.com/cosinekitty/astronomy.git
synced 2026-05-19 14:27:52 -04:00
Significant performance boost to Python code: eliminate _ter2cel().
There were 3 calls to _ter2cel(), each of which redundantly called _sidereal_time, which results in 3 calculations of _e_tilt(). Reworked so there is only one call to _e_tilt(). Minor changes to support using cProfile, which is how I found this.
This commit is contained in:
@@ -693,10 +693,6 @@ def _spin(angle, pos1):
|
||||
pos1[2]
|
||||
]
|
||||
|
||||
def _ter2cel(time, vec1):
|
||||
gast = _sidereal_time(time)
|
||||
return _spin(-15.0 * gast, vec1)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# BEGIN CalcMoon
|
||||
|
||||
@@ -2024,9 +2020,10 @@ def Horizon(time, observer, ra, dec, refraction):
|
||||
une = [-sinlat*coslon, -sinlat*sinlon, coslat]
|
||||
uwe = [sinlon, -coslon, 0.0]
|
||||
|
||||
uz = _ter2cel(time, uze)
|
||||
un = _ter2cel(time, une)
|
||||
uw = _ter2cel(time, uwe)
|
||||
angle = -15.0 * _sidereal_time(time)
|
||||
uz = _spin(angle, uze)
|
||||
un = _spin(angle, une)
|
||||
uw = _spin(angle, uwe)
|
||||
|
||||
p = [cosdc*cosra, cosdc*sinra, sindc]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user