astronoby 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/CHANGELOG.md +87 -3
  4. data/README.md +56 -32
  5. data/UPGRADING.md +50 -21
  6. data/docs/README.md +196 -0
  7. data/docs/angles.md +137 -0
  8. data/docs/celestial_bodies.md +107 -0
  9. data/docs/configuration.md +98 -0
  10. data/docs/coordinates.md +167 -0
  11. data/docs/ephem.md +85 -0
  12. data/docs/equinoxes_solstices_times.md +31 -0
  13. data/docs/glossary.md +152 -0
  14. data/docs/instant.md +139 -0
  15. data/docs/moon_phases.md +79 -0
  16. data/docs/observer.md +65 -0
  17. data/docs/reference_frames.md +138 -0
  18. data/docs/rise_transit_set_times.md +119 -0
  19. data/docs/twilight_times.md +123 -0
  20. data/lib/astronoby/bodies/earth.rb +8 -2
  21. data/lib/astronoby/bodies/jupiter.rb +17 -0
  22. data/lib/astronoby/bodies/mars.rb +17 -0
  23. data/lib/astronoby/bodies/mercury.rb +21 -0
  24. data/lib/astronoby/bodies/moon.rb +29 -36
  25. data/lib/astronoby/bodies/neptune.rb +21 -0
  26. data/lib/astronoby/bodies/saturn.rb +26 -0
  27. data/lib/astronoby/bodies/solar_system_body.rb +139 -29
  28. data/lib/astronoby/bodies/sun.rb +25 -2
  29. data/lib/astronoby/bodies/uranus.rb +5 -0
  30. data/lib/astronoby/bodies/venus.rb +25 -0
  31. data/lib/astronoby/cache.rb +188 -0
  32. data/lib/astronoby/configuration.rb +92 -0
  33. data/lib/astronoby/constants.rb +4 -1
  34. data/lib/astronoby/constellation.rb +12 -0
  35. data/lib/astronoby/constellations/data.rb +42 -0
  36. data/lib/astronoby/constellations/finder.rb +35 -0
  37. data/lib/astronoby/constellations/repository.rb +20 -0
  38. data/lib/astronoby/coordinates/equatorial.rb +3 -3
  39. data/lib/astronoby/data/constellations/constellation_names.dat +88 -0
  40. data/lib/astronoby/data/constellations/indexed_abbreviations.dat +88 -0
  41. data/lib/astronoby/data/constellations/radec_to_index.dat +238 -0
  42. data/lib/astronoby/data/constellations/sorted_declinations.dat +202 -0
  43. data/lib/astronoby/data/constellations/sorted_right_ascensions.dat +237 -0
  44. data/lib/astronoby/equinox_solstice.rb +2 -2
  45. data/lib/astronoby/events/moon_phases.rb +15 -14
  46. data/lib/astronoby/events/rise_transit_set_calculator.rb +32 -8
  47. data/lib/astronoby/events/twilight_calculator.rb +115 -60
  48. data/lib/astronoby/events/twilight_events.rb +28 -0
  49. data/lib/astronoby/instant.rb +7 -2
  50. data/lib/astronoby/julian_date.rb +78 -0
  51. data/lib/astronoby/mean_obliquity.rb +8 -10
  52. data/lib/astronoby/nutation.rb +11 -3
  53. data/lib/astronoby/observer.rb +1 -1
  54. data/lib/astronoby/precession.rb +48 -38
  55. data/lib/astronoby/reference_frame.rb +2 -1
  56. data/lib/astronoby/reference_frames/apparent.rb +1 -1
  57. data/lib/astronoby/reference_frames/mean_of_date.rb +1 -1
  58. data/lib/astronoby/reference_frames/topocentric.rb +1 -11
  59. data/lib/astronoby/time/greenwich_sidereal_time.rb +2 -2
  60. data/lib/astronoby/true_obliquity.rb +2 -3
  61. data/lib/astronoby/util/time.rb +1 -1
  62. data/lib/astronoby/version.rb +1 -1
  63. data/lib/astronoby.rb +8 -1
  64. metadata +59 -11
  65. data/Gemfile +0 -5
  66. data/Gemfile.lock +0 -102
  67. data/benchmark/README.md +0 -131
  68. data/benchmark/benchmark.rb +0 -259
  69. data/benchmark/data/imcce.csv.zip +0 -0
  70. data/benchmark/data/sun_calc.csv.zip +0 -0
  71. data/lib/astronoby/epoch.rb +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3406973da55433c82cd985454453f570220feb119f8274176ed8ab0539a8c99d
4
- data.tar.gz: c4094d2e8a6d9be6c93ef0c48a8202cec8fe8e6a8f12197f9ee930b18b1e1302
3
+ metadata.gz: e26fab1e74e0fa27c784712cb44a5557c553c1104752eb5e63ddda0c48a95b52
4
+ data.tar.gz: cfb3e98fc8a4f841b144a0ae2ea435ea764d7eafb85f150a0e3cc7495af3218e
5
5
  SHA512:
6
- metadata.gz: 49156fb3ade1cc6b3d15120e4942c0a798b00fdff3b35024cf3ffe8f1bf9c8d7f1eeae40d457485ae3a225e418fa5f8e5c4bc95e826ed14b3ff26b71b2fa6200
7
- data.tar.gz: cee4783838c39d8df122dc5542cc52eee1527aa37a6fab493759c58a89686b0bc2b9cc547cbec2bd6feaee2a46bc094a72dba0a372719a4875355d1af8440f00
6
+ metadata.gz: 43b7bdbd274fc42b1c1c992a677abf71dc831e727abb2bf78b93190595a4746a07f266affececa6e495a534eda304164422623a09673fe779c9b1064be9d11d0
7
+ data.tar.gz: b8a3dcd0992c55606c6e13b4f7783325268a1168d26343ac6a20d050514ca7b30b4fd3548a2903db5abfcbb8133efe79ae7868681cdcba8b61d284862f1f423c
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.4.3
1
+ 3.4.4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,89 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.0 - 2025-09-01
4
+
5
+ _If you are upgrading: please see [UPGRADING.md]._
6
+
7
+ ### Bug fixes
8
+
9
+ * Fix UPGRADING documentation ([#178])
10
+ * Fix possible division by zero in RTS ([#185])
11
+
12
+ ### Features
13
+
14
+ * Introduce performance benchmark ([#183])
15
+ * Cache positions in RTS calculator ([#182])
16
+ * Internal global LRU cache ([#186])
17
+ * Global configuration ([#187])
18
+ * Compute the constellation a body is in ([#199])
19
+ * Add `#phase_angle` and `#illuminated_fraction` to planets ([#200])
20
+ * Apparent magnitude ([#201])
21
+ * Add #events_between to TwilightCalculator with better accuracy ([#204])
22
+ * `#angular_diameter` on Solar System bodies ([#207])
23
+ * Fix constellation boundaries near 24h right ascension ([#209])
24
+
25
+ ### Improvements
26
+
27
+ * Bump standard from 1.49.0 to 1.50.0 by @dependabot ([#177])
28
+ * Bump ephem from 0.3.0 to 0.4.1 by @dependabot ([#181], [#191])
29
+ * Bump irb from 1.14.3 to 1.15.2 by @dependabot ([#184])
30
+ * Bump rspec from 3.13.0 to 3.13.1 by @dependabot ([#188])
31
+ * Bump benchmark from 0.4.0 to 0.4.1 by @dependabot ([#189])
32
+ * Bump rake from 13.2.1 to 13.3.0 by @dependabot ([#190])
33
+ * Bump matrix from 0.4.2 to 0.4.3 by @dependabot ([#193])
34
+ * Update rubyzip requirement from ~> 2.3 to ~> 3.0 by @dependabot ([#194])
35
+ * Bump rubyzip from 3.0.0 to 3.0.2 by @dependabot ([#202], [#206])
36
+ * Exclude benchmarks from release ([#196])
37
+ * `Epoch` refactoring into `JulianDate` ([#197])
38
+ * Support Ruby 3.4.4 ([#198])
39
+ * Bump actions/checkout from 4 to 5 ([#203])
40
+ * Internal documentation ([#205])
41
+
42
+ ### Backward-incompatible changes
43
+
44
+ * `Epoch` refactoring into `JulianDate` ([#197])
45
+ * `#angular_diameter` on Solar System bodies ([#207])
46
+ * Rename "epoch" ([#208])
47
+
48
+ ### Closed issues
49
+
50
+ * Consider adding typical usage/deployment info ([#179])
51
+ * Performance degradation in v0.7 ([#180])
52
+
53
+ **Full Changelog**: https://github.com/rhannequin/astronoby/compare/v0.7.0...v0.8.0
54
+
55
+ [#177]: https://github.com/rhannequin/astronoby/pull/177
56
+ [#178]: https://github.com/rhannequin/astronoby/pull/178
57
+ [#179]: https://github.com/rhannequin/astronoby/pull/179
58
+ [#180]: https://github.com/rhannequin/astronoby/pull/180
59
+ [#181]: https://github.com/rhannequin/astronoby/pull/181
60
+ [#182]: https://github.com/rhannequin/astronoby/pull/182
61
+ [#183]: https://github.com/rhannequin/astronoby/pull/183
62
+ [#184]: https://github.com/rhannequin/astronoby/pull/184
63
+ [#185]: https://github.com/rhannequin/astronoby/pull/185
64
+ [#186]: https://github.com/rhannequin/astronoby/pull/186
65
+ [#187]: https://github.com/rhannequin/astronoby/pull/187
66
+ [#188]: https://github.com/rhannequin/astronoby/pull/188
67
+ [#189]: https://github.com/rhannequin/astronoby/pull/189
68
+ [#190]: https://github.com/rhannequin/astronoby/pull/190
69
+ [#191]: https://github.com/rhannequin/astronoby/pull/191
70
+ [#193]: https://github.com/rhannequin/astronoby/pull/193
71
+ [#194]: https://github.com/rhannequin/astronoby/pull/194
72
+ [#196]: https://github.com/rhannequin/astronoby/pull/196
73
+ [#197]: https://github.com/rhannequin/astronoby/pull/197
74
+ [#198]: https://github.com/rhannequin/astronoby/pull/198
75
+ [#199]: https://github.com/rhannequin/astronoby/pull/199
76
+ [#200]: https://github.com/rhannequin/astronoby/pull/200
77
+ [#201]: https://github.com/rhannequin/astronoby/pull/201
78
+ [#202]: https://github.com/rhannequin/astronoby/pull/202
79
+ [#203]: https://github.com/rhannequin/astronoby/pull/203
80
+ [#204]: https://github.com/rhannequin/astronoby/pull/204
81
+ [#205]: https://github.com/rhannequin/astronoby/pull/205
82
+ [#206]: https://github.com/rhannequin/astronoby/pull/206
83
+ [#207]: https://github.com/rhannequin/astronoby/pull/207
84
+ [#208]: https://github.com/rhannequin/astronoby/pull/208
85
+ [#209]: https://github.com/rhannequin/astronoby/pull/209
86
+
3
87
  ## 0.7.0 - 2025-05-12
4
88
 
5
89
  _If you are upgrading: please see [UPGRADING.md]._
@@ -296,7 +380,7 @@ _If you are upgrading: please see [UPGRADING.md]._
296
380
 
297
381
  ## 0.3.0 - 2024-03-29
298
382
 
299
- _If you are upgrading: please see [`UPGRADING.md`]._
383
+ _If you are upgrading: please see [UPGRADING.md]._
300
384
 
301
385
  ### Improvements
302
386
 
@@ -315,7 +399,7 @@ _If you are upgrading: please see [`UPGRADING.md`]._
315
399
 
316
400
  ## 0.2.0 - 2024-03-24
317
401
 
318
- _If you are upgrading: please see [`UPGRADING.md`]._
402
+ _If you are upgrading: please see [UPGRADING.md]._
319
403
 
320
404
  ### Features
321
405
 
@@ -386,4 +470,4 @@ _If you are upgrading: please see [`UPGRADING.md`]._
386
470
  * Add `Astronoby::Angle`
387
471
  * Support angles in degrees and radians
388
472
 
389
- [`UPGRADING.md`]: https://github.com/rhannequin/astronoby/blob/main/UPGRADING.md
473
+ [UPGRADING.md]: https://github.com/rhannequin/astronoby/blob/main/UPGRADING.md
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Tests](https://github.com/rhannequin/astronoby/workflows/Ruby/badge.svg)](https://github.com/rhannequin/astronoby/actions?query=workflow%3ARuby)
4
4
 
5
- Ruby library to provide a useful API to compute astronomical calculations.
5
+ Ruby library that provides a useful API for computing astronomical calculations.
6
6
 
7
7
  Some algorithms are based on the following astrometry books:
8
8
  * _Astronomical Algorithms_ by Jean Meeus
@@ -10,10 +10,8 @@ Some algorithms are based on the following astrometry books:
10
10
  * _Practical Astronomy with your Calculator or Spreadsheet_ by Peter
11
11
  Duffet-Smith and Jonathan Zwart
12
12
 
13
- Solar System body's positions are computed based on ephemerides coming from
14
- the [IMCCE] or [NASA/JPL].
15
-
16
- [NASA/JPL]: https://ssd.jpl.nasa.gov/planets/eph_export.html
13
+ Solar System bodies' positions are computed based on ephemerides from the
14
+ [IMCCE] or [NASA/JPL].
17
15
 
18
16
  ## Content
19
17
  - [Installation](#installation)
@@ -35,45 +33,39 @@ executing:
35
33
 
36
34
  $ gem install astronoby
37
35
 
38
- [Bundler]: https://bundler.io
39
-
40
36
  ## Usage Documentation
41
37
 
42
- Since version 0.7.0, the usage documentation resides in the [Wiki]. For
38
+ Since version 0.7.0, the usage documentation resides in [`docs/`]. For
43
39
  previous versions, you can access the documentation in the README for each
44
40
  [release].
45
41
 
46
- [Wiki]: https://github.com/rhannequin/astronoby/wiki
47
- [release]: https://github.com/rhannequin/astronoby/releases
42
+ ### See also
43
+ - [Quick Start Guide](docs/README.md) - for getting started examples
44
+ - [Celestial Bodies](docs/celestial_bodies.md) - for understanding planets and objects
45
+ - [Reference Frames](docs/reference_frames.md) - for coordinate systems
46
+ - [Observer Setup](docs/observer.md) - for location configuration
47
+ - [Glossary](docs/glossary.md) - for astronomical and technical terms
48
48
 
49
49
  ### Expected breaking changes notice
50
50
 
51
- This library is still in heavy development. The public is not stable, please
52
- be aware new minor versions will probably lead to breaking changes until a
53
- major one is released.
51
+ This library is still in heavy development. The public API is not stable, so
52
+ please be aware that new minor versions will probably lead to breaking changes
53
+ until a major one is released.
54
54
 
55
55
  Changes are documented in the [CHANGELOG] and adapting to breaking changes is
56
56
  described in the [UPGRADING] document.
57
57
 
58
- [CHANGELOG]: https://github.com/rhannequin/astronoby/blob/main/CHANGELOG.md
59
- [UPGRADING]: https://github.com/rhannequin/astronoby/blob/main/UPGRADING.md
60
-
61
58
  ## Precision
62
59
 
63
- The current precision for the major Solar System bodies' location in the sky
64
- as seen from an observer on Earth is below 10 arc seconds. It corresponds to
65
- half the size of Saturn when it is the closest to Earth.
60
+ The current precision for the major Solar System bodies' locations in the sky
61
+ as seen from an observer on Earth is below 10 arc seconds. This corresponds to
62
+ half the size of Saturn when it is closest to Earth.
66
63
 
67
64
  While the precision is not enough for spacecraft navigation, it is enough for
68
65
  automated guiding of amateur telescopes.
69
66
 
70
- The compared sources are: [IMCCE], [JPL Horizons], [Stellarium], and the
71
- [Skyfield] library.
72
-
73
- [IMCCE]: https://www.imcce.fr
74
- [JPL Horizons]: https://ssd.jpl.nasa.gov/horizons.cgi
75
- [Stellarium]: https://stellarium.org
76
- [Skyfield]: https://rhodesmill.org/skyfield/
67
+ The sources used for comparison are: [IMCCE], [JPL Horizons], [Stellarium],
68
+ and the [Skyfield] library.
77
69
 
78
70
  ## Development
79
71
 
@@ -86,15 +78,35 @@ release a new version, update the version number in `version.rb`, and then run
86
78
  `bundle exec rake release`, which will create a git tag for the version, push
87
79
  git commits and the created tag, and push the `.gem` file to [rubygems.org].
88
80
 
89
- [rubygems.org]: https://rubygems.org
81
+ ### Performance
90
82
 
91
- ## Contributing
83
+ The library is designed to be fast, but there is always room for improvement.
84
+ When comparing the performance of two implementations, please use the
85
+ performance benchmark in the console before and after your implementation.
92
86
 
93
- Please see [CONTRIBUTING.md].
87
+ $ bin/console
94
88
 
95
- [CONTRIBUTING.md]: https://github.com/rhannequin/astronoby/blob/main/CONTRIBUTING.md
89
+ ```rb
90
+ require_relative "benchmarks/performance"
96
91
 
97
- [code of conduct]: https://github.com/rhannequin/astronoby/blob/main/CODE_OF_CONDUCT.md
92
+ PerformanceBenchmark.new.run
93
+ ```
94
+
95
+ For fast feedback, you can customise the parameters:
96
+
97
+ ```rb
98
+ PerformanceBenchmark
99
+ .new(warmup_runs: 1, measure_runs: 3, iterations_per_run: 5)
100
+ .run
101
+ ```
102
+
103
+ Performance is not absolute, which is why the results are not documented here.
104
+ What is important is to compare the relative performance of two implementations
105
+ and make sure new features do not degrade performance.
106
+
107
+ ## Contributing
108
+
109
+ Please see [CONTRIBUTING.md].
98
110
 
99
111
  ## License
100
112
 
@@ -105,6 +117,18 @@ The gem is available as open source under the terms of the [MIT License].
105
117
  ## Code of Conduct
106
118
 
107
119
  Everyone interacting in the Astronoby project's codebases, issue trackers, chat
108
- rooms and mailing lists are expected to follow the [code of conduct].
120
+ rooms and mailing lists is expected to follow the [code of conduct].
109
121
 
122
+ [NASA/JPL]: https://ssd.jpl.nasa.gov/planets/eph_export.html
123
+ [Bundler]: https://bundler.io
124
+ [`docs/`]: https://github.com/rhannequin/astronoby/blob/main/docs
125
+ [release]: https://github.com/rhannequin/astronoby/releases
126
+ [CHANGELOG]: https://github.com/rhannequin/astronoby/blob/main/CHANGELOG.md
127
+ [UPGRADING]: https://github.com/rhannequin/astronoby/blob/main/UPGRADING.md
128
+ [IMCCE]: https://www.imcce.fr
129
+ [JPL Horizons]: https://ssd.jpl.nasa.gov/horizons.cgi
130
+ [Stellarium]: https://stellarium.org
131
+ [Skyfield]: https://rhodesmill.org/skyfield/
132
+ [rubygems.org]: https://rubygems.org
133
+ [CONTRIBUTING.md]: https://github.com/rhannequin/astronoby/blob/main/CONTRIBUTING.md
110
134
  [code of conduct]: https://github.com/rhannequin/astronoby/blob/main/CODE_OF_CONDUCT.md
data/UPGRADING.md CHANGED
@@ -7,9 +7,38 @@ changes to it as long as a major version has not been released.
7
7
  If you are already using Astronoby and wish to follow the changes to its
8
8
  public API, please read the upgrading notes for each release.
9
9
 
10
+ ## Upgrading from 0.7.0 to 0.8.0
11
+
12
+ ### Benchmark directory changed
13
+
14
+ The precision benchmark has been moved to `benchmarks`.
15
+
16
+ ### `Epoch` refactored into `JulianDate`
17
+
18
+ The `Epoch` class has been removed and replaced by `JulianDate`. This change is
19
+ meant to clarify the purpose of the class, which is to represent a Julian date
20
+ and not an epoch.
21
+
22
+ * Method `#to_utc` has been dropped in favor as is was ambiguous regarding the
23
+ timescale used.
24
+ * Therefore, constant `JULIAN_DAY_NUMBER_OFFSET` has also been dropped.
25
+ * `MeanObliquity::for_epoch` was renamed to `::at` and now takes an `instant` as
26
+ parameter
27
+ * `MeanObliquity::obliquity_of_reference_in_milliarcseconds` was renamed to
28
+ `::obliquity_of_reference_in_arcseconds`
29
+ * `TrueObliquity::for_epoch` was renamed to to `::at` and now takes an
30
+ `instant` as parameter
31
+ * `Coordinates::Equatorial#to_ecliptic` method now takes an `instant` as
32
+ parameter
33
+
34
+ ### `#angular_diameter` moved from topocentric position to body
35
+
36
+ Previously accessible from the topocentric reference frame, the angular diameter
37
+ of a Solar System body is now accessible from the body itself.
38
+
10
39
  ## Upgrading from 0.6.0 to 0.7.0
11
40
 
12
- ## Signature change for `Sun` and `Moon`
41
+ ### Signature change for `Sun` and `Moon`
13
42
 
14
43
  Both classes are now initialized with the key arguments `ephem` and `instant`.
15
44
  `ephem` comes from `Ephem.load` which provides the raw geometric data for Solar
@@ -17,7 +46,7 @@ System bodies. `instant` is an instance of `Instant`, the new concept for
17
46
  representing an instant in time.
18
47
 
19
48
  ```rb
20
- Ephem::IO::Download.call(name: "de421.bsp", target: "tmp/de421.bsp")
49
+ Astronoby::Ephem.download(name: "de421.bsp", target: "tmp/de421.bsp")
21
50
  ephem = Astronoby::Ephem.load("tmp/de421.bsp")
22
51
 
23
52
  time = Time.utc(2025, 6, 19, 12, 0, 0)
@@ -30,7 +59,7 @@ Learn more on [ephem].
30
59
 
31
60
  [ephem]: https://github.com/rhannequin/astronoby/wiki/Ephem
32
61
 
33
- ## Drop of methods for `Sun`
62
+ ### Drop of methods for `Sun`
34
63
 
35
64
  `Sun` doesn't expose the following class and instance methods anymore:
36
65
  * `::equation_of_time` (replaced with `#equation_of_time`)
@@ -51,7 +80,7 @@ Learn more on [reference frames].
51
80
 
52
81
  [reference frames]: https://github.com/rhannequin/astronoby/wiki/Reference-Frames
53
82
 
54
- ## Drop of instance methods for `Moon`
83
+ ### Drop of instance methods for `Moon`
55
84
 
56
85
  `Moon` doesn't expose the following nstance methods anymore:
57
86
  * `#apparent_ecliptic_coordinates` (replaced with `#ecliptic` on reference frames)
@@ -65,7 +94,7 @@ Learn more on [reference frames].
65
94
  * `#phase_angle`
66
95
  * `#observation_events`
67
96
 
68
- ## Signature change for `Aberration`
97
+ ### Signature change for `Aberration`
69
98
 
70
99
  `Aberration` is now initialized with the key arguments `astrometric_position`
71
100
  and `observer_velocity`. `astrometric_position` is a position vector
@@ -92,7 +121,7 @@ aberration = Astronoby::Aberration.new(
92
121
  )
93
122
  ```
94
123
 
95
- ## Signature change for `Angle#to_dms` and `Angle#to_hms`
124
+ ### Signature change for `Angle#to_dms` and `Angle#to_hms`
96
125
 
97
126
  `Angle#to_dms` and `Angle#to_hms` don't have arguments anymore. The angle value
98
127
  is now taken from the object itself. This was a misbehavior in the previous
@@ -106,49 +135,49 @@ dms.format
106
135
  # => "+45° 0′ 0.0″"
107
136
  ```
108
137
 
109
- ## Signature change for `EquinoxSolstice`
138
+ ### Signature change for `EquinoxSolstice`
110
139
 
111
140
  `EquinoxSolstice.new` now takes an additional argument expected to be an ephem
112
141
  (`Astronoby::Ephem`).
113
142
 
114
- ## Signature change for `Nutation`
143
+ ### Signature change for `Nutation`
115
144
 
116
145
  The expected `epoch` (`Astronoby::Epoch`) argument has been replaced by an
117
146
  `instant` (`Astronoby::Instant`) key argument.
118
147
 
119
- ## Drop of `Nutation::for_ecliptic_longitude` and `Nutation::for_obliquity_of_the_ecliptic`
148
+ ### Drop of `Nutation::for_ecliptic_longitude` and `Nutation::for_obliquity_of_the_ecliptic`
120
149
 
121
150
  `Nutation::for_ecliptic_longitude` and `Nutation::for_obliquity_of_the_ecliptic`
122
151
  methods have been removed. The `Nutation` class now exposes the
123
152
  `#nutation_in_longitude` and `#nutation_in_obliquity` instance methods which
124
153
  both return an angle (`Astronoby::Angle`).
125
154
 
126
- ## Signature change for `Precession`
155
+ ### Signature change for `Precession`
127
156
 
128
157
  The expected `coordinates` and `epoch` (`Astronoby::Epoch`) key arguments have
129
158
  been replaced by an `instant` (`Astronoby::Instant`) key argument.
130
159
 
131
- ## Drop of `Precession#for_equatorial_coordinates` and `Precession#precess`
160
+ ### Drop of `Precession#for_equatorial_coordinates` and `Precession#precess`
132
161
 
133
162
  `Precession#for_equatorial_coordinates` and `Precession#precess` methods have
134
163
  been refactoed into class methods.
135
164
 
136
- ## Drop of `Coordinates::Horizontal#to_equatorial`
165
+ ### Drop of `Coordinates::Horizontal#to_equatorial`
137
166
 
138
167
  `Coordinates::Horizontal#to_equatorial` has been removed as equatorial
139
168
  coordinates are now available from the reference frames.
140
169
 
141
- ## Drop of instance methods for `Coordinates::Ecliptic`
170
+ ### Drop of instance methods for `Coordinates::Ecliptic`
142
171
 
143
172
  `Coordinates::Ecliptic#to_true_equatorial` and
144
173
  `Coordinates::Ecliptic#to_apparent_equatorial` have been removed as
145
174
  equatorial coordinates are now available from the reference frames.
146
175
 
147
- ## Drop of `Coordinates::Equatorial#to_epoch`
176
+ ### Drop of `Coordinates::Equatorial#to_epoch`
148
177
 
149
178
  `Coordinates::Equatorial#to_epoch` has been removed.
150
179
 
151
- ## Drop of `Events::ObservationEvents`
180
+ ### Drop of `Events::ObservationEvents`
152
181
 
153
182
  `Events::ObservationEvents` has been removed. The rising, transit and setting
154
183
  times can now be calculated using `RiseTransitSetCalculator`.
@@ -179,12 +208,12 @@ event.setting_time
179
208
  # => 2025-04-24 18:55:24 UTC
180
209
  ```
181
210
 
182
- ## Drop of `RiseTransitSetIteration`
211
+ ### Drop of `RiseTransitSetIteration`
183
212
 
184
213
  `RiseTransitSetIteration` has been removed as it was only used by
185
214
  `Events::ObservationEvents`.
186
215
 
187
- ## Drop of `Events::TwilightEvents`
216
+ ### Drop of `Events::TwilightEvents`
188
217
 
189
218
  `Events::TwilightEvents` has been removed. The twilight times can now be
190
219
  calculated using `TwilightCalculator`.
@@ -224,20 +253,20 @@ event.evening_astronomical_twilight_time
224
253
  # => 2025-04-24 20:56:34 UTC
225
254
  ```
226
255
 
227
- ## Drop of `EphemerideLunaireParisienne`
256
+ ### Drop of `EphemerideLunaireParisienne`
228
257
 
229
258
  `EphemerideLunaireParisienne` has been removed.
230
259
 
231
- ## Drop of `Util::Astrodynamics`
260
+ ### Drop of `Util::Astrodynamics`
232
261
 
233
262
  `Util::Astrodynamics` has been removed.
234
263
 
235
- ## Drop of `Util::Maths.interpolate` and `Util::Maths.normalize_angles_for_interpolation`
264
+ ### Drop of `Util::Maths.interpolate` and `Util::Maths.normalize_angles_for_interpolation`
236
265
 
237
266
  `Util::Maths.interpolate` and `Util::Maths.normalize_angles_for_interpolation`
238
267
  have been removed.
239
268
 
240
- ## Drop of `Constants::SECONDS_PER_DEGREE`
269
+ ### Drop of `Constants::SECONDS_PER_DEGREE`
241
270
 
242
271
  `Constants::SECONDS_PER_DEGREE` has been removed.
243
272
 
data/docs/README.md ADDED
@@ -0,0 +1,196 @@
1
+ # Quick Start
2
+
3
+ ## Download an ephemeris
4
+
5
+ You only need to run this once, it will download and store an ephemeris on your
6
+ file system.
7
+
8
+ ```rb
9
+ Ephem::IO::Download.call(name: "de421.bsp", target: "tmp/de421.bsp")
10
+ ```
11
+
12
+ Ephemerides can be large files, but Astronoby provides a tool to drastically
13
+ reduce the size to your needs. You can learn more about ephemerides on the
14
+ [Ephem page].
15
+
16
+ ## Load an ephemeris
17
+
18
+ ```rb
19
+ ephem = Astronoby::Ephem.load("tmp/de421.bsp")
20
+ ```
21
+
22
+ ## Define a time and create an `Instant` object from it
23
+
24
+ ```rb
25
+ time = Time.utc(2025, 6, 19, 12, 0, 0)
26
+ instant = Astronoby::Instant.from_time(time)
27
+ ```
28
+
29
+ You can learn more about time scales on the [Instant page].
30
+
31
+ ## Instantiate a Solar System body object
32
+
33
+ ```rb
34
+ jupiter = Astronoby::Jupiter.new(instant: instant, ephem: ephem)
35
+ ```
36
+
37
+ You can learn more about planets and bodies on the [Celestial Bodies page].
38
+
39
+ ## Define an observer from geographic coordinates
40
+
41
+ ```rb
42
+ observer = Astronoby::Observer.new(
43
+ latitude: Astronoby::Angle.from_degrees(48.83661378408946),
44
+ longitude: Astronoby::Angle.from_degrees(2.3366748126024466),
45
+ elevation: Astronoby::Distance.from_meters(65)
46
+ )
47
+ ```
48
+
49
+ You can learn more about angles on the [Angles page], and about observers on the
50
+ [Observer page].
51
+
52
+ ## Compute the topocentric position of the body as seen from the observer
53
+
54
+ ```rb
55
+ topocentric = jupiter.observed_by(observer)
56
+ ```
57
+
58
+ You can learn more about reference frames and positions on the
59
+ [Reference Frames page].
60
+
61
+ ## Get the horizontal coordinates from the position
62
+
63
+ ```rb
64
+ topocentric.horizontal.azimuth.str(:dms)
65
+ # => "+175° 34′ 28.2724″"
66
+
67
+ topocentric.horizontal.altitude.str(:dms)
68
+ # => "+64° 22′ 58.1084″"
69
+ ```
70
+
71
+ You can learn more about coordinates on the [Coordinates page].
72
+
73
+ ## Get the rising, transit and setting times between two times
74
+
75
+ ```rb
76
+ calculator = Astronoby::RiseTransitSetCalculator.new(
77
+ body: Astronoby::Jupiter,
78
+ observer: observer,
79
+ ephem: ephem
80
+ )
81
+
82
+ events = calculator.events_between(
83
+ Time.utc(2025, 5, 1),
84
+ Time.utc(2025, 5, 3),
85
+ )
86
+
87
+ events.rising_times
88
+ # => [2025-05-01 06:35:35 UTC, 2025-05-02 06:32:26 UTC]
89
+
90
+ events.transit_times
91
+ # => [2025-05-01 14:34:34 UTC, 2025-05-02 14:31:31 UTC]
92
+
93
+ events.setting_times
94
+ # => [2025-05-01 22:33:37 UTC, 2025-05-02 22:30:39 UTC]
95
+ ```
96
+
97
+ You can learn more about this calculator on the
98
+ [Rise, transit and setting times page].
99
+
100
+ ## Get the twilight times of the day
101
+
102
+ ```rb
103
+ calculator = Astronoby::TwilightCalculator.new(
104
+ observer: observer,
105
+ ephem: ephem
106
+ )
107
+
108
+ event = calculator.event_on(Date.new(2025, 5, 1))
109
+
110
+ event.morning_astronomical_twilight_time
111
+ # => 2025-05-01 02:17:28 UTC
112
+
113
+ event.morning_nautical_twilight_time
114
+ # => 2025-05-01 03:10:17 UTC
115
+
116
+ event.morning_civil_twilight_time
117
+ # => 2025-05-01 03:55:17 UTC
118
+
119
+ event.evening_civil_twilight_time
120
+ # => 2025-05-01 19:40:12 UTC
121
+
122
+ event.evening_nautical_twilight_time
123
+ # => 2025-05-01 20:25:12 UTC
124
+
125
+ event.evening_astronomical_twilight_time
126
+ # => 2025-05-01 21:18:01 UTC
127
+ ```
128
+
129
+ You can learn more about this calculator on the [Twilight times page].
130
+
131
+ ## Moon phases
132
+
133
+ You can either get all the major Moon phases that will happen in a month, or get
134
+ information about the current Moon phase.
135
+
136
+ ```rb
137
+ may_2024_phases = Astronoby::Events::MoonPhases.phases_for(year: 2024, month: 5)
138
+
139
+ may_2024_phases.each { puts "#{_1.phase}: #{_1.time}" }
140
+ # last_quarter: 2024-05-01 11:27:15 UTC
141
+ # new_moon: 2024-05-08 03:21:56 UTC
142
+ # first_quarter: 2024-05-15 11:48:02 UTC
143
+ # full_moon: 2024-05-23 13:53:12 UTC
144
+ # last_quarter: 2024-05-30 17:12:43 UTC
145
+ ```
146
+
147
+ ```rb
148
+ time = Time.utc(2025, 5, 15)
149
+ instant = Astronoby::Instant.from_time(time)
150
+ moon = Astronoby::Moon.new(ephem: ephem, instant: instant)
151
+
152
+ moon.illuminated_fraction.round(2)
153
+ # => 0.15
154
+
155
+ moon.current_phase_fraction.round(2)
156
+ # => 0.11
157
+ ```
158
+
159
+ You can learn more about phases on the [Moon phases page].
160
+
161
+ ## Equinox and solstice times
162
+
163
+ ```rb
164
+
165
+ Astronoby::EquinoxSolstice.march_equinox(2025, ephem)
166
+ # => 2025-03-20 09:01:29 UTC
167
+
168
+ Astronoby::EquinoxSolstice.june_solstice(2025, ephem)
169
+ # => 2025-06-21 02:42:19 UTC
170
+
171
+ Astronoby::EquinoxSolstice.september_equinox(2025, ephem)
172
+ # => 2025-09-22 18:19:22 UTC
173
+
174
+ Astronoby::EquinoxSolstice.december_solstice(2025, ephem)
175
+ # => 2025-12-21 15:03:03 UTC
176
+ ```
177
+
178
+ You can learn more about equinoxes and solstices on the
179
+ [Equinoxes and solstices times page].
180
+
181
+ ## See also
182
+ - [Glossary](glossary.md) - for astronomical and technical terms
183
+ - [Configuration](configuration.md) - for performance tuning
184
+ - [Performance Benchmarks](../benchmarks/README.md) - for testing improvements
185
+
186
+ [Ephem page]: ephem.md
187
+ [Instant page]: instant.md
188
+ [Celestial Bodies page]: celestial_bodies.md
189
+ [Observer page]: observer.md
190
+ [Reference Frames page]: reference_frames.md
191
+ [Angles page]: angles.md
192
+ [Coordinates page]: coordinates.md
193
+ [Rise, transit and setting times page]: rise_transit_set_times.md
194
+ [Twilight times page]: twilight_times.md
195
+ [Moon phases page]: moon_phases.md
196
+ [Equinoxes and solstices times page]: equinoxes_solstices_times.md