From ec6a82b133ff1b991551f3ac4b3b008725f984e7 Mon Sep 17 00:00:00 2001 From: Don Cross Date: Tue, 7 Jan 2020 11:57:54 -0500 Subject: [PATCH] Improved performance of Neptune apsis search. The apsis search for Neptune was sampling 1000 points in its first pass. It turns out 100 is enough. --- generate/template/astronomy.c | 2 +- generate/template/astronomy.cs | 2 +- generate/template/astronomy.py | 2 +- source/c/astronomy.c | 2 +- source/csharp/astronomy.cs | 2 +- source/python/astronomy.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/generate/template/astronomy.c b/generate/template/astronomy.c index b1e2a44a..03137286 100644 --- a/generate/template/astronomy.c +++ b/generate/template/astronomy.c @@ -4127,7 +4127,7 @@ static astro_apsis_t NeptuneExtreme(astro_apsis_kind_t kind, astro_time_t start_ static astro_apsis_t SearchNeptuneApsis(astro_time_t startTime) { - const int npoints = 1000; + const int npoints = 100; int i; astro_time_t t1, t2, time, t_min, t_max; double dist, max_dist, min_dist; diff --git a/generate/template/astronomy.cs b/generate/template/astronomy.cs index 91051e48..10eb25ec 100644 --- a/generate/template/astronomy.cs +++ b/generate/template/astronomy.cs @@ -3705,7 +3705,7 @@ $ASTRO_CSHARP_CHEBYSHEV(8); private static ApsisInfo SearchNeptuneApsis(AstroTime startTime) { - const int npoints = 1000; + const int npoints = 100; int i; var perihelion = new ApsisInfo(); var aphelion = new ApsisInfo(); diff --git a/generate/template/astronomy.py b/generate/template/astronomy.py index 57cba722..42184cd1 100644 --- a/generate/template/astronomy.py +++ b/generate/template/astronomy.py @@ -3273,7 +3273,7 @@ def _SearchNeptuneApsis(startTime): t1 = startTime.AddDays(_NEPTUNE_ORBITAL_PERIOD * ( -30 / 360)) t2 = startTime.AddDays(_NEPTUNE_ORBITAL_PERIOD * (+270 / 360)) t_min = t_max = t1 - npoints = 1000 + npoints = 100 interval = (t2.ut - t1.ut) / (npoints - 1) for i in range(npoints): diff --git a/source/c/astronomy.c b/source/c/astronomy.c index f342a8db..7fa52146 100644 --- a/source/c/astronomy.c +++ b/source/c/astronomy.c @@ -5418,7 +5418,7 @@ static astro_apsis_t NeptuneExtreme(astro_apsis_kind_t kind, astro_time_t start_ static astro_apsis_t SearchNeptuneApsis(astro_time_t startTime) { - const int npoints = 1000; + const int npoints = 100; int i; astro_time_t t1, t2, time, t_min, t_max; double dist, max_dist, min_dist; diff --git a/source/csharp/astronomy.cs b/source/csharp/astronomy.cs index ffd4278b..ff21025d 100644 --- a/source/csharp/astronomy.cs +++ b/source/csharp/astronomy.cs @@ -5001,7 +5001,7 @@ namespace CosineKitty private static ApsisInfo SearchNeptuneApsis(AstroTime startTime) { - const int npoints = 1000; + const int npoints = 100; int i; var perihelion = new ApsisInfo(); var aphelion = new ApsisInfo(); diff --git a/source/python/astronomy.py b/source/python/astronomy.py index 64422608..232e58ee 100644 --- a/source/python/astronomy.py +++ b/source/python/astronomy.py @@ -5383,7 +5383,7 @@ def _SearchNeptuneApsis(startTime): t1 = startTime.AddDays(_NEPTUNE_ORBITAL_PERIOD * ( -30 / 360)) t2 = startTime.AddDays(_NEPTUNE_ORBITAL_PERIOD * (+270 / 360)) t_min = t_max = t1 - npoints = 1000 + npoints = 100 interval = (t2.ut - t1.ut) / (npoints - 1) for i in range(npoints):