mirror of
https://github.com/cosinekitty/astronomy.git
synced 2026-05-19 14:27:52 -04:00
Improved term sorting by adjusting "millennia" value.
I realized that I still was telling the code to assume the time coordinate never gets more than 0.2 millennia away from J2000. But in fact, it is getting 0.5 millennia away. Fixed that, and immediately found a smaller model that works. OptimizeTop: 255 terms [ 41 62 71 68 9 4]
This commit is contained in:
@@ -76,7 +76,7 @@ static int PrintUsage(void);
|
||||
static int GenerateVsopPlanets(void);
|
||||
static int GenerateChebPluto(void);
|
||||
static int GenerateTop(const char *name, const char *outFileName);
|
||||
#define GenerateTopPluto() GenerateTop("Pluto", "output/8.top")
|
||||
static int TopNudge(const char *name, const char *inFileName, const char *outFileName);
|
||||
static int GenerateApsisTestData(void);
|
||||
static int GenerateSource(void);
|
||||
static int TestVsopModel(vsop_model_t *model, int body, double threshold, double *max_arcmin, int *trunc_terms);
|
||||
@@ -154,6 +154,9 @@ int main(int argc, const char *argv[])
|
||||
if (argc == 4 && !strcmp(argv[1], "top"))
|
||||
return GenerateTop(argv[2], argv[3]);
|
||||
|
||||
if (argc == 5 && !strcmp(argv[1], "topnudge"))
|
||||
return TopNudge(argv[2], argv[3], argv[4]);
|
||||
|
||||
if (argc == 2 && !strcmp(argv[1], "apsis"))
|
||||
return GenerateApsisTestData();
|
||||
|
||||
@@ -210,6 +213,12 @@ static int PrintUsage(void)
|
||||
" Use TOP2013 to generate an optimized model for the specified outer planet.\n"
|
||||
" The 'planet' must be one of: Jupiter, Saturn, Uranus, Neptune, Pluto.\n"
|
||||
"\n"
|
||||
"generate topnudge planet infile outfile\n"
|
||||
" Load TOP2013 model from infile.\n"
|
||||
" Use a guided random walk to try to improve it.\n"
|
||||
" If a smaller model with acceptable accuracy is found,\n"
|
||||
" it is written to outfile.\n"
|
||||
"\n"
|
||||
);
|
||||
|
||||
return 1;
|
||||
@@ -1845,6 +1854,7 @@ fail:
|
||||
/*-----------------------------------------------------------------------------------------*/
|
||||
|
||||
static const char *TopDataFileName = "TOP2013.dat";
|
||||
static const double TopMillenniaAroundJ2000 = 0.5; /* optimize for calculations within 500 years of J2000. */
|
||||
|
||||
static int CalcTop2013(FILE *outfile, const top_model_t *model)
|
||||
{
|
||||
@@ -2163,7 +2173,6 @@ static int OptimizeTop(top_model_t *shrunk, const top_model_t *model)
|
||||
top_model_t attempt;
|
||||
top_random_buffer_t buffer;
|
||||
top_direction_t dir;
|
||||
const double millennia = 0.2; /* optimize for calculations within 200 years of J2000. */
|
||||
int i, f, term_count, best_term_count = -1;
|
||||
int success;
|
||||
|
||||
@@ -2173,7 +2182,7 @@ static int OptimizeTop(top_model_t *shrunk, const top_model_t *model)
|
||||
TopInitRandomBuffer(&buffer);
|
||||
|
||||
/* Make a map of the relative importance of the terms within each of the 6 formulas. */
|
||||
CHECK(TopMakeContribMap(&map, model, millennia));
|
||||
CHECK(TopMakeContribMap(&map, model, TopMillenniaAroundJ2000));
|
||||
CHECK(PrintContribMap(&map, "output/contrib.map"));
|
||||
|
||||
CHECK(TopCloneModel(&attempt, model));
|
||||
@@ -2247,6 +2256,54 @@ fail:
|
||||
}
|
||||
|
||||
|
||||
static int TopNudge(const char *name, const char *inFileName, const char *outFileName)
|
||||
{
|
||||
int error = 1;
|
||||
vsop_body_t body;
|
||||
int planet;
|
||||
top_model_t model;
|
||||
top_model_t smaller;
|
||||
int f;
|
||||
int skip[TOP_NCOORDS];
|
||||
top_contrib_map_t map;
|
||||
|
||||
TopInitModel(&model);
|
||||
TopInitModel(&smaller);
|
||||
TopInitContribMap(&map);
|
||||
|
||||
body = LookupBody(name);
|
||||
if (body < 0)
|
||||
FAIL("TopNudge: planet name '%s' is not valid.\n", name);
|
||||
|
||||
if (body < BODY_JUPITER || body > BODY_PLUTO)
|
||||
FAIL("TopNudge: TOP2013 supports Jupiter through Pluto only.\n");
|
||||
|
||||
planet = body + 1; /* convert our body ID into TOP2013 planet ID */
|
||||
|
||||
/* Load the input file just to get its skip list. */
|
||||
CHECK(TopLoadModel(&model, inFileName, planet));
|
||||
for (f=0; f<TOP_NCOORDS; ++f)
|
||||
skip[f] = TopTermCountF(&model, f);
|
||||
|
||||
/* Load the full-blown planet model. */
|
||||
TopFreeModel(&model);
|
||||
CHECK(TopLoadModel(&model, TopDataFileName, planet));
|
||||
CHECK(TopCloneModel(&smaller, &model));
|
||||
|
||||
/* Generate the contribution map so we can sort the full model, but with no terms skipped. */
|
||||
CHECK(TopMakeContribMap(&map, &model, TopMillenniaAroundJ2000));
|
||||
CHECK(TopSquash(&smaller, &model, &map));
|
||||
|
||||
(void)skip; /* FIXFIXFIX - use as a starting point */
|
||||
|
||||
error = 0;
|
||||
fail:
|
||||
TopFreeModel(&model);
|
||||
TopFreeContribMap(&map);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static int ValidateRandom(void)
|
||||
{
|
||||
const int ntrials = 1000000;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
TOP2013ELL PLANET 9 VARIABLE 1 T**00 27 term(s)
|
||||
TOP2013ELL PLANET 9 VARIABLE 1 T**00 26 term(s)
|
||||
0 0.3954461714403000 +02 0.0000000000000000 +00
|
||||
1402 -0.1889137353343409 +00 -0.8525819763547007 -01 12.464911
|
||||
1331 -0.4149587783381234 -01 -0.3338741527488626 -01 13.129832
|
||||
@@ -25,8 +25,7 @@
|
||||
310 -0.6965037015815398 -03 -0.1002466776236420 -02 56.373567
|
||||
1044 -0.3280177145465059 -03 -0.6494714015539712 -03 16.739278
|
||||
63 0.4042476707515829 -03 0.5731588635532511 -03 277.393743
|
||||
1614 -0.1323844849858705 -03 0.6794949222936907 -03 10.827637
|
||||
TOP2013ELL PLANET 9 VARIABLE 1 T**01 7 term(s)
|
||||
TOP2013ELL PLANET 9 VARIABLE 1 T**01 12 term(s)
|
||||
1402 -0.2454100771085402 -01 0.5382252967565117 -01 12.464911
|
||||
0 0.3789000000000000 -01 0.0000000000000000 +00
|
||||
1331 -0.1598173392936494 -01 0.1962357176525557 -01 13.129832
|
||||
@@ -34,7 +33,16 @@
|
||||
71 0.8672302004362156 -03 0.4724196709450942 -02 246.138110
|
||||
1261 -0.3800880445379082 -02 0.2739278026727122 -02 13.858688
|
||||
2875 -0.5901544125976962 -03 0.3319079220271196 -02 6.078541
|
||||
TOP2013ELL PLANET 9 VARIABLE 2 T**00 42 term(s)
|
||||
35 -0.2064684471297055 -02 -0.2622174677603653 -02 499.308737
|
||||
4 -0.2734117707072450 -02 0.8471165519668854 -03 4368.951450
|
||||
1190 -0.2142736137110234 -02 0.8382984417871771 -03 14.685551
|
||||
452 -0.6519145744242542 -03 0.1396247790982541 -02 38.663287
|
||||
8 -0.1417435326639005 -02 -0.4880060952606280 -03 2184.475725
|
||||
TOP2013ELL PLANET 9 VARIABLE 1 T**02 3 term(s)
|
||||
1402 0.6156473418398688 -02 0.6972754439870635 -02 12.464911
|
||||
1331 0.3447371868699193 -02 0.5354745816274889 -02 13.129832
|
||||
0 -0.6019905974440888 -02 0.0000000000000000 +00
|
||||
TOP2013ELL PLANET 9 VARIABLE 2 T**00 40 term(s)
|
||||
0 0.4165471124826000 +01 0.0000000000000000 +00
|
||||
1402 0.2061051693497233 -02 -0.4567216393743373 -02 12.464911
|
||||
4 0.3490137065917968 -02 0.2221493128020853 -02 4368.951450
|
||||
@@ -75,9 +83,7 @@
|
||||
17476 0.8815915048773696 -05 0.5936451205977327 -05 0.999989
|
||||
27 0.6298093594524397 -05 -0.8447279783901072 -05 647.252067
|
||||
1406 0.5773413950969362 -05 0.8724871204890315 -05 12.429449
|
||||
1398 0.1011598967836114 -04 -0.1322047339457209 -05 12.500576
|
||||
28407 0.6764202236220502 -05 -0.7521064976578262 -05 0.615194
|
||||
TOP2013ELL PLANET 9 VARIABLE 2 T**01 10 term(s)
|
||||
TOP2013ELL PLANET 9 VARIABLE 2 T**01 14 term(s)
|
||||
0 0.2533566020437000 +02 0.0000000000000000 +00
|
||||
4 -0.2189791682444253 -03 0.1774195586429015 -02 4368.951450
|
||||
1402 -0.1302952706727716 -02 -0.5898717141021054 -03 12.464911
|
||||
@@ -88,14 +94,21 @@
|
||||
1473 0.1371667233382944 -03 0.2760516544377532 -04 11.864091
|
||||
12 -0.1142698557098498 -03 0.1706262137628792 -04 1456.317150
|
||||
2875 -0.8265424046422934 -04 -0.1423043268450788 -04 6.078541
|
||||
TOP2013ELL PLANET 9 VARIABLE 2 T**02 4 term(s)
|
||||
2945 0.3608437065425580 -04 -0.3828660356462898 -05 5.934060
|
||||
593 0.3105055544706282 -04 -0.2312048818525279 -05 29.470162
|
||||
16 -0.8724544655003219 -05 -0.2270329998007695 -04 1092.237862
|
||||
137 0.5578326124078644 -05 -0.2064271821605269 -04 127.560626
|
||||
TOP2013ELL PLANET 9 VARIABLE 2 T**02 7 term(s)
|
||||
0 -0.1827221883916392 -01 0.0000000000000000 +00
|
||||
4 -0.4238220551453537 -03 0.6095122513962722 -04 4368.951450
|
||||
8 -0.2421495016152030 -03 0.1355549886699970 -03 2184.475725
|
||||
1402 -0.1673195354235499 -03 0.1487759036099257 -03 12.464911
|
||||
12 -0.4051458090246665 -04 -0.4685942995362513 -04 1456.317150
|
||||
1331 -0.4425547936399682 -04 0.2852396629063726 -04 13.129832
|
||||
522 -0.2662616379120394 -04 0.4041450696427345 -04 33.478555
|
||||
TOP2013ELL PLANET 9 VARIABLE 2 T**03 1 term(s)
|
||||
0 0.1940993166707158 -02 0.0000000000000000 +00
|
||||
TOP2013ELL PLANET 9 VARIABLE 3 T**00 56 term(s)
|
||||
TOP2013ELL PLANET 9 VARIABLE 3 T**00 46 term(s)
|
||||
0 -0.1787389594035000 +00 0.0000000000000000 +00
|
||||
1473 0.3162983274999299 -02 -0.2098587029494208 -02 11.864091
|
||||
71 -0.6818035766386040 -03 0.1111351916394093 -02 246.138110
|
||||
@@ -142,17 +155,7 @@
|
||||
2663 -0.7410942638085205 -06 0.8132048544977743 -05 6.562451
|
||||
17334 0.7706278210510440 -05 0.2183299167772723 -05 1.008181
|
||||
3016 -0.2709705430592372 -05 0.7298515262209896 -05 5.794365
|
||||
28266 0.3097830556247420 -05 -0.6952347832939826 -05 0.618262
|
||||
75 -0.7500596370591682 -05 0.5855255890789848 -06 233.010744
|
||||
354 0.2276715038571029 -05 0.7131039074279036 -05 49.366683
|
||||
974 -0.2881407449259578 -05 0.6773917542579730 -05 17.942306
|
||||
59 -0.4825549044720141 -05 -0.5363385802530331 -05 296.200098
|
||||
1115 0.2416536383392725 -05 -0.5976026061524919 -05 15.673368
|
||||
204 -0.1542046079703371 -06 -0.6364533072057864 -05 85.665715
|
||||
612 0.4779120406468644 -05 -0.4198918039977566 -05 28.555238
|
||||
574 -0.3253361974038308 -05 0.4894203683974946 -05 30.445655
|
||||
978 -0.5281616197054730 -05 0.2419431853588488 -05 17.868922
|
||||
TOP2013ELL PLANET 9 VARIABLE 3 T**01 16 term(s)
|
||||
TOP2013ELL PLANET 9 VARIABLE 3 T**01 22 term(s)
|
||||
0 -0.6133966380200786 -03 0.0000000000000000 +00
|
||||
1331 0.5666411017231389 -03 -0.8113312870171329 -04 13.129832
|
||||
1473 -0.1963280565417159 -03 -0.2984312084406936 -03 11.864091
|
||||
@@ -169,7 +172,17 @@
|
||||
452 0.3228669845401362 -04 -0.1433002805485971 -04 38.663287
|
||||
522 -0.3361063955659441 -04 0.1073256076484215 -04 33.478555
|
||||
2804 0.2689272796253257 -04 -0.1220208815904484 -04 6.232456
|
||||
TOP2013ELL PLANET 9 VARIABLE 4 T**00 70 term(s)
|
||||
4 0.1614536268268973 -04 -0.2153518064498246 -04 4368.951450
|
||||
35 0.1161984230129218 -04 0.2125979378246284 -04 499.308737
|
||||
310 0.2115941977293071 -04 0.3236538778093821 -05 56.373567
|
||||
212 -0.1738388183799300 -04 -0.1257013997887220 -06 82.433046
|
||||
2733 0.1585754642143561 -04 -0.2623245517398515 -05 6.394367
|
||||
1048 0.9837272297056228 -05 0.1218270103280705 -04 16.675387
|
||||
TOP2013ELL PLANET 9 VARIABLE 3 T**02 3 term(s)
|
||||
1331 0.2382065795687565 -04 -0.1411721704658303 -03 13.129832
|
||||
0 0.5716978431762315 -04 0.0000000000000000 +00
|
||||
1261 0.2858465884370473 -04 -0.1915312545581913 -04 13.858688
|
||||
TOP2013ELL PLANET 9 VARIABLE 4 T**00 45 term(s)
|
||||
0 -0.1734047186423000 +00 0.0000000000000000 +00
|
||||
1473 0.2123481311507617 -02 0.3013005862133503 -02 11.864091
|
||||
71 -0.1050549920035943 -02 -0.7084964915268143 -03 246.138110
|
||||
@@ -215,32 +228,7 @@
|
||||
354 -0.7710586578144641 -05 0.3519573585252646 -05 49.366683
|
||||
2663 0.8082359996206402 -05 0.8828933663969252 -06 6.562451
|
||||
75 -0.6108985432048268 -06 -0.8028447343434377 -05 233.010744
|
||||
17334 0.2466641329248979 -05 -0.7610526582061735 -05 1.008181
|
||||
974 0.6913074692775818 -05 0.3504858508933466 -05 17.942306
|
||||
28266 -0.6823579337018703 -05 -0.3348779058502134 -05 0.618262
|
||||
3016 -0.7042759320686036 -05 -0.2658068257652617 -05 5.794365
|
||||
59 -0.5545649416414357 -05 0.4966728382855613 -05 296.200098
|
||||
204 -0.7001772237817845 -05 -0.1681775103354698 -05 85.665715
|
||||
1115 -0.6402493718491447 -05 0.2119231523126814 -05 15.673368
|
||||
978 0.2362358567558538 -05 0.5326053743213388 -05 17.868922
|
||||
129 -0.3986729707936610 -05 0.4234127628797913 -05 135.471363
|
||||
574 -0.4831404392915933 -05 -0.2954497225256050 -05 30.445655
|
||||
612 0.4066388367188649 -05 0.3845243990770431 -05 28.555238
|
||||
200 -0.3278299055468547 -05 0.4374639730398968 -05 87.379029
|
||||
247 0.4408608844407510 -05 -0.3026244932285862 -05 70.752250
|
||||
1685 0.2766556150711349 -05 -0.4461646662808200 -05 10.371398
|
||||
1335 -0.2313438282668064 -05 0.4501391405222888 -05 13.090491
|
||||
1327 0.3117543310307627 -05 0.3792486054929398 -05 13.169409
|
||||
903 0.4474199473030350 -05 0.1782208002282115 -05 19.353052
|
||||
16 -0.1492734290131038 -05 0.4488408682560287 -05 1092.237862
|
||||
169 0.2535401883591162 -05 0.3573000080078947 -05 103.407135
|
||||
271 -0.2168862924203394 -05 0.3782083294512028 -05 64.486368
|
||||
79 0.3897905589463116 -05 -0.1892340750283523 -05 221.212732
|
||||
416 0.3937643876186717 -05 -0.5253870390484772 -06 42.009149
|
||||
17405 0.1090434406513635 -05 0.3540919507813321 -05 1.004068
|
||||
28337 0.3473671828765680 -05 -0.5240768249712062 -06 0.616713
|
||||
1351 -0.3443646857700650 -05 -0.7414098620880182 -07 12.935460
|
||||
TOP2013ELL PLANET 9 VARIABLE 4 T**01 19 term(s)
|
||||
TOP2013ELL PLANET 9 VARIABLE 4 T**01 20 term(s)
|
||||
1331 -0.6004417493269489 -04 -0.5684181411506680 -03 13.129832
|
||||
1473 0.2829900111132881 -03 -0.1989968311793417 -03 11.864091
|
||||
71 0.1310984789234690 -03 -0.1964554702960790 -03 246.138110
|
||||
@@ -260,9 +248,12 @@
|
||||
2804 -0.1150814913266628 -04 -0.2731679037159991 -04 6.232456
|
||||
310 0.3473835060815114 -05 -0.2101743798218038 -04 56.373567
|
||||
212 0.2140271628313424 -05 -0.1917826209337807 -04 82.433046
|
||||
TOP2013ELL PLANET 9 VARIABLE 4 T**02 1 term(s)
|
||||
2733 -0.2328376204205020 -05 -0.1588221639927811 -04 6.394367
|
||||
TOP2013ELL PLANET 9 VARIABLE 4 T**02 3 term(s)
|
||||
1331 -0.1399390080560118 -03 -0.2900687987918155 -04 13.129832
|
||||
TOP2013ELL PLANET 9 VARIABLE 5 T**00 8 term(s)
|
||||
0 0.6782978361158024 -04 0.0000000000000000 +00
|
||||
1261 -0.1861244546671113 -04 -0.2890887776673765 -04 13.858688
|
||||
TOP2013ELL PLANET 9 VARIABLE 5 T**00 7 term(s)
|
||||
0 -0.5170230782278000 -01 0.0000000000000000 +00
|
||||
1402 -0.1329678715738528 -03 0.1352378409982340 -03 12.464911
|
||||
1543 0.1630089964035264 -03 0.5592775542183944 -04 11.325862
|
||||
@@ -270,13 +261,11 @@
|
||||
522 -0.1909739097695710 -04 0.3660766666142337 -04 33.478555
|
||||
664 0.3254356482927627 -04 0.1067233939701916 -05 26.318985
|
||||
1331 -0.2084181851417015 -04 0.1241022314474010 -04 13.129832
|
||||
4 -0.8035607342983063 -05 0.1985775225385697 -04 4368.951450
|
||||
TOP2013ELL PLANET 9 VARIABLE 5 T**01 1 term(s)
|
||||
TOP2013ELL PLANET 9 VARIABLE 5 T**01 2 term(s)
|
||||
0 0.1916684404718321 -03 0.0000000000000000 +00
|
||||
TOP2013ELL PLANET 9 VARIABLE 6 T**00 6 term(s)
|
||||
1402 0.3901970138776549 -04 0.3867137881292379 -04 12.464911
|
||||
TOP2013ELL PLANET 9 VARIABLE 6 T**00 4 term(s)
|
||||
0 0.1397799251564000 +00 0.0000000000000000 +00
|
||||
1402 0.1288320057237236 -03 0.1347115643369476 -03 12.464911
|
||||
1543 -0.4997931009887912 -04 0.1618089604229282 -03 11.325862
|
||||
1473 -0.2206069119526947 -04 -0.9366836084367773 -04 11.864091
|
||||
522 0.3553759549391650 -04 0.1979739061374527 -04 33.478555
|
||||
664 -0.7470904286227902 -07 0.3198328022155028 -04 26.318985
|
||||
|
||||
Reference in New Issue
Block a user