Commit Graph

2245 Commits

Author SHA1 Message Date
Don Cross
3752d588be Fixed bug parsing negative declinations in espenak_nodes.txt. 2022-02-04 20:48:37 -05:00
Don Cross
16d945364e Verify moon nodes by checking ecliptic lat=0. 2022-02-04 20:14:54 -05:00
Don Cross
69184406b3 ctest.c parser for moon_nodes.txt.
Implemented the beginnings of a unit test for moon_nodes.txt.
The code reads and validates the syntax of the file.
2022-02-04 20:02:59 -05:00
Don Cross
13b13a0f3f C Astronomy_EclipticGeoMoon implemented.
This is a thin wrapper function for the internal
function CalcMoon, which has already been extensively
validated. It will enable outside users to search
for ascending and descending nodes of the Moon,
or to calculate ecliptic spherical coordinates for the Moon
for any other useful purpose.
2022-02-03 22:05:12 -05:00
Don Cross
e2a055a216 Test data for Moon ascending/descending nodes. 2022-02-03 21:51:11 -05:00
Don Cross
e4b2911c97 Clarify GeoMoon and GeoMoonState calculating EQJ.
Changed the documentation for the GeoMoon and GeoMoonState
functions to make it explicit that they calculate coordinates
oriented with respect to the Earth's J2000 equator (EQJ).
This is because I will soon add ecliptic (ECL) counterparts
for the GeoMoon function, to more directly search for ascending
and descending nodes of the Moon.
2022-02-03 19:43:18 -05:00
Don Cross
910c1b3781 Lagrange point test data from JPL Horizons.
Added data for testing Lagrange point calculations,
which has yet to be implemented. JPL Horizons
provides L1, L2, L4, and L5 (but *not* L3) calculations
for:

    Sun / EMB
    Earth / Moon

where EMB = Earth/Moon Barycenter.
2022-02-03 12:47:23 -05:00
Don Cross
b6cfd9ea49 Merge pull request #155 from cosinekitty/dependabot/npm_and_yarn/generate/cached-path-relative-1.1.0
Bump cached-path-relative from 1.0.2 to 1.1.0 in /generate
2022-01-27 11:26:20 -05:00
dependabot[bot]
6e640a7fea Bump cached-path-relative from 1.0.2 to 1.1.0 in /generate
Bumps [cached-path-relative](https://github.com/ashaffer/cached-path-relative) from 1.0.2 to 1.1.0.
- [Release notes](https://github.com/ashaffer/cached-path-relative/releases)
- [Commits](https://github.com/ashaffer/cached-path-relative/commits)

---
updated-dependencies:
- dependency-name: cached-path-relative
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-27 15:32:31 +00:00
Don Cross
90a9839d18 Optimize for map-making calculation patterns.
See this discussion:
https://github.com/cosinekitty/astronomy/issues/150

For the case of calculating a map, where each pixel
on the map represents a different location on the Earth,
it is more efficient to factor out expensive calculation
of sidereal times, assuming the entire map represents
some phenomenon at a single moment in time.

For example, to determine whether the Moon is visible
at different places on the Earth, the following
functions can be calculated across thousands of
different (lat, lon) geographic coordinates around
the world:

    ObserverVector
    Rotation_EQD_HOR

Before iterating over the map pixels, a program
can call GeoMoon, then convert EQJ coordinates to EQD.

Then by passing the same time value in a loop to
ObserverVector and Rotation_EQD_HOR, the program
can calculate a vector from the observer to the Moon
in EQD coordinates, then convert EQD to HOR.
The z-coordinate of the horizontal coordinates
determines whether the Moon is above or below the
observer's horizon at that point on the Earth.

This calculation pattern performed redundant
sidereal time calculations for each pixel on the map.
I changed the code for all 4 languages to cache
sidereal time so that it only needs to be calculated
once.

In the C version of Astronomy Engine, this resulted
in a speedup factor of about 2.3 in the above use case.
(See the function MapPerformanceTest in generate/ctest.c.)
2022-01-22 20:47:46 -05:00
Don Cross
0bfdb359b1 Fixed #153 - Optimize C functions by recycling nutation calculations.
Reduce the number of redundant Earth nutation calculations
by passing astro_time_t values as pointers in more functions.
Nutation values can then be cached in the time parameter
and passed to other functions that can then avoid calculating
the same nutation again.

Nutation is an expensive calculation, so reducing this overhead
can dramatically speed up certain use cases.

This was only needed in C, because this is the only language
in which times are passed by value. In Python, C#, and JavaScript,
times are objects that are already passed by reference, and
they already benefit from this nutation recyling approach.

The following functions have had their parameters changed.
This is a breaking change, but in every case, the caller
usually just needs to change `time` to `&time`.

    Astronomy_Rotation_EQD_EQJ
    Astronomy_Rotation_EQD_ECL
    Astronomy_Rotation_EQD_HOR
    Astronomy_Rotation_EQJ_EQD
    Astronomy_Rotation_EQJ_HOR
    Astronomy_Rotation_ECL_EQD
    Astronomy_Rotation_ECL_HOR
    Astronomy_Rotation_HOR_EQD
    Astronomy_Rotation_HOR_EQJ
    Astronomy_Rotation_HOR_ECL
    Astronomy_RotationAxis
    Astronomy_VectorObserver
2022-01-21 20:59:06 -05:00
Don Cross
111e1acb2b Improved instructions for Windows developers.
For developers wanting to contribute to Astronomy Engine,
the tooling instructions were vague about xsltproc.
I added some useful hints.

I also removed things that don't need to be manually
installed: jsdoc2md, graphviz, etc.
2022-01-19 19:48:05 -05:00
Don Cross
c668ea81e5 Windows: use certutil.exe to validate files.
In Windows builds, I was checking for the existence
of md5sum.exe, and if present, I used it for verifying
downloaded files. However, this is not a standard
utility that comes built into Windows 10.

I found there is a standard utility certutil.exe
that can calculate md5, sha256, etc, checksums.
However, it does not verify files created by the
Linux utilities md5sum, sha256sum, etc.

So I created a batch file checksum.bat that invokes
certutil.exe to process one of those listing files.
Reworked run.bat to call checksum.bat instead of
using md5sum.exe.
2022-01-19 17:49:10 -05:00
Don Cross
ab9b5a5ce5 pip, npm packages 2.0.10.
The pip and npm astronomy-engine packages will have
matching version numbers from now on, starting with
2.0.10.

https://pypi.org/project/astronomy-engine/2.0.10/
https://www.npmjs.com/package/astronomy-engine
2022-01-10 20:34:35 -05:00
Don Cross
378bb4fc4d Merge branch 'pip': support publishing pip package 2022-01-10 20:18:01 -05:00
Don Cross
cba75aa2e4 Fixed #64 - pip package for Astronomy Engine.
Thanks to ebrominio, I was able to create a pip
package for Astronomy Engine. See:

https://pypi.org/project/astronomy-engine/1.0.1/

I will probably need to go back and keep the version
numbers in sync with the matching npm package.
2022-01-10 19:59:25 -05:00
Don Cross
b60b11f86a Merge branch 'master' of https://github.com/ebraminio/astronomy into pip 2022-01-10 19:38:04 -05:00
Don Cross
15fefc4922 Windows CI: Upgrade Doxyfile to eliminate warnings. 2022-01-10 16:54:36 -05:00
Don Cross
fc75276e79 Windows CI: execute verify_clean.bat after run.bat.
From the GitHub Actions logs, it looks like verify_clean.bat
is not running after run.bat, like I intended. I'm guessing I
need to add "call" before both batch files to ensure that
control returns to the caller.
2022-01-10 16:19:58 -05:00
Ebrahim Byagowi
f68c8766dd Add files necessary for pip package upload 2022-01-11 00:34:41 +03:30
Don Cross
884539fde4 Windows CI: attempt downloading and running doxygen. 2022-01-10 16:01:00 -05:00
Don Cross
57a71af403 Windows CI: try using 'py' command to run Python programs.
Weirdly, the python program for generating constellation
data did not seem to run, but that failure did not break
the build directly. I am adding an explicity 'py' command
to run each Python program. Also added a check for missing
output constellation test data.
2022-01-09 22:06:28 -05:00
Don Cross
acf3877e31 Windows CI: turn off doxygen / generating C docs for now. 2022-01-09 21:38:09 -05:00
Don Cross
139fde6fe8 Windows CI: Upgraded Visual Studio target platform of C programs. 2022-01-09 20:42:28 -05:00
Don Cross
27adf8a3e0 Windows CI: second attempt to run msbuild.exe. 2022-01-09 20:09:32 -05:00
Don Cross
4ef515953e Windows CI: attempt to put msbuild.exe in PATH. 2022-01-09 19:57:30 -05:00
Don Cross
7d117f9d8c Windows CI: explicitly end md5 checksum files with LF.
The version of md5sum.exe that runs in GitHub Actions
gets confused when its input file ends with CRLF,
which is weird because this is supposed to be a Windows
environment. So I added a .gitattributes to force
these checksum files to have LF line endings.
2022-01-09 19:46:21 -05:00
Don Cross
e9922a48bb Windows CI: put quotes around executables.
In the GitHub Actions CI environment, the program md5sum.exe
resides in "C:\Program Files\Git\usr\bin\md5sum.exe".
Therefore, to execute it, I need quotes around the executable.
2022-01-09 17:43:46 -05:00
Don Cross
15a330c64d Windows CI: specify cmd instead of PowerShell. 2022-01-09 17:36:38 -05:00
Don Cross
e8aaee2e09 Windows CI: another attempt at multiple commands. 2022-01-09 17:25:25 -05:00
Don Cross
3c3d36bcea Fixed syntax errors in yml 2022-01-09 15:48:57 -05:00
Don Cross
8ad3488b65 Starting to work on GitHub Actions tests for Windows.
I'm certain this will fail, but I at least want to
start creating automated tests for building Astronomy
Engine on Windows.
2022-01-09 15:39:01 -05:00
Don Cross
37c8aeafa9 Moved 'windows' directory away from root.
The 'windows' directory is mainly useful for
maintainers, not end users. So I moved it out of
the root to reduce distraction for a first-time
visitor.

While I was fixing up resulting breakage in
Visual Studio project files, I noticed I still had
some hard-coded absolute paths that would only work
on my own Windows laptop (e.g. "c:\don\github\astronomy").
I replaced those with relative paths that will work
regardless of what directory the repo is cloned into.
2022-01-09 12:55:41 -05:00
Don Cross
b7ac00ed17 Browser demos: fix date parsing for Safari.
Safari does not work when you try to do this in JavaScript:

    const date = new Date('2022-01-08 17:26:59');

Instead, it requires a 'T' between the date and the time:

    const date = new Date('2022-01-08T17:26:59');

Fixed this issue in the moonradar.html and positions.html demos.
We still render the date/time as normal, with the space,
but parse it by replacing the space with 'T'.

Thanks to @ebraminio for reporting this!
2022-01-08 17:24:39 -05:00
Don Cross
e1f22fb743 Fixed #145 - support building on macOS. 2022-01-07 22:14:27 -05:00
Don Cross
15d1312060 Made Jupiter rotation matrix code gen one digit shorter.
This is another attempt to get consistent generated code
between Linux and macOS.
2022-01-07 21:38:41 -05:00
Don Cross
1ace122c9e Consistent generated tables between Linux, macOS.
The code generator was creating slightly different numeric
values for the Pluto state tables and the Jupiter rotation matrix.
I decreased the output precision by one decimal digit.
This should allow the code generator to produce identical
source code on both Linux and macOS.
2022-01-07 21:02:59 -05:00
Don Cross
753554db67 Make demo tests less sensitive to tiny floating point errors.
More work getting MacOS build process to work.
Avoid excessive number of floating point digits of
output in the demo tests, so that insignificant
floating point variations don't cause unit test failures.
2022-01-07 20:19:23 -05:00
Don Cross
cb4c9a6549 Fixed mistake in raytracer. Stop using 'realpath'.
I found a mistake in the raytracer's Spheroid class,
thanks to a warning about an unused member variable.
I don't believe it had any effect on the currently
generated images, but it was important to fix it before
I ever do any set operations on Spheroids.

On macOS, there is no 'realpath' command by default.
So I eliminated some more attempts to use 'realpath'
in the demo test scripts.

Renamed the GitHub Actions tests to be consistent:
    Astronomy-Engine-Linux
    Astronomy-Engine-Macos
2022-01-07 18:30:15 -05:00
Don Cross
515c2802de Merge branch 'master' of https://github.com/ebraminio/astronomy into macos 2022-01-07 17:18:03 -05:00
Don Cross
862889f62f Raytracer: fix build warnings for macOS. 2022-01-07 17:17:25 -05:00
Ebrahim Byagowi
4a0902fa10 CI: Add a macos bot 2022-01-07 12:18:00 +03:30
Ebrahim Byagowi
d36b181044 Mention macOS buildability in generate/README.md 2022-01-07 12:18:00 +03:30
Don Cross
0547aafc2b Made 'camera' demo checks tolerant of floating point roundoff.
The demo tests on Mac OS failed because of very tiny
floating point discrepancies that don't matter.
Changed the output of the "Moon check" so that slight
differences in vector residue no longer fail the unit tests.
2022-01-06 21:25:26 -05:00
Don Cross
cd776e1d39 Mac OS: increased tolerances comparing different language calculations.
Two different people are currently helping me get the
build process working on Mac OS. They both ran into different
amounts of comparison error in the calculations for different
langauges. I updated the 'diffcalc' bash script to have
slightly less strict tolerances, so the unit tests pass.
2022-01-06 20:55:27 -05:00
Don Cross
9775206988 Deleted the unfinished html Jupiter imager. 2022-01-05 20:40:33 -05:00
Don Cross
b50a8fdce2 Merge branch 'jupiter_moons_imager' 2022-01-05 20:35:31 -05:00
Don Cross
6753e6b8e6 Raytracer: Explicitly build astronomy.c as C++.
Based on a discovery made by someone helping me get
Astronomy Engine building on the Mac. In some versions
of g++ (aliased to clang), if you don't explicitly tell
the compiler to treat .c files as C++, it gives a warning
that escalates to an error due to -Werror.

So I added the same fix to the raytracer build:
pass in the option '-x c++'.
2022-01-04 20:03:28 -05:00
Don Cross
58342f97b9 Explicitly build astronomy.c as C++ for C++ test.
When built using g++ as an alias for clang,
as reportedly happens on Mac OS, we need to explicitly
tell g++ (using option '-x c++') to compile astronomy.c
as C++. Otherwise, it will fail with a deprecation warning.
2022-01-04 19:04:56 -05:00
Don Cross
b2f9219b56 Updated copyrights for 2022. 2022-01-04 18:55:20 -05:00