From 0909aeeddd6a7a5d28b2a7be6fa96b0977a4eaf3 Mon Sep 17 00:00:00 2001 From: Don Cross Date: Thu, 4 Jul 2019 15:32:15 -0400 Subject: [PATCH] Python: small performance improvement in _iau2000b. --- generate/template/astronomy.py | 4 +--- generate/template/old.py | 4 +--- source/python/astronomy.py | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/generate/template/astronomy.py b/generate/template/astronomy.py index c98d5a2f..f36520bc 100644 --- a/generate/template/astronomy.py +++ b/generate/template/astronomy.py @@ -388,14 +388,12 @@ class _iau2000b: om = math.fmod((450160.398036 - t * 6962890.5431), _ASEC360) * _ASEC2RAD dp = 0 de = 0 - i = 76 - while i >= 0: + for i in range(77): arg = math.fmod((_nals_t[i][0]*el + _nals_t[i][1]*elp + _nals_t[i][2]*f + _nals_t[i][3]*d + _nals_t[i][4]*om), _PI2) sarg = math.sin(arg) carg = math.cos(arg) dp += (_cls_t[i][0] + _cls_t[i][1] * t)*sarg + _cls_t[i][2]*carg de += (_cls_t[i][3] + _cls_t[i][4] * t)*carg + _cls_t[i][5]*sarg - i -= 1 self.dpsi = -0.000135 + (dp * 1.0e-7) self.deps = +0.000388 + (de * 1.0e-7) diff --git a/generate/template/old.py b/generate/template/old.py index 35e80cee..39e83607 100644 --- a/generate/template/old.py +++ b/generate/template/old.py @@ -388,14 +388,12 @@ class _iau2000b: om = math.fmod((450160.398036 - t * 6962890.5431), _ASEC360) * _ASEC2RAD dp = 0 de = 0 - i = 76 - while i >= 0: + for i in range(77): arg = math.fmod((_nals_t[i][0]*el + _nals_t[i][1]*elp + _nals_t[i][2]*f + _nals_t[i][3]*d + _nals_t[i][4]*om), _PI2) sarg = math.sin(arg) carg = math.cos(arg) dp += (_cls_t[i][0] + _cls_t[i][1] * t)*sarg + _cls_t[i][2]*carg de += (_cls_t[i][3] + _cls_t[i][4] * t)*carg + _cls_t[i][5]*sarg - i -= 1 self.dpsi = -0.000135 + (dp * 1.0e-7) self.deps = +0.000388 + (de * 1.0e-7) diff --git a/source/python/astronomy.py b/source/python/astronomy.py index 08f87ef4..7668e3b0 100644 --- a/source/python/astronomy.py +++ b/source/python/astronomy.py @@ -479,14 +479,12 @@ class _iau2000b: om = math.fmod((450160.398036 - t * 6962890.5431), _ASEC360) * _ASEC2RAD dp = 0 de = 0 - i = 76 - while i >= 0: + for i in range(77): arg = math.fmod((_nals_t[i][0]*el + _nals_t[i][1]*elp + _nals_t[i][2]*f + _nals_t[i][3]*d + _nals_t[i][4]*om), _PI2) sarg = math.sin(arg) carg = math.cos(arg) dp += (_cls_t[i][0] + _cls_t[i][1] * t)*sarg + _cls_t[i][2]*carg de += (_cls_t[i][3] + _cls_t[i][4] * t)*carg + _cls_t[i][5]*sarg - i -= 1 self.dpsi = -0.000135 + (dp * 1.0e-7) self.deps = +0.000388 + (de * 1.0e-7)