Commit Graph

1235 Commits

Author SHA1 Message Date
Don Cross
954a00f6a0 Performance metrics: tally calls to Search.
Now I can see that rise_set_test is causing Search to sample
the altitude function 18 times per call.
2019-04-21 10:48:07 -04:00
Don Cross
043a05b78e Starting to add some simple performance metrics for Search function.
I am interested in optimizing the Search function.
Right now it is a very simple binary search that keeps breaking
an interval in half to narrow in on the time of where the supplied
function ascends through zero.  I know this can be made much better,
and this is important because the function calls are very expensive
in some cases.

So this commit adds the beginning of some simple metrics tracking
where unit test code can retrieve the number of times Search
sampled the function it is trying to find the ascending root for.
2019-04-21 10:34:31 -04:00
Don Cross
c1d8970873 Updated comments, renamed gmst variable to gast. 2019-04-21 10:10:49 -04:00
Don Cross
8c2118ed67 Fixed #23 - Crazy behavior in refraction formula
The refraction formula went nuts near altitude angle -5.11 degrees.
We were taking the tangent of a value that zoomed toward infinity
near that value, causing essentially random numbers without any
upper bound to their size. Just like JPL Horizons, truncate any
angle more than 1 degree below the horizon, only I have a linear
taper down to 0 refraction as the altitude angle approaches -90.
I did not want any chance of creating an altitude less than -90.

Removed unit tests for the Sun at latitude -80 degrees.
It is too easy for my code to behave differently from another
calculator, because tiny changes in atmospheric modeling can
cause disagreement about whether there even is a sunset/sunrise.
This is because for observers so close to the pole, the Sun
sometimes barely dips below the horizon and then comes back
up for less than an hour.
2019-04-20 23:00:02 -04:00
Don Cross
9de4451468 Reworked rise/set algorithm based on culm/bottom bounding.
This is the first time it has passed the unit test,
although the unit test is just exercising whether the predictions
occur in the right order. I will need to add check for how accurate
the predictions are.
2019-04-20 19:12:29 -04:00
Don Cross
d10f7e4bcb Can now search for time of object's highest/lowest altitude.
This will help me create a better algorithm for rise/set,
plus the culmination is one of the things I wanted for its own sake.
2019-04-19 22:03:55 -04:00
Don Cross
e3dc71952c Starting to implement rise/set search, but not working yet. 2019-04-18 21:32:06 -04:00
Don Cross
0e757dfc0d Skip 6 days (instead of 1) to find next moon quarter.
This should help find the next quarter slightly more efficiently
because it will provide a more accurate estimate of the next quarter.
2019-04-18 13:05:29 -04:00
Don Cross
2705e6669f Added handy JS function Astronomy.NextMoonQuarter.
This way people don't have to figure out how to iterate
through moon quarters. Use SearchMoonQuarter to start iteration,
NextMoonQuarter to iterate through as many more as desired.
2019-04-18 08:58:40 -04:00
Don Cross
6834d4e582 Fixed #6 - Added JS functions to find moon quarters.
Can now search for the next new moon, first quarter,
full moon, or third quarter.
Verified against US Navy Observatory data.
Predictions are confirmed to within 2 minutes of time
for years between 1800 and 2100.
2019-04-17 21:03:38 -04:00
Don Cross
f39cca2931 Starting to validate ecliptic longitude calculations. 2019-04-16 21:58:40 -04:00
Don Cross
feaa97cb7a First attempt at calculating J2000 geocentric ecliptic coordinates.
Needs testing/validation. Checking in for backup.
2019-04-16 21:19:12 -04:00
Don Cross
83d852b2d1 JS CalcMoon() now uses a Time object like other high-level functions.
This will be handy if I need to use it to calculate moon phases.
Not sure yet.
2019-04-16 20:36:11 -04:00
Don Cross
ad3bec5f4b Fixed #14 - Linux and Windows JS now match.
The floating point constants emitted for the Pluto Chebyshev
model did not quite match between Linux and Windows.
I suspect the real problem is not the operating system
but that I'm using different versions of Node on both:
Windows: v10.15.3
Linux: v8.15.1

Now I print only 12 place after the decimal instead of 18.
This makes no difference in the unit test output,
and reduces the JS code size significantly.
2019-04-15 13:32:12 -04:00
Don Cross
18c293d8c0 Fixed #12 - Support dates 1700-01-01 through 2199-12-31.
Expanded the Chebyshev model for Pluto.
Resampled VSOP models to have required accuracy over wider date range.
Decreased astro_check.js sampling rate to allow tests to run faster.
2019-04-15 13:10:32 -04:00
Don Cross
d01ac8e150 Fixed #13 - Eliminate use of Julian Dates.
Now the JavaScript code uses UT and TT values expressed
in days since 2000, instead of Julian Dates.
This makes the numeric values much smaller and thus
should yield less floating point error when time solvers
are added later.
2019-04-15 10:47:00 -04:00
Don Cross
e87ccfc044 Eliminating JD: CalcChebyshev 2019-04-15 10:28:28 -04:00
Don Cross
3fc64bec77 Eliminating JD: iau2000b 2019-04-15 10:19:58 -04:00
Don Cross
938942c86a Eliminating JD: nutation_angles, mean_obliq, e_tilt 2019-04-15 10:15:03 -04:00
Don Cross
bcd37239bb Eliminating JD: precession() now uses TT expressed in J2000 days. 2019-04-15 10:03:34 -04:00
Don Cross
a3f899e234 Eliminating JD: fixed nutation() 2019-04-15 09:56:09 -04:00
Don Cross
fe70afa483 Eliminating JD: fixed era() 2019-04-15 09:47:37 -04:00
Don Cross
14119de894 Work in progress: eliminating Juliate Date. 2019-04-15 09:18:13 -04:00
Don Cross
0be2b72799 A couple of baby steps toward using J2000 days throughout the code. 2019-04-14 21:34:53 -04:00
Don Cross
9ad923ccfd Starting to rework to do all calculations in J2000 days instead of JD.
This should yield a few more decimal places of accuracy with
all the time calculations.
2019-04-14 20:56:49 -04:00
Don Cross
c5ed0a3c3d Reduced delta_t data by 19339 bytes. 2019-04-14 17:24:48 -04:00
Don Cross
36643fc47a Fixed #2 - use finer-grained delta-t values without discontinuities.
Using historic, recent, and predicted values of TT-UT instead of
UTC leap seconds.  With linear interpolation, there are no longer
discrete jumps in the calculated TT values. Hopefully, this will
make event solvers (rise, set, etc) more well-behaved.
2019-04-14 16:42:50 -04:00
Don Cross
8fdad8b163 Fixed #3 - Correct geocentric coordinates for light travel time.
Astronomy.GeoVector now corrects for light travel time from
the observed object. This reduced worst case angular error
from 1.16 arcmin to 0.89 arcmin (0.27 arcmin improvement).
2019-04-14 12:47:16 -04:00
Don Cross
51cff29dd9 Figured out the JPL Horizons refraction formula.
I found some online resources that helped me track down the
formula for the refraction model used in the JPL Horizons
online tool. Now the JavaScript library allows 4 different
refraction options in Astronomy.Horizon():

false    :  no refraction
'novas'  :  use the NOVAS C 3.1 algorithm.
'jplhor' :  JPL Horizons algorithm, clamped beyond 1 degree below horizon.
'sae'    :  same as 'jplhor', only without clamping.

Now passes the jplcheck unit test without filtering out objects below the horizon!

Always compile the C code when executing the script './run'.
2019-04-13 22:00:20 -04:00
Don Cross
b355627a3e Fixed #1 - calculating horizontal coordinates with optional refraction. 2019-04-12 22:17:14 -04:00
Don Cross
eaf6f3f7d6 JPL Horizons checker now working for astrometric equatorial coords.
Still need to resolve errors in apparent equatorial and horizontal coords.
2019-04-12 16:39:23 -04:00
Don Cross
80267c39ec Getting closer to correct horizontal coordinates.
Not quite right yet for some reason, but this is closer.
JavaScript function Astronomy.SkyPos() now returns both
J2000 (RA,DEC) and (RA,DEC) using true equator and equinox of date.
Use the latter to calculate horizontal coordinates.
This matches my call to NOVAS place() function, but there
are still errors larger than 2 degrees compared with JPL Horizons
and Heavens Above.

For example:

2019-04-11 19:47:00
variable           test.html  JPL Horizons   error(arcmin)
Sun azimuth	        245.455     246.585         -67.80
Sun altitude         50.858      51.261         -24.17
Jupiter azimuth     277.309     275.287         121.33
Jupiter altitude    -63.751     -63.860           6.52
2019-04-11 17:21:03 -04:00
Don Cross
005edb555b Unconfirmed calculation of horizontal coordinates.
I have horizontal coordinates calculated, but they might
be wrong (both in how I call NOVAS functions and the JS code itself)
because I think I'm mixing up equinox of date coordinates with
J2000 coordinates for (RA,DEC).

Fixed bug that caused excessive estimate of angular error:
right ascension and azimuth are like longitudes -- they matter
less as an object approaches the poles.  Scale such longitudinal
errors by the cosine of the latitudinal counterpart.
2019-04-11 14:15:31 -04:00
Don Cross
2decdbc685 Generating JavaScript code. 2019-04-09 12:23:35 -04:00
Don Cross
00187637df Created directory into which JavaScript code will be generated. 2019-04-07 17:08:13 -04:00