Commit Graph

127 Commits

Author SHA1 Message Date
Don Cross
4f80808008 JS: ObserverState
Implemented the JavaScript version of the ObserverState function.
2021-11-19 20:26:46 -05:00
Don Cross
5c989be20c PY HelioState: calculates heliocentric position and velocity.
This is the Python version of a new function HelioState to
calculate heliocentric state vectors (position and velocity).
2021-11-15 20:37:09 -05:00
Don Cross
f16dcea487 JS HelioState: calculates heliocentric position and velocity.
This is the JavaScript version of a new function HelioState to
calculate heliocentric state vectors (position and velocity).
2021-11-15 20:10:11 -05:00
Don Cross
19f157e71c Full support for geocentric and barycentric EMB.
Now the Python version of Astronomy Engine supports calculating
the Earth/Moon Barycenter (EMB) state vector (position and velocity)
relative to the Earth's center (geocentric) or relative
to the Solar System Barycenter (SSB).

This completes support for this feature across C, C#, JavaScript, and Python.
2021-11-14 11:54:57 -05:00
Don Cross
029588da06 JavaScript: Calculate state vectors for barycentric/geocentric moon, EMB. 2021-11-14 00:37:52 -05:00
Don Cross
71cb92df08 Calculate barycentric state of Pluto.
The BaryState function did not support Pluto before.
Refactored the code so that the internal CalcPluto function
returns both the position and velocity, and its caller
can select from heliocentric or barycentric coordinates.
HelioVector asks for heliocentric coordinates and keeps
only the position vector. BaryState asks for barycentric
coordinates and returns both position and velocity.

I added test data for Pluto generated by JPL Horizons.
It turns out the Pluto system barycenter is the best fit
for TOP2013, presumably because Charon causes Pluto to
wobble quite a bit.

I also generated JPL Horizons test data for the Moon
and the Earth/Moon barycenter, anticipating that I will
support calculating their barycentric state vectors soon.

I had to increase the enforced size limit for minified
JavaScript from 100000 bytes to 120000 bytes.
I guess this is like raising the "debt ceiling".

Fixed a bug in Python unit tests: if "-v" verbose option
was specified, it was printing a summary line for every
single line of input, instead of a single summary after
processing the whole file, as was intended. This is one
of those Python whitespace indentation bugs!
2021-11-13 16:07:00 -05:00
Don Cross
4e6cb282f5 Use original Pluto gravsim with finer time steps.
I'm getting much better accuracy sticking with my original
gravity simulator, just with smaller time increments, than
I was with the Runge-Kutta 4 method. The PlutoStateTable
gets a bit larger (51 state vectors instead of 41), but the
accuracy is so much higher.

Removed the Runge-Kutta code because I won't be going back to it.
2021-11-12 16:22:14 -05:00
Don Cross
a5fd814ba1 Finished single-source-of-truth for Pluto constants.
The Pluto gravity simulator constants now come from
a single source: pluto_gravsim.h. This will allow me
to experiment with the Pluto state table to get a better
compromise between size and accuracy.
2021-11-12 15:30:56 -05:00
Don Cross
3f788aaaee Fixed #126 - Added support for lunar libration.
There is now a Libration function in all 4 supported languages.
The returned structure contains libration angles in
ecliptic latitude and ecliptic longitude, along with
the Moon's ecliptic position and distance.
Also included is the Moon's apparent angular diameter.
2021-11-05 19:14:46 -04:00
Don Cross
296f23af76 Libration functions now calculate apparent angular diameter of the Moon.
All 4 languages have added a `diam_deg` field to the
structure returned by the Libration function.
It is the apparent angular diameter of the Moon as
seen from the center of the Earth, expressed in degrees.
2021-11-05 16:02:14 -04:00
Don Cross
eab9c275b9 Implemented lunar libration function for JavaScript. 2021-11-05 14:46:56 -04:00
Don Cross
adf65e1f1f Throw an exception for invalid refraction option.
In JavaScript and Python, throw an exception if provided
an invalid refraction option. Especially in JavaScript,
it was too easy to pass in a value like 'true', which did
not calculate refraction as expected.
2021-10-12 14:31:13 -04:00
Don Cross
42240288b0 JS SearchAltitude: improved documentation and parameter checking. 2021-09-23 10:43:20 -04:00
Don Cross
24571444d9 JS SearchAltitude implemented.
Refactored SearchRiseSet to create a new function
InternalSearchAltitude. SearchRiseSet calls InternalSearchAltitude,
and the new function SearchAltitude also cals InternalSearchAltitude.
This causes the code to be only a tiny big larger.
2021-09-22 19:45:33 -04:00
Don Cross
dc5bb5317b No longer assume typescript is installed globally.
The unit tests for the calendar.ts demo program
assumed that the 'tsc' typescript compiler was
installed globally. Redirect it to the typescript
installed in the 'generate' folder.

I could have just made typescript a dependency,
but it seemed wasteful of disk space to have two
copies of the same thing (it is currently 54MB).
2021-09-18 21:59:06 -04:00
Don Cross
b32b2705ee Fixed JS doc formatting mistake.
The formatting of the JS documentation for class
GlobalSolarEclipseInformation was messed up in the
generated Markdown file. Fixed that issue in the
JS comments.

Bumping npm version to 2.0.6, to include recent
barycentric state and Earth gravity calculations.
2021-07-23 19:25:03 -04:00
Don Cross
a9479832dd JavaScript ObserverGravity function. 2021-07-19 17:27:33 -04:00
Don Cross
131638a964 equator_of_date.js demo now corrects aberration. 2021-07-14 21:54:58 -04:00
Don Cross
e398aa43a4 JS: Implemented BaryState function.
Ported the C version of BaryState to JavaScript.

Fixed an issue in both the C and JS unit tests:
the JPL Horizons data is given in terms of TT, not UT.
2021-07-11 19:40:27 -04:00
Don Cross
b005bdef5a Starting to implement generalized aberration.
I realize some use cases require adjustments for
stellar aberration. The existing aberration adjustments
are only supplied for calculating planet positions.
Some users will benefit from being able to add/subtract
aberration corrections to arbitrary vectors, including
for star positions.

I have added some JPL Horizons test data to help
validate the aberration functionality I'm about to add.
I created the beginning of a unit test in ctest.c,
but currently there is no aberration correction
implemented, so the test has no error threshold.
2021-07-09 20:31:23 -04:00
Don Cross
5ea2bf65a1 equator_of_date.js defaults to current date/time.
Allow this demo to use the current date and time by
default if the user does not specify one on the command
line. This required changing the order of the command line
parameters.
2021-07-06 20:58:31 -04:00
Don Cross
7d955c99ba Added demo program equator_of_date.js.
Given the right ascension and declination of a star,
expressed in J2000 coordinates, this demo converts those coordinates
to right ascension and declination expressed in the Earth's
equator at any given date and time. This example illustrates
how to use rotation matrices to convert one coordinate system
to another.

This example was prompted by the question at:

https://github.com/cosinekitty/astronomy/discussions/114
2021-07-06 20:21:07 -04:00
Don Cross
87926a71c1 Implemented C# 'triangulate' demo. Added doc links. 2021-06-22 13:51:14 -04:00
Don Cross
50019fafce Implemented JavaScript 'triangulate' demo. 2021-06-22 11:45:07 -04:00
Don Cross
a28aa5c3d9 One more documentation fix for JavaScript. 2021-06-21 21:20:05 -04:00
Don Cross
95960a962a Documentation fixes for JavaScript. 2021-06-21 20:56:38 -04:00
Don Cross
8abda4ea30 Documentation fixes for VectorObserver functions. 2021-06-21 20:23:33 -04:00
Don Cross
90f5ea367e JS: Implemented VectorObserver. 2021-06-21 16:45:59 -04:00
Don Cross
52fb59b32e Python: Implemented EQJ/GAL conversions.
Ported conversion to/from galactic coordinates to Python.
Added unit test for new Python code.
Updated documentation for all 4 supported languages.
Fixed mistakes in JavaScript function documentation.
2021-06-10 20:48:11 -04:00
Don Cross
15988c87df Ported GAL/EQJ conversion to JavaScript. 2021-06-09 21:11:30 -04:00
Don Cross
1396367524 Made minified JS browser code a little smaller.
Decreased the minified browser code from 94115 bytes to 94098 bytes.
Eliminated unncessary braces, used ternaries instead of 'if', etc.
2021-05-18 21:54:03 -04:00
Don Cross
efc6e7bdf9 Fixed broken build caused by improper branch merge.
When I merged from calendar2 branch into master branch,
I forgot to run the unit tests locally and commit the
code generation changes it caused. This has been fixed.
2021-05-16 14:29:30 -04:00
Don Cross
3e420e9e32 Merge branch 'calendar2' 2021-05-16 14:05:00 -04:00
Don Cross
7db556046b Calendar demo: planet constellations. 2021-05-16 13:32:19 -04:00
Don Cross
d5fb13d35c I forgot to check in updated calendar output. 2021-05-16 13:18:00 -04:00
Don Cross
5afeab6b02 Calendar demo: Sun, Moon culmination. 2021-05-16 12:25:57 -04:00
Don Cross
d950eaaa55 Calendar demo: planet perihelion and aphelion. 2021-05-16 12:15:24 -04:00
Don Cross
d87a42446f Calendar demo: added lunar apogee and perigee. 2021-05-16 12:04:18 -04:00
Don Cross
c4c90c9c22 Cleaned up JavaScript code and made minified version a little bit smaller. 2021-05-15 21:52:20 -04:00
Don Cross
08247921b5 Calendar demo: include transits of Mercury and Venus. 2021-05-15 20:45:30 -04:00
Don Cross
3220fb030d Calendar demo: include local solar eclipse predictions. 2021-05-15 20:32:29 -04:00
Don Cross
51235fbffd Calendar demo: include lunar eclipse predictions. 2021-05-15 20:00:55 -04:00
Don Cross
eefcce91e0 Calendar demo: added comments for remaining tasks. No code changes. 2021-05-13 20:28:51 -04:00
Don Cross
37c35737af Calendar enumerator demo: find times when Venus appears brightest. 2021-05-13 20:22:44 -04:00
Don Cross
629317e9ff Calendar enumerator demo: max elongations of Mercury and Venus.
Added event enumerators for when Mercury and Venus appear
at the maximum angle from the Sun as seen from the Earth.
2021-05-13 20:06:39 -04:00
Don Cross
31b71ac97f Calendar enumerator: added planetary conjunctions and oppositions.
The calendar enumerator demo now includes inferior and superior
conjunctions of the inner planets (Mercury and Venus), along
with the conjunctions and oppositions of the outer planets
(Mars ... Pluto).
2021-05-13 19:32:03 -04:00
Don Cross
23eb42f951 Removed unnecessary and risky method EventCollator.Append().
Once a collator has been created, and a caller starts
enumerating events, it does not make sense to be able to add
another enumerator to the collator. So I removed EventCollator.Append().
It was just opening up the possibility of bugs for no good reason.

Client code should decide up front what kind of events it wants
to enumerate and provide a complete list of enumerators.
Then it may use FindFirst/FindNext as many times as it wants
and everything will just work.
2021-05-12 20:36:32 -04:00
Don Cross
953ffef7a8 Calendar demo: added a moon quarter enumerator.
Added MoonQuarterEnumerator, which finds new moon, first quarter,
full moon, and third quarter events.
Changed the calendar start date to May 2021, so it is
more relevant to the time I'm testing it.
2021-05-12 19:54:09 -04:00
Don Cross
04ebd129dd Calendar demo now includes seasons. Also goes for 10 years instead of 1.
Generate solstices and equinoxes in the calendar event enumerator.
Generate 10 years of data instead of 1, to better test the seasons.
2021-05-12 19:37:34 -04:00
Don Cross
03f4e91bb9 Rough demo for how calendar enumerator will work.
This is an example of how multiple enumerators can be combined
into an EventCollator. The collator does the minimum amount
of work to keep searching for one event at a time, while always
emitting them in chronological order.
2021-05-12 19:00:21 -04:00