Commit Graph

536 Commits

Author SHA1 Message Date
Don Cross
67dd5dc691 Attempt to make GitHub Actions run the same python I told it to install.
It looks like I have been running an unintended version of Python
from GitHub Actions.  In Linux/Mac I used `python3`, and in Windows
I used `py`. It appears that I should be executing `python` in
all 3 operating systems.

This is an experiment to see if I can get everyone on the same page.
2024-05-30 12:57:43 -04:00
Don Cross
9c5f98981a Some versions of Python do not allow hypot to have more than 2 arguments. 2024-05-27 18:01:44 -04:00
Don Cross
7c475fcada Expanded the fix for issue #347.
I tried more distant objects like Jupiter ... Neptune.
This revealed that at increasing distances, the convergence
threshold in inverse_terra needed to increased also.
So now I use 1 AU as a baseline, and scale up linearly
for more distant objects.
2024-05-27 17:07:30 -04:00
Don Cross
0309762a64 Fixed #347 - Relaxed convergence criteria for inverse_terra functions.
Asking the latitude and longitude directly beneath
the Sun causes inverse_terra not to converge, because the
convergence increment `W` never got below 1.48e-8, but the
convergence limit was 1.0e-8. I increased the limit to 2.0e-8
in all programming language versions.

I'm hoping that is a big enough tolerance for all cases now,
but I will do more testing to see if further fixes are required
for even more distant bodies than the Sun.
2024-05-27 16:20:45 -04:00
Don Cross
898276e130 Update copyrights, move AstroTime notes to correct file, copyediting. 2024-05-26 16:30:43 -04:00
Don Cross
520a532531 Test Python demos in Windows also.
Before now, the Python demos were tested in Linux and Mac.
Now they are tested in the Windows environment also.
This will be helpful for any contributors who may wish
to use Windows as a development platform for the Python
version of Astronomy Engine.
2023-10-03 13:41:05 -04:00
Don Cross
871c26abde Enforce strict type checking in all Python demo programs.
Use mypy to check all Python demo programs.
Updated the demos to pass type checking.
There were a couple of small mistakes found, so this was worth the effort.
2023-10-03 11:49:04 -04:00
Don Cross
bbaf5bf544 Added Python demo: solar_eclipse.py
This demo calculates the next 10 solar eclipses that are
visible from a given location on the Earth, after a given date.
2023-10-03 11:17:32 -04:00
Don Cross
c7095c5038 Added Python demo ecliptic_of_date.
The demo program ecliptic_of_date.py shows how to
calculate the true ecliptic of date (ECT) angular coordinates
of the Sun, Moon, and planets for an observer somewhere on the Earth.
It calculates the equatorial of date (EQD) coordinates, then uses
a rotation matrix to convert the vector to ECT, then converts
the vector to spherical coordinates: latitude, longitude, and distance.
2023-10-02 16:36:56 -04:00
Don Cross
9975edc81b Updated star database to HYG v 3.6.1. 2023-09-21 15:41:03 -04:00
Don Cross
f4405e390c Updated star database to HYG v 3.5.1.
This change affects internal unit testing only.
It does not affect developers who use Astronomy Engine.
Upgraded the HYG database used for verification of
constellation calculations to v 3.5.1.

See conversation at:
https://github.com/astronexus/HYG-Database/issues/21
2023-09-19 15:08:49 -04:00
Don Cross
054985606e Revert "Use _FORTIFY_SOURCE=3 to improve C/C++ code verification."
This reverts commit a7e747c100.
This broke the GitHub Actions automated tests, because they
are using gcc 11 (which does not support level 3 fortification),
and they already predefine another fortification level.

I realize this would also hinder other contributors who
are not using gcc 12. At least I tried it once on my own
system and didn't find any problems, which is nice.
2023-09-11 15:02:14 -04:00
Don Cross
a7e747c100 Use _FORTIFY_SOURCE=3 to improve C/C++ code verification. 2023-09-11 14:48:44 -04:00
Don Cross
8dc66a8610 Fixed search failure in moon_north_south.js demo.
It was possible for certain starting times to have a search
failure in this demo, because it could place more than
one zero-crossing of the function in the same time interval.
So now we iterate over an interval of 10 days at a time
until we find the solution.
2023-08-23 13:55:35 -04:00
Don Cross
4007023422 Forgot to include JPL Horizons batch data.
I wanted to record the exact settings I used
to generate the JPL Horizons data used to verify
my calculations of the Moon's extreme declinations.
2023-08-22 21:33:07 -04:00
Don Cross
cea0158558 Added JS demo: moon_north_south.
This demo shows how to search for the next time
the Moon reaches extreme ecliptic latitude or
extreme declination. In other words, it finds
when the Moon reaches the farthest north or south,
expressed in either ecliptic coordinates or equatorial
coordinates.

Both angles are measured using the Earth's equator of date.
2023-08-22 21:30:40 -04:00
Don Cross
63ed3746b2 Misc fixes for Raspberry Pi 4 build.
On the Raspberry Pi 4, using latest versions of cppcheck
and pylint, a few more minor fixes were needed for eliminating
warnings.

Also had to soften a tolerance for the Kotlin unit tests.
2023-06-19 16:28:34 -04:00
Don Cross
bb27adfdfa Update C# demo/test projects to dotnet core 7. 2023-06-18 21:04:33 -04:00
Don Cross
fda8426972 Another attempt to build altazsearch.cpp on Mac OS. 2023-06-18 17:44:02 -04:00
Don Cross
890fcf8d3e Fix build problem for altazsearch.cpp on Mac.
The following build error occurred in Mac OS:

Compiling altazsearch.cpp
clang: error: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Werror,-Wdeprecated]

Added options to explicitly perform mixed C/C++ programming.
2023-06-18 17:05:07 -04:00
Don Cross
33de407723 Added C++ demo for alt/az window search.
See the following discussion for context:

https://github.com/cosinekitty/astronomy/discussions/308

Added a demo program that shows how to search for when
a body enters a window defined in terms of an observer's
horizontal frame of reference, given a range of altitudes
and a range of azimuths.
2023-06-18 16:14:52 -04:00
Don Cross
9ab7767a57 Document camera demos and include image to explain the angles. 2023-03-25 11:40:02 -04:00
Don Cross
0be053325a Fixed bug in camera.py demo: incorrect angle for sunlit side of Moon. 2023-03-24 22:06:45 -04:00
Don Cross
f424bc14b5 Fixed bug in camera.js demo: incorrect angle for sunlit side of Moon. 2023-03-24 22:00:45 -04:00
Don Cross
da900c6793 Fixed C# camera demo bug: incorrect sunlit angle of Moon. 2023-03-24 21:55:07 -04:00
Don Cross
591ad2b11a Fixed bug in demo: camera.c
The camera demos all have a bug where I was calculating
the angle of the sunlit side of the Moon incorrectly.
The arguments to atan2 were backwards.
Added test data for Florida, New Zealand, and Canada
that are backed up by photographic evidence and
my first-hand observation.
2023-03-24 21:46:41 -04:00
Don Cross
c85881c25b Python: added metersAboveGround parameter to SearchRiseSet. 2023-03-13 20:42:46 -04:00
Don Cross
6c59d14bd4 Python: added Atmosphere function. 2023-03-13 16:16:53 -04:00
Don Cross
8c55fbad79 JS: Added metersAboveGround parameter to SearchRiseSet. 2023-03-13 13:06:37 -04:00
Don Cross
66cd0147b5 JS: Added Atmosphere function. 2023-03-13 09:54:54 -04:00
Don Cross
7e196a3c17 Fixed Windows batch files ignoring negative integer failure codes.
In many of my Windows batch files, I used the following
construct to detect failures:

    do_something
    if errorlevel 1 (
        echo.An error occurred in do_something
        exit /b 1
    )

I discovered that it is possible for a Windows program
to exit with a negative integer error code.
This causes the above construct to miss the failure
and the batch file blithely continues.

So I have replaced that construct with

    do_something || (
        echo.An error occurred in do_something
        exit /b 1
    )

This way, if the command exits with any nonzero error,
we correctly detect it as a failure.
2023-02-26 10:26:42 -05:00
Don Cross
503538da12 PY: Fixed calendar/time conversion functions for extreme year values.
Applying the same recent fixes to C and C# to the Python code.

I'm also changing my philosophy of representing times.
From now on, they will be truncated to the floor millisecond,
not rounded to the nearest millisecond. This means we don't reach
another calendar date until we have had 60 full seconds after
the last minute. Otherwise there is too much nasty logic for
rounding up calendar dates. I will follow suit across all languages.
2023-02-25 22:37:58 -05:00
Don Cross
7e17705801 PY: Fixed calendar calculations for extreme year values. 2023-02-25 14:20:55 -05:00
Don Cross
4ab4b0bb6e Fixed #259 - JS documentation is usable for CorrectLightTravel function.
Replace the abstract class with a parameter of function type.
This allows the documentation to fully explain how to use
`CorrectLightTravel` without having to look at the code.
2023-02-23 18:01:51 -05:00
Don Cross
b686b6185c Escalated mypy to use --strict option.
Use --strict in mypy to perform maximum type checking.
Fixed the remaining errors.
2023-02-21 15:34:52 -05:00
Don Cross
513d1f0f17 Python: reordered things to reduce forward type declarations. 2023-02-21 13:17:43 -05:00
Don Cross
cd8f9e9f4c Improved Python table for Jupiter moon models.
Updated the code generator so the Python version of
the Jupiter moon tables has better type checking
and is easier to understand.
2023-02-21 12:17:35 -05:00
Don Cross
23b45dd075 Improved Pluto state table in Python code.
The generated code for the Pluto state table in Python
now uses a class `_pstate` for better type checking.
It also makes the code easier to understand.
Moved class _TerseVector higher in the source file to
reduce the need for quoted forward type declarations.
2023-02-21 10:56:05 -05:00
Don Cross
a530069e99 Improved Python VSOP table generation.
The VSOP table generator for Python now is now
better type-checked using classes and tuples.
This also makes the code easier to understand.
2023-02-21 10:12:45 -05:00
Don Cross
f849c11258 Require type hints for all Python functions.
I added the mypy option `--disallow-untyped-defs` to fail
any function lacking complete type hints.
Then I fixed all the resulting errors.

I ended up changing the Python code generator to create
some tuple types instead of list, because it is possible
to write stricter type checks that way. This was in
the Pluto and Jupiter Moon tables.
I still should come back and do the same thing for the VSOP tables.

The type checking revealed a couple of places where I wasn't
checking for a search failure. I fixed those too.
2023-02-20 20:04:10 -05:00
Don Cross
afe1498917 Merge branch 'python_type_hints' 2023-02-20 11:47:59 -05:00
Don Cross
981cafd427 Node.js demo that shows how to calculate drift of the vernal point. 2023-02-20 11:38:09 -05:00
Don Cross
fc408501c5 Fix for dotnet command no longer allowing --output on solution files.
The `dotnet` command no longer allows using `--output` to specify the
output directory for building a solution file:
https://github.com/dotnet/sdk/issues/15607

This broke my GitHub Actions tests for C#.

I used the following workaround, because in my case I
know merging multiple builds into one directory is safe:
https://github.com/dotnet/sdk/issues/30624#issuecomment-1432118204
2023-02-19 17:13:05 -05:00
ris-tlp
66c3ebbc33 Fix PR reviews 2023-02-18 15:45:06 -05:00
ris-tlp
43be952eb2 Python: Type Hints Integration - 6 2023-02-18 03:58:01 -05:00
ris-tlp
e7f8f2b8e2 Python: Type Hints Integration - 5 2023-02-18 03:26:35 -05:00
ris-tlp
0d4c438c2b Python: Type Hints Integration - 4 2023-02-18 02:46:04 -05:00
ris-tlp
d055cb9fe8 Python: Type Hints Integration - 3 2023-02-16 01:12:09 -05:00
ris-tlp
92d266fc3a Python: Type Hints Integration - 2 2023-02-15 02:07:43 -05:00
ris-tlp
6bb781146b Python: Type Hints Integration - 1 2023-02-13 22:56:10 -05:00