Commit Graph

207 Commits

Author SHA1 Message Date
Don Cross
a9eadee3f1 Fixed #250 - handle years outside 0000..9999. 2022-10-06 22:05:44 -04:00
Don Cross
fde4c2c068 Kotlin: format dates for extreme year values. 2022-10-06 17:52:29 -04:00
Don Cross
4a56f18325 Astronomy Engine version 2.1.4 2022-10-02 22:07:23 -04:00
Don Cross
dc59b55d92 Added more testing of rise/set foreward/backward searches. 2022-10-02 19:58:48 -04:00
Don Cross
6e2229603c Fixed wording, variable names in unit tests. 2022-10-02 12:33:20 -04:00
Don Cross
a3337348f5 Kotlin: better forward/reverse moon phase tests.
In the unit tests for searching forward and backward
for moon phases, in addition to new moons, also test
first quarter, full moon, and third quarter.

Verify that forward and backward searches work for
100 start times between a single pair of consecutive events.
2022-10-02 10:49:36 -04:00
Don Cross
b91b1d905f Python: Reverse chrono search for rise/set, hour angles.
The following Python functions now support searching
in forward or reverse chronological order:

    SearchRiseSet
    SearchAltitude
    SearchHourAngle

Made some minor performance improvements to the
other implementations: return sooner if we
go past time window.
2022-10-01 21:44:04 -04:00
Don Cross
c1759b081a Kotlin: Reverse chrono search for rise/set, hour angles.
The following Kotlin functions now support searching
in forward or reverse chronological order:

    searchRiseSet
    searchAltitude
    searchHourAngle
2022-10-01 11:26:03 -04:00
Don Cross
53b4b33958 Kotlin searchMoonPhase: allow searching backward in time.
Enhanced the Kotlin function searchMoonPhase
to allow searching forward in time when the `limitDays`
argument is positive, or backward in time when `limitDays`
is negative.

Added unit test "moon_reverse" to verify this new feature.
2022-09-26 22:07:47 -04:00
Don Cross
18a0c5613d Increase JVM memory allowance for Gradle.
I encountered a build/test failure in the Kotlin
code due to the JVM running out of memory.
I configured gradle to allow using more memory:
1GB instead of the default 256MB.
2022-09-22 11:08:40 -04:00
Don Cross
d21ce79976 Updated version number to 2.1.3. 2022-09-22 10:25:47 -04:00
Don Cross
afd6f4835f Kotlin: reworked VSOP model selector as a function. 2022-09-10 16:20:03 -04:00
Ebrahim Byagowi
8ed7de7923 Resolve cyclic dependency of Body.vsopModel
Definition of vsopModel constant on Body enum items constructors
makes cyclic dependency with constants defined later in the code
and makes application crash when things are not initiated in the
correct order.

This fixes the issue by turning vsopModel into a property which
will have almost the same internal API for the rest of the code
and resolves crashes I'm getting when certain part of my app
is initiated sooner than usual.
2022-09-10 14:31:40 +04:30
Don Cross
476fb794c4 Fixed #217 - generic light travel correction.
Bumped version to 2.1.2.
2022-06-01 20:21:19 -04:00
Don Cross
b7979cb7a0 Light travel correction: improved documentation. 2022-06-01 19:25:48 -04:00
Don Cross
5e7162f08d GeoVector must return observation time.
Fixed 3 of the language implementations where I forgot
to make GeoVector return the observation time, not the
backdated time. This is important to preserve existing
behavior.
2022-05-31 21:26:03 -04:00
Don Cross
409451b3c2 Kotlin: light travel time correction. 2022-05-31 20:52:41 -04:00
Don Cross
b4f485eecc Bumped version to 2.1.1. 2022-05-25 21:37:10 -04:00
Don Cross
f02658d63c More documentation fixes.
Corrected a mistake in the explanation of the
C function Astronomy_GravSimInit: the `bodyStates`
parameter is NOT barycentric -- it is relative to the
originBody parameter.

Python had improperly formatted documentation for
Time.FromTerrestrialTime parameter `tt`.

The Python markdown generator `pydown` did not
correctly handle links to compound symbols like
`#GravitySimulator.Update`. It also was trying
to link to `StateVector[]` instead of `StateVector`.

Removed unnecessary and unhelpful documentation
for C# internal class constructors. They do not appear
in the generated markdown documentation anyway.

Other minor wording revisions in the documentation.
2022-05-25 14:12:55 -04:00
Don Cross
9c65a27eb1 Improved documentation for gravity simulator.
Added mention of the gravity simulator in the topic
index sections of the markdown docs.
Slight wording changes here and there.
2022-05-23 21:54:00 -04:00
Don Cross
4303137c0a PY gravsim: initial coding completed
Finished coding the Python version of the gravity simulator.
No unit tests have been written yet.
Cleaned up documentation in the other languages.
Made some functions static that did not need to be members.
2022-05-22 09:41:44 -04:00
Don Cross
26575066fc JS gravsim: work in progress.
Mostly coded, but unit tests not written yet.
2022-05-18 19:52:11 -04:00
Don Cross
f014d13910 C# gravsim: finished implementation.
Unit tests are complete and verified for the C# gravity simulator.
I found and fixed one bug in the GravitySimulator constructor.
2022-05-17 17:20:30 -04:00
Don Cross
019a8f51d4 C# gravsim: first draft of GravitySimulator.Update
Wrote the C# version of GravitySimulator.Update.
Not yet tested.
2022-05-17 15:12:53 -04:00
Don Cross
6a5d04b825 C# gravsim: work in progress
Starting the C# version of class GravitySimulator.
There are no unit tests for it yet.

Added a fix to the C# markdown generator `csdown`
to show `void` as a function return type.
This is the first time I have had any function
in the C# version of Astronomy Engine that has
a void return type!

Fixed and improved documentation in the Kotlin version
of the gravity simulator. Fixed some comments too.
2022-05-17 10:31:42 -04:00
Don Cross
f40b96c237 Kotlin gravsim: finished unit tests.
The Kotlin version of class GravitySimulator is working.
Finished the same unit tests that are present in the C
version of the gravity simulator.
2022-05-15 21:44:22 -04:00
Don Cross
28698cdd6b Kotlin gravsim: some unit tests passing. 2022-05-15 21:08:04 -04:00
Don Cross
b30a54587f Kotlin gravsim: more work in progress.
Added the function GravitySimulator.update().
Not yet tested.
2022-05-15 17:28:18 -04:00
Don Cross
efb59436c1 Kotlin gravsim: work in progress
Started implementing class GravitySimulator,
but it is not finished yet.
2022-05-15 05:02:38 -04:00
Don Cross
5676049596 Kotlin: added iterator helper functions
Added the following iterator functions that wrap
search/next pairs of functions:

    globalSolarEclipsesAfter
    localSolarEclipsesAfter
    lunarApsidesAfter
    lunarEclipsesAfter
    moonNodesAfter
    moonQuartersAfter
    planetApsidesAfter
    transitsAfter

I updated the following Kotlin demos:

    MoonPhase.kt    ==> moonQuartersAfter
    LunarEclipse.kt ==> lunarEclipsesAfter

However, I have not yet figured out how to use these
functions in the corresponding Java demos.
2022-05-06 21:52:27 -04:00
Don Cross
ac7bc9c919 Kotlin: Jupiter's moons returned by name
It makes more sense to report Jupiter's moons with
individually named structure fields rather than an array.
It reduces the overall code and documentation size,
and outside of unit testing, there are few cases
where iterating over an array of moons is more
lucid than using the names of the moons.

This is a breaking change, but hopefully very few
developers are using this function yet.
Fixing the breakage is very simple.
2022-05-05 13:01:19 -04:00
Don Cross
f6cb94d53c Deleted obsolete files. 2022-05-04 21:35:02 -04:00
Don Cross
0151df1b83 Update Kotlin main README, insert version.
Automatically copy the version number from the gradle
settings file into the README. Cleaned up the README.
2022-05-04 21:14:49 -04:00
Don Cross
bdb28eee2e Kotlin demo: rise/set/culmination
Added Kotlin demo to search for rise/set/culmination
of the Sun and Moon.

Enhanced the Time class to allow it to be
directly compared and sorted.
2022-05-03 21:09:56 -04:00
Ebrahim Byagowi
c24d49f742 jvm: Upgrade Java language version to 11 2022-05-03 21:57:57 +04:30
Don Cross
1e84f4940f Demo jupiter_moons for Kotlin, Java.
Added Kotlin and Java demos for calculating Jupiter's moons.
Illustrates correcting for light travel time.
I added named getters for the 4 moons in `JupiterMoonsInfo`,
because in Java it was really ugly to write
`jm.getMoon()[0]`, etc.
2022-05-02 15:45:10 -04:00
Don Cross
f670ae2127 Added Kotlin demo: jupiter_moons.
I had to add a new method `Vector.withTime` to work around
the error checking that throws an exception if vectors
from different times are added.

Also made Kotlin constants public:

    MINUTES_PER_DAY
    SECONDS_PER_DAY
    MILLISECONDS_PER_DAY
2022-05-02 14:57:16 -04:00
Ebrahim Byagowi
962b9c7c9c kotlin: Revert and use arrayOf directly
Direct use of arrayOf can be a bit more efficient than calling map and toTypedArray.

It could be faster if JupiterMoonsInfo was holding a list but better to use direct
typed array initializer for more efficiency.
2022-04-28 19:10:35 +04:30
Ebrahim Byagowi
abd48a3e2b kotlin: Use hashMapOf instead mutableMapOf
mutableMapOf guarantees order of insertion and hashMapOf don't and
as it doesn't matter here let's use that instead.
2022-04-28 18:58:39 +04:30
Don Cross
462f172e6d Kotlin: restored original series calculations.
Changing series calculations to use `sumOf` caused
test failures for Jupiter's moons, compared to the other
languages. I don't understand why, but it is losing about
5 decimal places of accuracy:

    First  file: temp/c_check.txt
    Second file: temp/k_check.txt
    Tolerance = 6.700e-15

                lnum                 a_value                 b_value     factor       diff  name
      OK       59558 -3.7992709399390907e-04 -3.7992709399390658e-04  411.52263  1.026e-15  helio_x
      OK       70088 -1.2672603312645981e-03 -1.2672603312646005e-03  411.52263  9.816e-16  helio_y
      OK      122819  1.0937502621531685e-04  1.0937502621531790e-04  411.52263  4.294e-16  helio_z
      OK        2427  2.0269124415104024e+01  2.0269124415104031e+01    0.01730  1.229e-16  sky_j2000_ra
      OK       96711 -1.3269907232295576e+01 -1.3269907232295552e+01    0.00556  1.382e-16  sky_j2000_dec
      OK      321094  1.9426425943521761e+00  1.9426425943521755e+00    2.61780  1.744e-15  sky_j2000_dist
      OK      302748  3.5388201408771312e+02  3.5388201408771533e+02    0.00275  6.086e-15  sky_hor_az
      OK      121119 -2.2454039277279009e+01 -2.2454039277279151e+01    0.00556  7.895e-16  sky_hor_alt
    FAIL      462886  3.2838700693197847e-05  3.2838701021405780e-05  354.60993  1.164e-10  jm_x
    FAIL       18898  4.1298198258838197e-05  4.1298197961707834e-05  354.60993  1.054e-10  jm_y
    FAIL       18898  6.5401658638156675e-05  6.5401658496812707e-05  354.60993  5.012e-11  jm_z
    FAIL       18898 -1.9369714715980919e-04 -1.9369714599049137e-04  100.00000  1.169e-10  jm_vx
    FAIL      462886  2.0741129523130840e-04  2.0741129628185288e-04  100.00000  1.051e-10  jm_vy
    FAIL      462886 -7.0200557604537683e-05 -7.0200557103467577e-05  100.00000  5.011e-11  jm_vz

    Score = 1.169e-10
    ctest(Diff): EXCEEDED ERROR TOLERANCE.

Restored the original loop logic and now it is back within tolerance:

    First  file: temp/c_check.txt
    Second file: temp/k_check.txt
    Tolerance = 6.700e-15

                lnum                 a_value                 b_value     factor       diff  name
      OK       59558 -3.7992709399390907e-04 -3.7992709399390658e-04  411.52263  1.026e-15  helio_x
      OK       70088 -1.2672603312645981e-03 -1.2672603312646005e-03  411.52263  9.816e-16  helio_y
      OK      122819  1.0937502621531685e-04  1.0937502621531790e-04  411.52263  4.294e-16  helio_z
      OK        2427  2.0269124415104024e+01  2.0269124415104031e+01    0.01730  1.229e-16  sky_j2000_ra
      OK       96711 -1.3269907232295576e+01 -1.3269907232295552e+01    0.00556  1.382e-16  sky_j2000_dec
      OK      321094  1.9426425943521761e+00  1.9426425943521755e+00    2.61780  1.744e-15  sky_j2000_dist
      OK      302748  3.5388201408771312e+02  3.5388201408771533e+02    0.00275  6.086e-15  sky_hor_az
      OK      121119 -2.2454039277279009e+01 -2.2454039277279151e+01    0.00556  7.895e-16  sky_hor_alt
      OK       92717  4.1268347083494783e-03  4.1268347083494774e-03  223.21429  1.936e-16  jm_x
      OK       45091 -8.0149190392649894e-03 -8.0149190392649929e-03   79.42812  2.756e-16  jm_y
      OK      135377  1.5470777280065808e-03  1.5470777280065804e-03  223.21429  9.680e-17  jm_z
      OK      216836  4.5725777238332412e-03  4.5725777238332394e-03  126.58228  2.196e-16  jm_vx
      OK      351647  5.1351566793199944e-03  5.1351566793199962e-03  126.58228  2.196e-16  jm_vy
      OK      351647  2.5217607180929289e-03  2.5217607180929298e-03  126.58228  1.098e-16  jm_vz

    Score = 6.086e-15
2022-04-27 21:18:29 -04:00
Ebrahim Byagowi
7ab343e7d4 kotlin: Avoide code duplication in jupiterMoons by using map 2022-04-28 03:42:01 +04:30
Ebrahim Byagowi
474cffccac kotlin: Use sumOf where possible
As sumOf is inline in Kotlin it supposed to have the same performance.
2022-04-28 02:42:23 +04:30
Ebrahim Byagowi
6789c64343 kotlin: Use idiomatic way to create mutable objects 2022-04-28 01:57:38 +04:30
Ebrahim Byagowi
2fe4c8abf4 kotlin: Use single format instead multiple calls 2022-04-28 01:37:35 +04:30
Ebrahim Byagowi
d2485392c3 kotlin: Use getOrPut to facilitate use of cache 2022-04-28 01:19:36 +04:30
Don Cross
53f5540f09 Kotlin: cleanup of code and documentation.
Used IntelliJ IDEA's linter to perform code cleanup.
There were unused variables, `var` that could be replaced with `val`,
and other minor code style issues.

While doing this, I also discovered that a lot of documentation
links were broken. The fix is to stop intenting the text after
a `@param`.
2022-04-27 14:04:42 -04:00
Don Cross
b93719146b Set version numbers to 2.1.0.
In anticipation of releasing the Kotlin version,
I set the version numbers for the following to 2.1.0:

    Kotlin
    Node.js / npm
    Python / pip

The intention is to keep matching releases of
Astronomy Engine at a common version number.
2022-04-26 15:58:27 -04:00
Don Cross
565bac127a Kotlin docs: link to body enum values.
When documentation refers to a Body value, e.g. Body.Earth,
link to its information page. I'm not sure this is super helpful,
but it is an attempt to provide better linking.

Added more explanatory text about the SSB and EMB values.
I found that a blank line splits the extra text onto the
dedicated pages for SSB and EMB, while leaving the "brief"
description on the list of all Body enum values. That is nice.
2022-04-25 20:43:41 -04:00
Don Cross
4c34245c01 Kotlin doc cleanup: removed more 'jvm' tags.
I found that there were a bunch of lingering 'jvm'
tags in the generated markdown documentation.
Got rid of them with another change to format_kotlin_doc.py.
2022-04-25 17:16:46 -04:00
Don Cross
d130405d13 Kotlin docs: more enum cleanup.
I missed a couple of places where I want to remove
private constructor calls from enum members.
Also, discard [name] and [ordinal] links while preserving
other properties that are intentionally exposed.
2022-04-25 16:51:25 -04:00