The newer version of cppcheck reported that I was assigning
a value to a variable that was never used before another
assignment occurred. Fixed this to eliminate the warning.
The high-frequency wobble in the Pluto position function was bothering me.
Decreased the arcminute error threshold from 1.0 to 0.5, resulting
in a much larger model, but a lot less ripple:
547 [ 78 140 94 115 21 99]
Relax apparent angular error threshold from 0.4 to 1.0 arcminutes.
No longer compare TOP2013 to NOVAS while optimizing.
Use worst-case distance between Earth and Pluto:
Pluto radius from Sun, minus Earth aphelion distance.
Sample 503 points intead of 293.
Measure 2 full orbits before J2000 and 2 full orbits after J2000.
Statistics for output/8.top :
OptimizeTop: 268 terms [ 34 57 72 90 9 6]
Created functions for generating random unit vectors in
6-dimensional space. Will use this for trying different
directions along which to do a binary search between
truncated TOP2013 models that have acceptable error
and those which have unacceptable error. Will home in on
the smallest model that is within tolerable error.
Instead of calculating amplitudes and truncating based on them,
I realized when it comes right down to it, all I want to do
is truncate fewer or more terms from each formula until I find
a good compromise between size and accuracy. A term is either
included or excluded. Therefore the degree of freedom is discrete,
not continuous. There is no need to calculate a continuous value
to adjust something with only discrete options available.
This change allows me to automatically initialize the pruning amplitudes
to the largest possible value that won't cause any pruning.
It establishes a lower bound for pruning each of the 6 elliptical formulas.
The TopCloneModel function makes a deep copy of a model,
allocating separate term arrays for the copy.
TopSquash uses a contribution map and an array of 6 amplitude thresholds
to pack down an original model into a cloned model.
The contrib map is an array of 6 sortable lists, one for each
elliptical formula. Each list contains a tuple (m, s, t)
where m = the magnitude of the contribution of a term,
and (s, t) are the indices of the term in the formula.
I sort the tuples in ascending order of magnitude.
This should allow me to efficiently eliminate terms from
each formula.
I will have to add an "ignore" flag for each term, because
eliminated terms will not generally be at the end of the list.
Before saving, I will need to compact the lists.
The first step is measuring the error between TOP2013 and NOVAS
over a range of time values and finding the maximum error in
worst-case parallax arcminutes as seen from the Earth.
Next I will be able to automate pruning the model to make
it as small as possible without exceeding our error tolerance.
This makes me think there is something wrong with how
I am calling NovasBodyPos(). I don't understand why the errors
are tiny fractions of arcminutes here, but up to 0.11 arcmin
compared to NOVAS.
Ported the original FORTRAN code for converting elliptical
elements to ecliptic/equatorial rectangular coordinates.
Verified against the output of the original FORTRAN program.
The results include both position vectors and velocity vectors,
and all are identical to 10 places after the decimal.
When I load TOP2013.dat, I have to simulate regenerating the output
in order to find discrepancies and fix them.
This is a total hack, but it satisfies multiple goals:
1. Generate identical output as the loaded input.
2. Confirm that what we loaded is what we meant to load.
3. Allow saving modified/calculated models correctly.
I want to make sure I can load and save a TOP2013 data set perfectly
before proceeding with calculation, truncation, etc.
I'm really close, but there are occasional rounding problems
writing floating point numbers back to the file in the weird
format they use.
Adding infrastructure for loading TOP2013 models of planets
and calculating them. Will start with a unit test to verify
I'm calculating the formulas correctly.