Commit Graph

1235 Commits

Author SHA1 Message Date
Don Cross
9092bc7d89 Fixed a couple of bugs that crept in as I was refactoring code. 2019-05-06 14:33:14 -04:00
Don Cross
2c019922de More documentation work in progress. 2019-05-06 14:27:04 -04:00
Don Cross
929397c8fa Extend the coverage of Delta-T data as far into the future as possible.
Was missing any data from delta_t/predicted.txt that occurred after
the final integer year value. Now include the very last line of data
even when it is not on a year boundary.
2019-05-06 12:19:16 -04:00
Don Cross
f8515cc02f More documentation work: PerformanceInfo. 2019-05-06 08:48:18 -04:00
Don Cross
e8eecaa632 More documentation work. 2019-05-05 21:40:24 -04:00
Don Cross
d2e2569fe2 Gave up trying to display MathJax in Markdown.
Instead of documenting how to calculate phase fraction, just calculate it.
Show 'number' instead of 'Number' for numeric types.
2019-05-05 19:54:06 -04:00
Don Cross
44ae81ed7f Fixed documentation typos. Trying to use MathJax in my Markdown. 2019-05-05 17:49:19 -04:00
Don Cross
cc3fc97505 More documentation work in progress. 2019-05-05 17:21:51 -04:00
Don Cross
a684aa424d More documentation work. 2019-05-05 15:27:08 -04:00
Don Cross
578bb49492 More documentation work. 2019-05-05 14:14:27 -04:00
Don Cross
819e08ce0d Generate local HTML documentation for previewing.
Instead of reading Markdown files locally, I generate HTML documentation.
I tell Git to ignore the html directory because it is only for local use.
2019-05-05 13:23:23 -04:00
Don Cross
40ade08067 Starting to generate documentation in Markdown format.
Using jsdoc-to-markdown to directly update source/js/README.md.
Added a little more documentation to astronomy.js.
2019-05-05 09:19:03 -04:00
Don Cross
8011f0d09a JSDoc: Figured out how to document enclosed functions. 2019-05-05 06:18:24 -04:00
Don Cross
d6bbba3ed1 Starting to add JSDoc comments. 2019-05-04 23:10:12 -04:00
Don Cross
e38a3487a1 Fixed #28 - Find times when Venus is at its brightest. 2019-05-04 19:03:10 -04:00
Don Cross
a08895cf34 Fixed #27 - Calculating max elong of Mercury, Venus.
Figured out that JPL Horizons and other sources define elongation
as the full angle between bodies, not just the ecliptic projection
of the angle. This brings my predictions within 0.6 hours of JPL.
2019-05-02 22:01:01 -04:00
Don Cross
926e92462d Added tests, fixed problems in max elongation search.
Still not happy with some of the hour errors, up to 14 hours.
Maybe I need to search for actual angle between planet and Sun,
not just along ecliptic longitude.
Also should try generating JPL Horizons data to verify the
test data I have here.
2019-05-02 16:20:33 -04:00
Don Cross
995c24bdc3 Added Astronomy.SearchMaxElongation().
This function finds the times when Mercury or Venus is furthest
east or west along the ecliptic from the Sun.
Needs more testing!
2019-05-02 15:22:29 -04:00
Don Cross
9d80b33e66 Added a minimal test of Saturn visual magnitude formula.
I don't have authoritative test data for Saturn, so I'm
just comparing against its own calculations, after having
visually inspected some test cases against my old code and
Heavens Above. This is not really adequate but it's the best
I can do right now.
2019-04-30 21:21:56 -04:00
Don Cross
d379ab3114 Fixed error in SaturnMagnitude().
Now this matches the output from my old astronomy code.
I still don't have good test data for Saturn.
2019-04-30 20:11:17 -04:00
Don Cross
8746a9fa95 First attempt at SaturnMagnitude(). Not sure how to get test data yet. 2019-04-30 15:59:21 -04:00
Don Cross
67d328cac2 Got Moon magnitude calculation matching JPL Horizons data.
Did this by retrofitting my calculations to match phase
curve extracted from JPL Horizons output.
2019-04-29 22:14:14 -04:00
Don Cross
4081fbefce Fixed visual magnitude calculation for Uranus.
Now Uranus calculations match output of JPL Horizons closely.
I figured this out by graphing JPL Horizons data and tweaking
my phase curve formula to match.
2019-04-29 21:46:15 -04:00
Don Cross
f64b804869 Made Pluto visual magnitude calculation match JPL Horizons.
I was able to eyeball the slope from a graph of deduced
phase curve by analyzing JPL Horizons output.
Now my Pluto magnitude values are well within agreement.
2019-04-29 21:41:10 -04:00
Don Cross
c280c9334e Found Venus, Mercury magnitude formulas that match JPL Horizons.
I found a paper by James L Hilton (USNO) that provides
formulas for the phase curves of Mercury and Venus that match
the JPL Horizons tool within 0.012 mag.
https://iopscience.iop.org/article/10.1086/430212
2019-04-29 17:22:23 -04:00
Don Cross
9d0a4a0e2f Starting to implement Moon magnitude, but not quite right yet. 2019-04-28 14:11:17 -04:00
Don Cross
eeb1482d37 Starting to implement visual magnitude calculations.
Not fully validated, but I did tweak Montenbruck/Pfleger
formulas to match JPL Horizons output for 2018-04-27 02:00 UTC.
Still need to implement formulas for Moon and Saturn.
2019-04-27 22:10:02 -04:00
Don Cross
28f95e8bee Calculating phase angle and distance of Moon and planets.
This is a first step toward calculating visual mangitudes of these bodies.
2019-04-26 21:59:31 -04:00
Don Cross
252f551622 Updated comments and error message text. 2019-04-26 20:37:37 -04:00
Don Cross
417b30a176 Renamed PhaseAngle function to LongitudeFromSun.
"Phase angle" means the angle between the Sun and the Earth
as seen by a third body.

This function calculates the angle between the Sun and a body
as seen by the Earth, with a range that goes all the way to
360 degrees, allowing finding all 4 quarters of the Moon's cycle.
2019-04-26 20:33:48 -04:00
Don Cross
d25bd3fe38 Fixed #31 - Greatly improved convergence for Mercury, Mars.
When searching for oppositions and conjunctions of Mercury and Mars,
dynamically adjust to their eccentric orbits by tweaking the
effective synodic period based on how far we missed the mark
on each iteration.

This brings the average for Mercury from 19 down to 6.4.
All the other planets got at least a little better.
2019-04-25 21:42:29 -04:00
Don Cross
1c5ef57ad0 Measure iterations/call for SearchRelativeLongitude.
Confirmed that Mercury is taking 19 iterations/call on average,
and Mars is taking about 10 iterations/call.
The other planets average 6 iterations/call.
2019-04-25 21:13:45 -04:00
Don Cross
1150f615de Added verification of conjunctions and oppositions to unit_test.
Still need to verify that there is a consistent interval between
consecutive events.

Mercury is taking way too long to converge.
Mars is kind of slow too.
Need to improve the efficiency of SearchRelativeLongitude!
2019-04-25 11:10:05 -04:00
Don Cross
c845dc7cbf Successfully calculating opposition of superior planets.
Using relative heliocentric ecliptic longitude of the Earth
and the other planet. Home in on when both planets have the
same longitude (the difference is 0).
2019-04-24 21:06:34 -04:00
Don Cross
509a7bb0bf Factored out code for longitude offset normalization.
Makes code a tiny bit smaller, and I will re-use for finding
conjunctions and oppositions.
2019-04-24 15:38:36 -04:00
Don Cross
1491d7f075 Forgot to push generated code. 2019-04-24 15:24:16 -04:00
Don Cross
ee8f7b1063 Fixed #7 - Calculating equinoxes and solstices to within 1.7 minutes.
Added correction for light travel time from the Sun.
Now my equinox and solstice calculations are within 1.7 minutes
of established values.
2019-04-23 20:54:39 -04:00
Don Cross
b1fed4e459 Finding solstices and equinoxes, but with approx 8 minute error.
For some reason, all my calculations are about 8 minutes earlier
than predictions from the test data. I suspect this is because
of light travel time from the Sun (equivalently, aberration).
2019-04-23 20:39:50 -04:00
Don Cross
dd761773d5 Starting to work on calculating equinoxes and solstices.
Added new function Astronomy.SunPosition().
It is supposed to return ecliptic coordinates of date for the Sun
as seen from the center of the Earth.

The values look reasonable but I need to test them.
Will use the Sun's longitude in the return value from SunPosition()
to determine solstices and equinoxes.
2019-04-23 16:00:51 -04:00
Don Cross
50988c9ab2 Simplified sidereal_time() and callers -- always calculate GAST.
All callers of sidereal_time ended up needing it for apparent time,
not mean time. So I simplified the code so it no longer has extra
stuff for calculating GMST.
2019-04-23 13:59:53 -04:00
Don Cross
0af0a8ec67 Fixed #24 - No need to correct for light travel for the Sun.
Astronomy.GeoVector no longer iterates to try to correct light
travel time for the apparent position of the Sun. The Sun's
heliocentric coordinates are always (0,0,0), so there is no need
to do that.
2019-04-23 13:35:18 -04:00
Don Cross
e56842755d Added iteration safety limit in Search(). Defaults to 20.
Search limit can be adjusted in options passed into Search().
After 20 iterations, we should have divided the search
region by a factor of more than a million.  If quadratic
interpolation can't finish the job at that point, something
is really wrong.
2019-04-23 07:37:52 -04:00
Don Cross
47c9d2b801 Fixed #25 - Boosted rise/set search efficiency by 25%.
Allow caller to pass in pre-evaluated endpoints to begin the search.
This eliminates 2 function calls per search, reducing the
average from 8 calls/search down to 6 calls/search.

I think this is about as good of performance as I'm going to get.
2019-04-22 21:32:43 -04:00
Don Cross
1f49f7222f Having a "max slope" was flawed... lower slope is worse!
The smaller the slope magnitude |df/dt| is, the larger
the uncertainty in dt. That means we are better off using
an estimated value for the slope each time than underestimating
the time error like we were doing.

This also simplifies the code, and does not make it very
much slower.
2019-04-22 21:25:45 -04:00
Don Cross
358fb819a7 Improved search efficiency by guessing around QuadInterp root guess. 2019-04-22 16:22:41 -04:00
Don Cross
48006112db Search: wrap the function with another to increment call count.
This just makes the code cleaner, and I'm about to pass the
wrapper function to a Chebyshev interpolator, so it will be
even more handy then.
2019-04-22 11:04:27 -04:00
Don Cross
a30d904b84 Improvements to Search().
Now pass in max slope of function to be searched, expressed
in units/day. By seeing how far the function is from zero,
we can deduce whether we are within the specified time tolerance
of finding the event.

Use a simplified refraction model in the rise/set search so that
the function is better fit by parabolas. Assume constant refraction
instead of variable refraction, because it only matters near the horizon
anyway. Use a canned value of +34 minutes, which creates close fit with
test data.
2019-04-22 10:43:59 -04:00
Don Cross
dbe968691c Minor search improvements, but still seems like much better is possible. 2019-04-21 22:21:17 -04:00
Don Cross
c21d8a2345 Benchmark down to 66576 samples from 90720.
It is an improvement, but feels like much better should be possible.
2019-04-21 22:09:38 -04:00
Don Cross
0ea4432e4d First attempt speeding Search using quadratic interpolation.
The results are slightly better, but not nearly what I had hoped.
Going to try some other things.
2019-04-21 21:10:10 -04:00