astronoby 0.6.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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/.standard.yml +1 -0
- data/CHANGELOG.md +203 -3
- data/README.md +69 -288
- data/UPGRADING.md +267 -0
- data/docs/README.md +196 -0
- data/docs/angles.md +137 -0
- data/docs/celestial_bodies.md +107 -0
- data/docs/configuration.md +98 -0
- data/docs/coordinates.md +167 -0
- data/docs/ephem.md +85 -0
- data/docs/equinoxes_solstices_times.md +31 -0
- data/docs/glossary.md +152 -0
- data/docs/instant.md +139 -0
- data/docs/moon_phases.md +79 -0
- data/docs/observer.md +65 -0
- data/docs/reference_frames.md +138 -0
- data/docs/rise_transit_set_times.md +119 -0
- data/docs/twilight_times.md +123 -0
- data/lib/astronoby/aberration.rb +56 -31
- data/lib/astronoby/angle.rb +20 -16
- data/lib/astronoby/angles/dms.rb +2 -2
- data/lib/astronoby/angles/hms.rb +2 -2
- data/lib/astronoby/bodies/earth.rb +62 -0
- data/lib/astronoby/bodies/jupiter.rb +28 -0
- data/lib/astronoby/bodies/mars.rb +28 -0
- data/lib/astronoby/bodies/mercury.rb +32 -0
- data/lib/astronoby/bodies/moon.rb +51 -298
- data/lib/astronoby/bodies/neptune.rb +32 -0
- data/lib/astronoby/bodies/saturn.rb +37 -0
- data/lib/astronoby/bodies/solar_system_body.rb +232 -0
- data/lib/astronoby/bodies/sun.rb +33 -214
- data/lib/astronoby/bodies/uranus.rb +16 -0
- data/lib/astronoby/bodies/venus.rb +36 -0
- data/lib/astronoby/cache.rb +188 -0
- data/lib/astronoby/configuration.rb +92 -0
- data/lib/astronoby/constants.rb +17 -2
- data/lib/astronoby/constellation.rb +12 -0
- data/lib/astronoby/constellations/data.rb +42 -0
- data/lib/astronoby/constellations/finder.rb +35 -0
- data/lib/astronoby/constellations/repository.rb +20 -0
- data/lib/astronoby/coordinates/ecliptic.rb +2 -37
- data/lib/astronoby/coordinates/equatorial.rb +28 -10
- data/lib/astronoby/coordinates/horizontal.rb +0 -46
- data/lib/astronoby/corrections/light_time_delay.rb +90 -0
- data/lib/astronoby/data/constellations/constellation_names.dat +88 -0
- data/lib/astronoby/data/constellations/indexed_abbreviations.dat +88 -0
- data/lib/astronoby/data/constellations/radec_to_index.dat +238 -0
- data/lib/astronoby/data/constellations/sorted_declinations.dat +202 -0
- data/lib/astronoby/data/constellations/sorted_right_ascensions.dat +237 -0
- data/lib/astronoby/deflection.rb +187 -0
- data/lib/astronoby/distance.rb +9 -0
- data/lib/astronoby/ephem.rb +39 -0
- data/lib/astronoby/equinox_solstice.rb +22 -19
- data/lib/astronoby/errors.rb +4 -0
- data/lib/astronoby/events/moon_phases.rb +15 -13
- data/lib/astronoby/events/rise_transit_set_calculator.rb +376 -0
- data/lib/astronoby/events/rise_transit_set_event.rb +13 -0
- data/lib/astronoby/events/rise_transit_set_events.rb +13 -0
- data/lib/astronoby/events/twilight_calculator.rb +221 -0
- data/lib/astronoby/events/twilight_event.rb +28 -0
- data/lib/astronoby/events/twilight_events.rb +22 -115
- data/lib/astronoby/instant.rb +176 -0
- data/lib/astronoby/julian_date.rb +78 -0
- data/lib/astronoby/mean_obliquity.rb +24 -13
- data/lib/astronoby/nutation.rb +235 -42
- data/lib/astronoby/observer.rb +55 -0
- data/lib/astronoby/precession.rb +102 -18
- data/lib/astronoby/reference_frame.rb +50 -0
- data/lib/astronoby/reference_frames/apparent.rb +60 -0
- data/lib/astronoby/reference_frames/astrometric.rb +21 -0
- data/lib/astronoby/reference_frames/geometric.rb +20 -0
- data/lib/astronoby/reference_frames/mean_of_date.rb +38 -0
- data/lib/astronoby/reference_frames/topocentric.rb +72 -0
- data/lib/astronoby/time/greenwich_sidereal_time.rb +2 -2
- data/lib/astronoby/true_obliquity.rb +3 -3
- data/lib/astronoby/util/maths.rb +70 -73
- data/lib/astronoby/util/time.rb +455 -32
- data/lib/astronoby/vector.rb +36 -0
- data/lib/astronoby/velocity.rb +116 -0
- data/lib/astronoby/version.rb +1 -1
- data/lib/astronoby.rb +33 -5
- metadata +117 -24
- data/.tool-versions +0 -1
- data/Gemfile +0 -5
- data/Gemfile.lock +0 -80
- data/benchmark/README.md +0 -131
- data/benchmark/benchmark.rb +0 -259
- data/benchmark/data/imcce.csv.zip +0 -0
- data/benchmark/data/sun_calc.csv.zip +0 -0
- data/lib/astronoby/astronomical_models/ephemeride_lunaire_parisienne.rb +0 -143
- data/lib/astronoby/epoch.rb +0 -22
- data/lib/astronoby/events/observation_events.rb +0 -285
- data/lib/astronoby/events/rise_transit_set_iteration.rb +0 -218
- data/lib/astronoby/util/astrodynamics.rb +0 -60
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e26fab1e74e0fa27c784712cb44a5557c553c1104752eb5e63ddda0c48a95b52
|
4
|
+
data.tar.gz: cfb3e98fc8a4f841b144a0ae2ea435ea764d7eafb85f150a0e3cc7495af3218e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43b7bdbd274fc42b1c1c992a677abf71dc831e727abb2bf78b93190595a4746a07f266affececa6e495a534eda304164422623a09673fe779c9b1064be9d11d0
|
7
|
+
data.tar.gz: b8a3dcd0992c55606c6e13b4f7783325268a1168d26343ac6a20d050514ca7b30b4fd3548a2903db5abfcbb8133efe79ae7868681cdcba8b61d284862f1f423c
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.4.4
|
data/.standard.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby_version: 3.0.0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,205 @@
|
|
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
|
+
|
87
|
+
## 0.7.0 - 2025-05-12
|
88
|
+
|
89
|
+
_If you are upgrading: please see [UPGRADING.md]._
|
90
|
+
|
91
|
+
### Bug fixes
|
92
|
+
|
93
|
+
* Fix Moon monthly phase events calculation by @valeriy-sokoloff in ([#124])
|
94
|
+
|
95
|
+
### Features
|
96
|
+
|
97
|
+
* Add `Instant` value object ([#121])
|
98
|
+
* Introduce barycentric position of Solar System major bodies ([#127])
|
99
|
+
* Introduce Astrometric position for planets ([#129])
|
100
|
+
* Rename Barycentric into Geometric ([#130])
|
101
|
+
* Rename IRCF and remove module Position ([#131])
|
102
|
+
* Geometric and Astrometric reference frames with coordinates ([#132])
|
103
|
+
* Ecliptic coordinates for Geometric and Astrometric reference frames ([#134])
|
104
|
+
* Add Geometric and Astrometric positions for `Sun` and `Moon` ([#135])
|
105
|
+
* Implement new aberration correction ([#136])
|
106
|
+
* Precession matrix for 2006 P03 model ([#137])
|
107
|
+
* Introduce `MeanOfDate` reference frame ([#138])
|
108
|
+
* New nutation model ([#141])
|
109
|
+
* Light deflection correction ([#142])
|
110
|
+
* Introduce `Apparent` reference frame ([#143])
|
111
|
+
* Introduce `Topocentric` reference frame ([#145])
|
112
|
+
* Improve Vector integration with value objects ([#146])
|
113
|
+
* Handle refracted topocentric horizontal coordinates ([#147])
|
114
|
+
* Add `#angular_diameter` to apparent and topocentric reference frames ([#149])
|
115
|
+
* Introduce new calculator for rising, transit and setting times ([#148])
|
116
|
+
* Clean code after Ephem refactoring ([#152])
|
117
|
+
* Improve `RisingTransitSettingEventsCalculator` ([#155])
|
118
|
+
* Simplify `RisingTransitSettingEventsCalculator` ([#156])
|
119
|
+
* Lazy-load reference frames ([#157])
|
120
|
+
* Overall performance improvements ([#163])
|
121
|
+
* Add support for IMCCE INPOP by @JoelQ and @rhannequin ([#166])
|
122
|
+
* Update INPOP excerpt in spec data ([#167])
|
123
|
+
* Introduce a better rise/transit/set calculator ([#168])
|
124
|
+
* Drop `Astronoby::Observer#observe` ([#174])
|
125
|
+
|
126
|
+
### Improvements
|
127
|
+
|
128
|
+
* Bump standard from 1.42.1 to 1.49.0 by @dependabot ([#123], [#128], [#150], [#165])
|
129
|
+
* Bump rubyzip from 2.3.2 to 2.4.1 by @dependabot ([#120])
|
130
|
+
* Add more tests for Julian Date conversion ([#122])
|
131
|
+
* Upgrade main Ruby version and supported ones ([#125])
|
132
|
+
* Update email address and gem description ([#126])
|
133
|
+
* Increase precision of mean obliquity ([#133])
|
134
|
+
* Add supported Rubies ([#139])
|
135
|
+
* Set Ruby 3.4.2 as default version ([#140])
|
136
|
+
* Fix dependency secutiry patch ([#151])
|
137
|
+
* Improve HMS/DMS formats ([#153])
|
138
|
+
* Use excerpts ephemerides for specs of Sun and Moon ([#154])
|
139
|
+
* Add link to deprecated documentation ([#160])
|
140
|
+
* Default Ruby 3.4.3 and support recent rubies ([#169])
|
141
|
+
* Better Moon phases test coverage ([#172])
|
142
|
+
* Optimize Observer with GMST from Instant ([#173])
|
143
|
+
* Update README about documentation location ([#175])
|
144
|
+
* Add GitHub Actions permissions ([#176])
|
145
|
+
|
146
|
+
### New Contributors
|
147
|
+
|
148
|
+
* @valeriy-sokoloff made their first contribution in https://github.com/rhannequin/astronoby/pull/124
|
149
|
+
* @JoelQ made their first contribution in https://github.com/rhannequin/astronoby/pull/166
|
150
|
+
|
151
|
+
**Full Changelog**: https://github.com/rhannequin/astronoby/compare/v0.6.0...v0.7.0
|
152
|
+
|
153
|
+
[#120]: https://github.com/rhannequin/astronoby/pull/120
|
154
|
+
[#121]: https://github.com/rhannequin/astronoby/pull/121
|
155
|
+
[#122]: https://github.com/rhannequin/astronoby/pull/122
|
156
|
+
[#123]: https://github.com/rhannequin/astronoby/pull/123
|
157
|
+
[#124]: https://github.com/rhannequin/astronoby/pull/124
|
158
|
+
[#125]: https://github.com/rhannequin/astronoby/pull/125
|
159
|
+
[#126]: https://github.com/rhannequin/astronoby/pull/126
|
160
|
+
[#127]: https://github.com/rhannequin/astronoby/pull/127
|
161
|
+
[#128]: https://github.com/rhannequin/astronoby/pull/128
|
162
|
+
[#129]: https://github.com/rhannequin/astronoby/pull/129
|
163
|
+
[#130]: https://github.com/rhannequin/astronoby/pull/130
|
164
|
+
[#131]: https://github.com/rhannequin/astronoby/pull/131
|
165
|
+
[#132]: https://github.com/rhannequin/astronoby/pull/132
|
166
|
+
[#133]: https://github.com/rhannequin/astronoby/pull/133
|
167
|
+
[#134]: https://github.com/rhannequin/astronoby/pull/134
|
168
|
+
[#135]: https://github.com/rhannequin/astronoby/pull/135
|
169
|
+
[#136]: https://github.com/rhannequin/astronoby/pull/136
|
170
|
+
[#137]: https://github.com/rhannequin/astronoby/pull/137
|
171
|
+
[#138]: https://github.com/rhannequin/astronoby/pull/138
|
172
|
+
[#139]: https://github.com/rhannequin/astronoby/pull/139
|
173
|
+
[#140]: https://github.com/rhannequin/astronoby/pull/140
|
174
|
+
[#141]: https://github.com/rhannequin/astronoby/pull/141
|
175
|
+
[#142]: https://github.com/rhannequin/astronoby/pull/142
|
176
|
+
[#143]: https://github.com/rhannequin/astronoby/pull/143
|
177
|
+
[#145]: https://github.com/rhannequin/astronoby/pull/145
|
178
|
+
[#146]: https://github.com/rhannequin/astronoby/pull/146
|
179
|
+
[#147]: https://github.com/rhannequin/astronoby/pull/147
|
180
|
+
[#148]: https://github.com/rhannequin/astronoby/pull/148
|
181
|
+
[#149]: https://github.com/rhannequin/astronoby/pull/149
|
182
|
+
[#150]: https://github.com/rhannequin/astronoby/pull/150
|
183
|
+
[#151]: https://github.com/rhannequin/astronoby/pull/151
|
184
|
+
[#152]: https://github.com/rhannequin/astronoby/pull/152
|
185
|
+
[#153]: https://github.com/rhannequin/astronoby/pull/153
|
186
|
+
[#154]: https://github.com/rhannequin/astronoby/pull/154
|
187
|
+
[#155]: https://github.com/rhannequin/astronoby/pull/155
|
188
|
+
[#156]: https://github.com/rhannequin/astronoby/pull/156
|
189
|
+
[#157]: https://github.com/rhannequin/astronoby/pull/157
|
190
|
+
[#160]: https://github.com/rhannequin/astronoby/pull/160
|
191
|
+
[#163]: https://github.com/rhannequin/astronoby/pull/163
|
192
|
+
[#165]: https://github.com/rhannequin/astronoby/pull/165
|
193
|
+
[#166]: https://github.com/rhannequin/astronoby/pull/166
|
194
|
+
[#167]: https://github.com/rhannequin/astronoby/pull/167
|
195
|
+
[#168]: https://github.com/rhannequin/astronoby/pull/168
|
196
|
+
[#169]: https://github.com/rhannequin/astronoby/pull/169
|
197
|
+
[#172]: https://github.com/rhannequin/astronoby/pull/172
|
198
|
+
[#173]: https://github.com/rhannequin/astronoby/pull/173
|
199
|
+
[#174]: https://github.com/rhannequin/astronoby/pull/174
|
200
|
+
[#175]: https://github.com/rhannequin/astronoby/pull/175
|
201
|
+
[#176]: https://github.com/rhannequin/astronoby/pull/176
|
202
|
+
|
3
203
|
## 0.6.0 - 2024-12-10
|
4
204
|
|
5
205
|
_If you are upgrading: please see [UPGRADING.md]._
|
@@ -180,7 +380,7 @@ _If you are upgrading: please see [UPGRADING.md]._
|
|
180
380
|
|
181
381
|
## 0.3.0 - 2024-03-29
|
182
382
|
|
183
|
-
_If you are upgrading: please see [
|
383
|
+
_If you are upgrading: please see [UPGRADING.md]._
|
184
384
|
|
185
385
|
### Improvements
|
186
386
|
|
@@ -199,7 +399,7 @@ _If you are upgrading: please see [`UPGRADING.md`]._
|
|
199
399
|
|
200
400
|
## 0.2.0 - 2024-03-24
|
201
401
|
|
202
|
-
_If you are upgrading: please see [
|
402
|
+
_If you are upgrading: please see [UPGRADING.md]._
|
203
403
|
|
204
404
|
### Features
|
205
405
|
|
@@ -270,4 +470,4 @@ _If you are upgrading: please see [`UPGRADING.md`]._
|
|
270
470
|
* Add `Astronoby::Angle`
|
271
471
|
* Support angles in degrees and radians
|
272
472
|
|
273
|
-
[
|
473
|
+
[UPGRADING.md]: https://github.com/rhannequin/astronoby/blob/main/UPGRADING.md
|
data/README.md
CHANGED
@@ -2,30 +2,20 @@
|
|
2
2
|
|
3
3
|
[](https://github.com/rhannequin/astronoby/actions?query=workflow%3ARuby)
|
4
4
|
|
5
|
-
Ruby library
|
6
|
-
on astrometry books.
|
5
|
+
Ruby library that provides a useful API for computing astronomical calculations.
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
Some algorithms are based on the following astrometry books:
|
8
|
+
* _Astronomical Algorithms_ by Jean Meeus
|
9
|
+
* _Celestial Calculations_ by J. L. Lawrence
|
10
|
+
* _Practical Astronomy with your Calculator or Spreadsheet_ by Peter
|
12
11
|
Duffet-Smith and Jonathan Zwart
|
13
12
|
|
13
|
+
Solar System bodies' positions are computed based on ephemerides from the
|
14
|
+
[IMCCE] or [NASA/JPL].
|
15
|
+
|
14
16
|
## Content
|
15
17
|
- [Installation](#installation)
|
16
|
-
- [Usage](#usage)
|
17
|
-
- [Angle manipulation](#angle-manipulation)
|
18
|
-
- [Coordinates conversion](#coordinates-conversion)
|
19
|
-
- [Sun](#sun)
|
20
|
-
- [Sun's location in the sky](#suns-location-in-the-sky)
|
21
|
-
- [Sunrise and sunset times and azimuths](#sunrise-and-sunset-times-and-azimuths)
|
22
|
-
- [Twilight times](#twilight-times)
|
23
|
-
- [Solstice and Equinox times](#solstice-and-equinox-times)
|
24
|
-
- [Moon](#moon)
|
25
|
-
- [Moon's location in the sky](#moons-location-in-the-sky)
|
26
|
-
- [Moon's current attributes](#moons-current-attributes)
|
27
|
-
- [Moon's phases of the month](#moons-phases-of-the-month)
|
28
|
-
- [Moonrise and moonset times and azimuths](#moonrise-and-moonset-times-and-azimuths)
|
18
|
+
- [Usage Documentation](#usage-documentation)
|
29
19
|
- [Precision](#precision)
|
30
20
|
- [Development](#development)
|
31
21
|
- [Contributing](#contributing)
|
@@ -38,306 +28,85 @@ Install the gem and add to the application's Gemfile by executing:
|
|
38
28
|
|
39
29
|
$ bundle add astronoby
|
40
30
|
|
41
|
-
If
|
31
|
+
If [Bundler] is not being used to manage dependencies, install the gem by
|
42
32
|
executing:
|
43
33
|
|
44
34
|
$ gem install astronoby
|
45
35
|
|
46
|
-
## Usage
|
47
|
-
|
48
|
-
This library is still in heavy development. The public is not stable, please
|
49
|
-
be aware new minor versions will probably lead to breaking changes until a
|
50
|
-
major one is released.
|
51
|
-
|
52
|
-
### Angle manipulation
|
53
|
-
|
54
|
-
```rb
|
55
|
-
angle1 = Astronoby::Angle.from_degrees(90)
|
56
|
-
angle2 = Astronoby::Angle.from_radians(Math::PI / 2)
|
57
|
-
angle3 = Astronoby::Angle.from_hours(12)
|
58
|
-
|
59
|
-
angle1 == angle2
|
60
|
-
# => true
|
61
|
-
|
62
|
-
angle1 < angle3
|
63
|
-
# => true
|
64
|
-
|
65
|
-
angle = angle1 + angle2 + angle3
|
66
|
-
angle.cos
|
67
|
-
# => 1.0
|
68
|
-
```
|
69
|
-
|
70
|
-
### Distance manipulation
|
71
|
-
|
72
|
-
```rb
|
73
|
-
distance1 = Astronoby::Distance.from_astronomical_units(1)
|
74
|
-
distance2 = Astronoby::Distance.from_kilometers(149_597_870.7)
|
75
|
-
distance3 = Astronoby::Distance.from_meters(300)
|
76
|
-
|
77
|
-
distance1 == distance2
|
78
|
-
# => true
|
79
|
-
|
80
|
-
distance1 > distance3
|
81
|
-
# => true
|
82
|
-
|
83
|
-
distance =
|
84
|
-
Astronoby::Distance.from_m(300) +
|
85
|
-
Astronoby::Distance.from_km(3)
|
86
|
-
|
87
|
-
distance.km
|
88
|
-
# => 3.3
|
89
|
-
```
|
90
|
-
|
91
|
-
### Coordinates conversion
|
92
|
-
|
93
|
-
```rb
|
94
|
-
observer = Astronoby::Observer.new(
|
95
|
-
latitude: Astronoby::Angle.from_degrees(38),
|
96
|
-
longitude: Astronoby::Angle.from_degrees(-78)
|
97
|
-
)
|
98
|
-
|
99
|
-
equatorial = Astronoby::Coordinates::Equatorial.new(
|
100
|
-
right_ascension: Astronoby::Angle.from_hms(17, 43, 54),
|
101
|
-
declination: Astronoby::Angle.from_dms(-22, 10, 0)
|
102
|
-
)
|
103
|
-
|
104
|
-
horizontal = equatorial.to_horizontal(
|
105
|
-
time: Time.new(2016, 1, 21, 21, 30, 0, "-05:00"),
|
106
|
-
observer: observer
|
107
|
-
)
|
108
|
-
|
109
|
-
horizontal.altitude.str(:dms)
|
110
|
-
# => "-73° 27′ 19.1557″"
|
111
|
-
|
112
|
-
horizontal.azimuth.str(:dms)
|
113
|
-
# => "+341° 33′ 21.587″"
|
114
|
-
```
|
115
|
-
|
116
|
-
### Sun
|
117
|
-
|
118
|
-
#### Sun's location in the sky
|
119
|
-
|
120
|
-
```rb
|
121
|
-
time = Time.utc(2023, 2, 17, 11, 0, 0)
|
122
|
-
|
123
|
-
observer = Astronoby::Observer.new(
|
124
|
-
latitude: Astronoby::Angle.from_degrees(48.8566),
|
125
|
-
longitude: Astronoby::Angle.from_degrees(2.3522)
|
126
|
-
)
|
127
|
-
|
128
|
-
sun = Astronoby::Sun.new(time: time)
|
36
|
+
## Usage Documentation
|
129
37
|
|
130
|
-
|
131
|
-
|
132
|
-
|
38
|
+
Since version 0.7.0, the usage documentation resides in [`docs/`]. For
|
39
|
+
previous versions, you can access the documentation in the README for each
|
40
|
+
[release].
|
133
41
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
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
|
140
48
|
|
141
|
-
|
142
|
-
|
143
|
-
Only date part of the time is relevant for the calculation. The offset must
|
144
|
-
be provided to the observer.
|
145
|
-
|
146
|
-
```rb
|
147
|
-
utc_offset = "-05:00"
|
148
|
-
time = Time.new(2015, 2, 5, 0, 0, 0, utc_offset)
|
149
|
-
observer = Astronoby::Observer.new(
|
150
|
-
latitude: Astronoby::Angle.from_degrees(38),
|
151
|
-
longitude: Astronoby::Angle.from_degrees(-78),
|
152
|
-
utc_offset: utc_offset
|
153
|
-
)
|
154
|
-
sun = Astronoby::Sun.new(time: time)
|
155
|
-
observation_events = sun.observation_events(observer: observer)
|
49
|
+
### Expected breaking changes notice
|
156
50
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
observation_events.rising_azimuth.str(:dms)
|
161
|
-
# => "+109° 29′ 35.5069″"
|
162
|
-
|
163
|
-
observation_events.transit_time.getlocal(utc_offset)
|
164
|
-
# => 2015-02-05 12:25:59 -0500
|
165
|
-
|
166
|
-
observation_events.transit_altitude.str(:dms)
|
167
|
-
# => "+36° 8′ 14.9673″"
|
168
|
-
|
169
|
-
observation_events.setting_time.getlocal(utc_offset)
|
170
|
-
# => 2015-02-05 17:39:27 -0500
|
171
|
-
|
172
|
-
observation_events.setting_azimuth.str(:dms)
|
173
|
-
# => "+250° 40′ 41.7129″"
|
174
|
-
```
|
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.
|
175
54
|
|
176
|
-
|
177
|
-
|
178
|
-
```rb
|
179
|
-
time = Time.new(2024, 1, 1)
|
180
|
-
sun = Astronoby::Sun.new(time: time)
|
181
|
-
observer = Astronoby::Observer.new(
|
182
|
-
latitude: Astronoby::Angle.from_degrees(48.8566),
|
183
|
-
longitude: Astronoby::Angle.from_degrees(2.3522)
|
184
|
-
)
|
185
|
-
twilight_events = sun.twilight_events(observer: observer)
|
186
|
-
|
187
|
-
twilight_events.morning_astronomical_twilight_time
|
188
|
-
# => 2024-01-01 05:49:25 UTC
|
189
|
-
|
190
|
-
twilight_events.morning_nautical_twilight_time
|
191
|
-
# => 2024-01-01 06:27:42 UTC
|
192
|
-
|
193
|
-
twilight_events.morning_civil_twilight_time
|
194
|
-
# => 2024-01-01 07:07:50 UTC
|
195
|
-
|
196
|
-
twilight_events.evening_civil_twilight_time
|
197
|
-
# => 2024-01-01 16:40:01 UTC
|
198
|
-
|
199
|
-
twilight_events.evening_nautical_twilight_time
|
200
|
-
# => 2024-01-01 17:20:10 UTC
|
201
|
-
|
202
|
-
twilight_events.evening_astronomical_twilight_time
|
203
|
-
# => 2024-01-01 17:58:26 UTC
|
204
|
-
```
|
205
|
-
|
206
|
-
### Solstice and Equinox times
|
207
|
-
|
208
|
-
```rb
|
209
|
-
year = 2024
|
55
|
+
Changes are documented in the [CHANGELOG] and adapting to breaking changes is
|
56
|
+
described in the [UPGRADING] document.
|
210
57
|
|
211
|
-
|
212
|
-
# => 2024-03-20 03:05:08 UTC
|
213
|
-
|
214
|
-
Astronoby::EquinoxSolstice.june_solstice(year)
|
215
|
-
# => 2024-06-20 20:50:18 UTC
|
216
|
-
```
|
58
|
+
## Precision
|
217
59
|
|
218
|
-
|
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.
|
219
63
|
|
220
|
-
|
64
|
+
While the precision is not enough for spacecraft navigation, it is enough for
|
65
|
+
automated guiding of amateur telescopes.
|
221
66
|
|
222
|
-
|
223
|
-
|
67
|
+
The sources used for comparison are: [IMCCE], [JPL Horizons], [Stellarium],
|
68
|
+
and the [Skyfield] library.
|
224
69
|
|
225
|
-
|
226
|
-
latitude: Astronoby::Angle.from_degrees(48.8566),
|
227
|
-
longitude: Astronoby::Angle.from_degrees(2.3522)
|
228
|
-
)
|
70
|
+
## Development
|
229
71
|
|
230
|
-
|
72
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
73
|
+
`rake spec` to run the tests. You can also run `bin/console` for an interactive
|
74
|
+
prompt that will allow you to experiment.
|
231
75
|
|
232
|
-
|
233
|
-
|
234
|
-
|
76
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
77
|
+
release a new version, update the version number in `version.rb`, and then run
|
78
|
+
`bundle exec rake release`, which will create a git tag for the version, push
|
79
|
+
git commits and the created tag, and push the `.gem` file to [rubygems.org].
|
235
80
|
|
236
|
-
|
237
|
-
# => 10.277834691708053
|
81
|
+
### Performance
|
238
82
|
|
239
|
-
|
240
|
-
|
241
|
-
|
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.
|
242
86
|
|
243
|
-
|
87
|
+
$ bin/console
|
244
88
|
|
245
89
|
```rb
|
246
|
-
|
247
|
-
moon = Astronoby::Moon.new(time: time)
|
90
|
+
require_relative "benchmarks/performance"
|
248
91
|
|
249
|
-
|
250
|
-
# => 0.31
|
251
|
-
|
252
|
-
moon.current_phase_fraction.round(2)
|
253
|
-
# => 0.82
|
254
|
-
|
255
|
-
moon.distance.km.round
|
256
|
-
# => 368409
|
257
|
-
|
258
|
-
moon.phase_angle.degrees.round
|
259
|
-
# => 112
|
92
|
+
PerformanceBenchmark.new.run
|
260
93
|
```
|
261
94
|
|
262
|
-
|
95
|
+
For fast feedback, you can customise the parameters:
|
263
96
|
|
264
97
|
```rb
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
)
|
269
|
-
|
270
|
-
june_phases.each { puts "#{_1.phase}: #{_1.time}" }
|
271
|
-
# new_moon: 2024-06-06 12:37:41 UTC
|
272
|
-
# first_quarter: 2024-06-14 05:18:28 UTC
|
273
|
-
# full_moon: 2024-06-22 01:07:53 UTC
|
274
|
-
# last_quarter: 2024-06-28 21:53:25 UTC
|
98
|
+
PerformanceBenchmark
|
99
|
+
.new(warmup_runs: 1, measure_runs: 3, iterations_per_run: 5)
|
100
|
+
.run
|
275
101
|
```
|
276
102
|
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
be provided to the observer.
|
281
|
-
|
282
|
-
```rb
|
283
|
-
utc_offset = "-10:00"
|
284
|
-
time = Time.new(2024, 9, 1, 0, 0, 0, utc_offset)
|
285
|
-
observer = Astronoby::Observer.new(
|
286
|
-
latitude: Astronoby::Angle.from_degrees(-17.5325),
|
287
|
-
longitude: Astronoby::Angle.from_degrees(-149.5677),
|
288
|
-
utc_offset: utc_offset
|
289
|
-
)
|
290
|
-
moon = Astronoby::Moon.new(time: time)
|
291
|
-
observation_events = moon.observation_events(observer: observer)
|
292
|
-
|
293
|
-
observation_events.rising_time.getlocal(utc_offset)
|
294
|
-
# => 2024-09-01 05:24:55 -1000
|
295
|
-
|
296
|
-
observation_events.rising_azimuth.str(:dms)
|
297
|
-
# => "+72° 15′ 19.1814″"
|
298
|
-
|
299
|
-
observation_events.transit_time.getlocal(utc_offset)
|
300
|
-
# => 2024-09-01 11:12:32 -1000
|
301
|
-
|
302
|
-
observation_events.transit_altitude.str(:dms)
|
303
|
-
# => "+56° 39′ 59.132″"
|
304
|
-
|
305
|
-
observation_events.setting_time.getlocal(utc_offset)
|
306
|
-
# => 2024-09-01 16:12:08 -1000
|
307
|
-
|
308
|
-
observation_events.setting_azimuth.str(:dms)
|
309
|
-
# => "+290° 25′ 42.5421″"
|
310
|
-
```
|
311
|
-
|
312
|
-
## Precision
|
313
|
-
|
314
|
-
The current precision for the Sun's apparent location in the sky, compared
|
315
|
-
to values computed by the [IMCCE] is approximately 1 arc minute. It corresponds
|
316
|
-
to twice the apparent size of Jupiter when it is the closest to Earth.
|
317
|
-
|
318
|
-
While the precision is not enough for very high accuracy computations, it is
|
319
|
-
equal to the Human naked eye's angular resolution.
|
320
|
-
|
321
|
-
[IMCCE]: https://www.imcce.fr
|
322
|
-
|
323
|
-
## Development
|
324
|
-
|
325
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
326
|
-
`rake spec` to run the tests. You can also run `bin/console` for an interactive
|
327
|
-
prompt that will allow you to experiment.
|
328
|
-
|
329
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To
|
330
|
-
release a new version, update the version number in `version.rb`, and then run
|
331
|
-
`bundle exec rake release`, which will create a git tag for the version, push
|
332
|
-
git commits and the created tag, and push the `.gem` file to [rubygems.org].
|
333
|
-
|
334
|
-
[rubygems.org]: https://rubygems.org
|
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.
|
335
106
|
|
336
107
|
## Contributing
|
337
108
|
|
338
|
-
Please see [CONTRIBUTING.md]
|
339
|
-
|
340
|
-
[code of conduct]: https://github.com/rhannequin/astronoby/blob/main/CODE_OF_CONDUCT.md
|
109
|
+
Please see [CONTRIBUTING.md].
|
341
110
|
|
342
111
|
## License
|
343
112
|
|
@@ -350,4 +119,16 @@ The gem is available as open source under the terms of the [MIT License].
|
|
350
119
|
Everyone interacting in the Astronoby project's codebases, issue trackers, chat
|
351
120
|
rooms and mailing lists is expected to follow the [code of conduct].
|
352
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
|
353
134
|
[code of conduct]: https://github.com/rhannequin/astronoby/blob/main/CODE_OF_CONDUCT.md
|