From a7002adf71c341108dc2d3094d21d65dd7b01808 Mon Sep 17 00:00:00 2001 From: Don Cross Date: Thu, 4 Jul 2019 20:00:39 -0400 Subject: [PATCH] Python: riseset test runs in 19.3 seconds: improved _CalcVsop(). --- generate/template/astronomy.py | 6 +++--- generate/template/old.py | 6 +++--- source/python/astronomy.py | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/generate/template/astronomy.py b/generate/template/astronomy.py index 0f50a1aa..03806843 100644 --- a/generate/template/astronomy.py +++ b/generate/template/astronomy.py @@ -300,7 +300,7 @@ _iaudata = ( class _iau2000b: def __init__(self, time): - t = time.tt / 36525 + t = time.tt / 36525.0 el = math.fmod((485868.249036 + t*1717915923.2178), _ASEC360) * _ASEC2RAD elp = math.fmod((1287104.79305 + t*129596581.0481), _ASEC360) * _ASEC2RAD f = math.fmod((335779.526232 + t*1739527262.8478), _ASEC360) * _ASEC2RAD @@ -1386,12 +1386,12 @@ _vsop = [ def _CalcVsop(model, time): spher = [] - t = time.tt / 365250 + t = time.tt / 365250.0 for formula in model: tpower = 1.0 coord = 0.0 for series in formula: - coord += tpower * sum(term[0] * math.cos(term[1] + (t * term[2])) for term in series) + coord += tpower * sum(A * math.cos(B + C*t) for (A, B, C) in series) tpower *= t spher.append(coord) diff --git a/generate/template/old.py b/generate/template/old.py index 78cae3f2..2b53f24f 100644 --- a/generate/template/old.py +++ b/generate/template/old.py @@ -300,7 +300,7 @@ _iaudata = ( class _iau2000b: def __init__(self, time): - t = time.tt / 36525 + t = time.tt / 36525.0 el = math.fmod((485868.249036 + t*1717915923.2178), _ASEC360) * _ASEC2RAD elp = math.fmod((1287104.79305 + t*129596581.0481), _ASEC360) * _ASEC2RAD f = math.fmod((335779.526232 + t*1739527262.8478), _ASEC360) * _ASEC2RAD @@ -804,12 +804,12 @@ _vsop = [ def _CalcVsop(model, time): spher = [] - t = time.tt / 365250 + t = time.tt / 365250.0 for formula in model: tpower = 1.0 coord = 0.0 for series in formula: - coord += tpower * sum(term[0] * math.cos(term[1] + (t * term[2])) for term in series) + coord += tpower * sum(A * math.cos(B + C*t) for (A, B, C) in series) tpower *= t spher.append(coord) diff --git a/source/python/astronomy.py b/source/python/astronomy.py index daedb329..50e21420 100644 --- a/source/python/astronomy.py +++ b/source/python/astronomy.py @@ -391,7 +391,7 @@ _iaudata = ( class _iau2000b: def __init__(self, time): - t = time.tt / 36525 + t = time.tt / 36525.0 el = math.fmod((485868.249036 + t*1717915923.2178), _ASEC360) * _ASEC2RAD elp = math.fmod((1287104.79305 + t*129596581.0481), _ASEC360) * _ASEC2RAD f = math.fmod((335779.526232 + t*1739527262.8478), _ASEC360) * _ASEC2RAD @@ -2077,12 +2077,12 @@ _vsop = [ def _CalcVsop(model, time): spher = [] - t = time.tt / 365250 + t = time.tt / 365250.0 for formula in model: tpower = 1.0 coord = 0.0 for series in formula: - coord += tpower * sum(term[0] * math.cos(term[1] + (t * term[2])) for term in series) + coord += tpower * sum(A * math.cos(B + C*t) for (A, B, C) in series) tpower *= t spher.append(coord)