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
@@ -1,285 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Astronoby
|
4
|
-
module Events
|
5
|
-
class ObservationEvents
|
6
|
-
STANDARD_ALTITUDE = Angle.from_dms(0, -34, 0)
|
7
|
-
RISING_SETTING_HOUR_ANGLE_RATIO_RANGE = (-1..1)
|
8
|
-
EARTH_SIDEREAL_ROTATION_RATE = 360.98564736629
|
9
|
-
ITERATION_PRECISION = 0.0001
|
10
|
-
ITERATION_LIMIT = 5
|
11
|
-
|
12
|
-
attr_reader :rising_time,
|
13
|
-
:rising_azimuth,
|
14
|
-
:transit_time,
|
15
|
-
:transit_altitude,
|
16
|
-
:setting_time,
|
17
|
-
:setting_azimuth
|
18
|
-
|
19
|
-
# Source:
|
20
|
-
# Title: Astronomical Algorithms
|
21
|
-
# Author: Jean Meeus
|
22
|
-
# Edition: 2nd edition
|
23
|
-
# Chapter: 15 - Rising, Transit, and Setting
|
24
|
-
|
25
|
-
# @param observer [Astronoby::Observer] Observer
|
26
|
-
# @param date [Date] Date of the event
|
27
|
-
# @param coordinates_of_the_previous_day [Astronoby::Coordinates::Equatorial]
|
28
|
-
# Coordinates of the body of the previous day
|
29
|
-
# @param coordinates_of_the_day [Astronoby::Coordinates::Equatorial]
|
30
|
-
# Coordinates of the body of the day
|
31
|
-
# @param coordinates_of_the_next_day [Astronoby::Coordinates::Equatorial]
|
32
|
-
# Coordinates of the body of the next day
|
33
|
-
# @param additional_altitude [Astronoby::Angle] Additional altitude to the
|
34
|
-
# standard altitude adjustment
|
35
|
-
def initialize(
|
36
|
-
observer:,
|
37
|
-
date:,
|
38
|
-
coordinates_of_the_previous_day:,
|
39
|
-
coordinates_of_the_day:,
|
40
|
-
coordinates_of_the_next_day:,
|
41
|
-
additional_altitude: Angle.zero
|
42
|
-
)
|
43
|
-
@observer = observer
|
44
|
-
@date = date
|
45
|
-
@coordinates_of_the_previous_day = coordinates_of_the_previous_day
|
46
|
-
@coordinates_of_the_day = coordinates_of_the_day
|
47
|
-
@coordinates_of_the_next_day = coordinates_of_the_next_day
|
48
|
-
@standard_altitude = STANDARD_ALTITUDE
|
49
|
-
@additional_altitude = additional_altitude
|
50
|
-
compute
|
51
|
-
end
|
52
|
-
|
53
|
-
private
|
54
|
-
|
55
|
-
def compute
|
56
|
-
@initial_transit = initial_transit
|
57
|
-
@transit_time = Util::Time.decimal_hour_to_time(
|
58
|
-
@date,
|
59
|
-
@observer.utc_offset,
|
60
|
-
@initial_transit
|
61
|
-
)
|
62
|
-
@transit_altitude = local_horizontal_altitude_transit
|
63
|
-
|
64
|
-
return if h0.nil?
|
65
|
-
|
66
|
-
initial_rising = rationalize_decimal_time(
|
67
|
-
@initial_transit - h0.degrees / Constants::DEGREES_PER_CIRCLE
|
68
|
-
)
|
69
|
-
|
70
|
-
initial_setting = rationalize_decimal_time(
|
71
|
-
@initial_transit + h0.degrees / Constants::DEGREES_PER_CIRCLE
|
72
|
-
)
|
73
|
-
|
74
|
-
@final_rising, @final_transit, @final_setting =
|
75
|
-
iterate(initial_rising, @initial_transit, initial_setting)
|
76
|
-
|
77
|
-
rationalized_corrected_rising = rationalize_decimal_hours(
|
78
|
-
Constants::HOURS_PER_DAY * @final_rising
|
79
|
-
)
|
80
|
-
rationalized_corrected_transit = rationalize_decimal_hours(
|
81
|
-
Constants::HOURS_PER_DAY * @final_transit
|
82
|
-
)
|
83
|
-
rationalized_corrected_setting = rationalize_decimal_hours(
|
84
|
-
Constants::HOURS_PER_DAY * @final_setting
|
85
|
-
)
|
86
|
-
|
87
|
-
@rising_time = Util::Time.decimal_hour_to_time(
|
88
|
-
@date,
|
89
|
-
@observer.utc_offset,
|
90
|
-
rationalized_corrected_rising
|
91
|
-
)
|
92
|
-
@rising_azimuth = local_horizontal_azimuth_rising
|
93
|
-
@transit_time = Util::Time.decimal_hour_to_time(
|
94
|
-
@date,
|
95
|
-
@observer.utc_offset,
|
96
|
-
rationalized_corrected_transit
|
97
|
-
)
|
98
|
-
@transit_altitude = local_horizontal_altitude_transit
|
99
|
-
@setting_time = Util::Time.decimal_hour_to_time(
|
100
|
-
@date,
|
101
|
-
@observer.utc_offset,
|
102
|
-
rationalized_corrected_setting
|
103
|
-
)
|
104
|
-
@setting_azimuth = local_horizontal_azimuth_setting
|
105
|
-
end
|
106
|
-
|
107
|
-
def iterate(initial_rising, initial_transit, initial_setting)
|
108
|
-
delta = 1
|
109
|
-
iteration = 1
|
110
|
-
corrected_rising = initial_rising
|
111
|
-
corrected_transit = initial_transit
|
112
|
-
corrected_setting = initial_setting
|
113
|
-
until delta < ITERATION_PRECISION || iteration > ITERATION_LIMIT
|
114
|
-
iterate = RiseTransitSetIteration.new(
|
115
|
-
observer: @observer,
|
116
|
-
date: @date,
|
117
|
-
coordinates_of_the_next_day: @coordinates_of_the_next_day,
|
118
|
-
coordinates_of_the_day: @coordinates_of_the_day,
|
119
|
-
coordinates_of_the_previous_day: @coordinates_of_the_previous_day,
|
120
|
-
shift: shift,
|
121
|
-
initial_rising: corrected_rising,
|
122
|
-
initial_transit: corrected_transit,
|
123
|
-
initial_setting: corrected_setting
|
124
|
-
).iterate
|
125
|
-
delta = iterate.sum
|
126
|
-
corrected_rising = rationalize_decimal_time corrected_rising + iterate[0]
|
127
|
-
corrected_transit = rationalize_decimal_time corrected_transit + iterate[1]
|
128
|
-
corrected_setting = rationalize_decimal_time corrected_setting + iterate[2]
|
129
|
-
iteration += 1
|
130
|
-
end
|
131
|
-
[corrected_rising, corrected_transit, corrected_setting]
|
132
|
-
end
|
133
|
-
|
134
|
-
def observer_longitude
|
135
|
-
# Longitude must be treated positively westwards from the meridian of
|
136
|
-
# Greenwich, and negatively to the east
|
137
|
-
-@observer.longitude
|
138
|
-
end
|
139
|
-
|
140
|
-
def initial_transit
|
141
|
-
rationalize_decimal_time(
|
142
|
-
(
|
143
|
-
@coordinates_of_the_day.right_ascension.degrees +
|
144
|
-
observer_longitude.degrees -
|
145
|
-
apparent_gst_at_midnight.degrees
|
146
|
-
) / Constants::DEGREES_PER_CIRCLE
|
147
|
-
)
|
148
|
-
end
|
149
|
-
|
150
|
-
def h0
|
151
|
-
@h0 ||= begin
|
152
|
-
term1 = shift.sin -
|
153
|
-
@observer.latitude.sin * @coordinates_of_the_day.declination.sin
|
154
|
-
term2 = @observer.latitude.cos * @coordinates_of_the_day.declination.cos
|
155
|
-
ratio = term1 / term2
|
156
|
-
return nil unless RISING_SETTING_HOUR_ANGLE_RATIO_RANGE.cover?(ratio)
|
157
|
-
|
158
|
-
Angle.acos(ratio)
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
def apparent_gst_at_midnight
|
163
|
-
Angle.from_hours(
|
164
|
-
GreenwichSiderealTime.from_utc(
|
165
|
-
Time.utc(@date.year, @date.month, @date.day)
|
166
|
-
).time
|
167
|
-
)
|
168
|
-
end
|
169
|
-
|
170
|
-
def gst_transit
|
171
|
-
Angle.from_degrees(
|
172
|
-
apparent_gst_at_midnight.degrees +
|
173
|
-
EARTH_SIDEREAL_ROTATION_RATE * (@final_transit || @initial_transit)
|
174
|
-
)
|
175
|
-
end
|
176
|
-
|
177
|
-
def local_hour_angle_transit
|
178
|
-
gst_transit - observer_longitude - right_ascension_transit
|
179
|
-
end
|
180
|
-
|
181
|
-
def local_horizontal_azimuth_rising
|
182
|
-
term1 = declination_rising.sin + (-shift).sin * @observer.latitude.cos
|
183
|
-
term2 = (-shift).cos * @observer.latitude.cos
|
184
|
-
angle = term1 / term2
|
185
|
-
return nil if angle.abs > 1
|
186
|
-
|
187
|
-
Angle.acos(angle)
|
188
|
-
end
|
189
|
-
|
190
|
-
def local_horizontal_altitude_transit
|
191
|
-
Angle.asin(
|
192
|
-
@observer.latitude.sin * declination_transit.sin +
|
193
|
-
@observer.latitude.cos * declination_transit.cos * local_hour_angle_transit.cos
|
194
|
-
)
|
195
|
-
end
|
196
|
-
|
197
|
-
def local_horizontal_azimuth_setting
|
198
|
-
term1 = declination_setting.sin + (-shift).sin * @observer.latitude.cos
|
199
|
-
term2 = (-shift).cos * @observer.latitude.cos
|
200
|
-
angle = term1 / term2
|
201
|
-
return nil if angle.abs > 1
|
202
|
-
|
203
|
-
Angle.from_degrees(
|
204
|
-
Constants::DEGREES_PER_CIRCLE - Angle.acos(angle).degrees
|
205
|
-
)
|
206
|
-
end
|
207
|
-
|
208
|
-
def rationalize_decimal_time(decimal_time)
|
209
|
-
decimal_time += 1 while decimal_time.negative?
|
210
|
-
decimal_time -= 1 while decimal_time > 1
|
211
|
-
decimal_time
|
212
|
-
end
|
213
|
-
|
214
|
-
def rationalize_decimal_hours(decimal_hours)
|
215
|
-
decimal_hours += Constants::HOURS_PER_DAY if decimal_hours.negative?
|
216
|
-
decimal_hours -= Constants::HOURS_PER_DAY if decimal_hours > Constants::HOURS_PER_DAY
|
217
|
-
decimal_hours
|
218
|
-
end
|
219
|
-
|
220
|
-
def right_ascension_transit
|
221
|
-
Angle.from_degrees(
|
222
|
-
Util::Maths.interpolate(
|
223
|
-
Util::Maths.normalize_angles_for_interpolation(
|
224
|
-
[
|
225
|
-
@coordinates_of_the_previous_day.right_ascension.degrees,
|
226
|
-
@coordinates_of_the_day.right_ascension.degrees,
|
227
|
-
@coordinates_of_the_next_day.right_ascension.degrees
|
228
|
-
]
|
229
|
-
),
|
230
|
-
@final_transit || @initial_transit
|
231
|
-
)
|
232
|
-
)
|
233
|
-
end
|
234
|
-
|
235
|
-
def declination_rising
|
236
|
-
Angle.from_degrees(
|
237
|
-
Util::Maths.interpolate(
|
238
|
-
Util::Maths.normalize_angles_for_interpolation(
|
239
|
-
[
|
240
|
-
@coordinates_of_the_previous_day.declination.degrees,
|
241
|
-
@coordinates_of_the_day.declination.degrees,
|
242
|
-
@coordinates_of_the_next_day.declination.degrees
|
243
|
-
]
|
244
|
-
),
|
245
|
-
@final_rising
|
246
|
-
)
|
247
|
-
)
|
248
|
-
end
|
249
|
-
|
250
|
-
def declination_transit
|
251
|
-
Angle.from_degrees(
|
252
|
-
Util::Maths.interpolate(
|
253
|
-
Util::Maths.normalize_angles_for_interpolation(
|
254
|
-
[
|
255
|
-
@coordinates_of_the_previous_day.declination.degrees,
|
256
|
-
@coordinates_of_the_day.declination.degrees,
|
257
|
-
@coordinates_of_the_next_day.declination.degrees
|
258
|
-
]
|
259
|
-
),
|
260
|
-
@final_transit || @initial_transit
|
261
|
-
)
|
262
|
-
)
|
263
|
-
end
|
264
|
-
|
265
|
-
def declination_setting
|
266
|
-
Angle.from_degrees(
|
267
|
-
Util::Maths.interpolate(
|
268
|
-
Util::Maths.normalize_angles_for_interpolation(
|
269
|
-
[
|
270
|
-
@coordinates_of_the_previous_day.declination.degrees,
|
271
|
-
@coordinates_of_the_day.declination.degrees,
|
272
|
-
@coordinates_of_the_next_day.declination.degrees
|
273
|
-
]
|
274
|
-
),
|
275
|
-
@final_setting
|
276
|
-
)
|
277
|
-
)
|
278
|
-
end
|
279
|
-
|
280
|
-
def shift
|
281
|
-
@standard_altitude - @additional_altitude
|
282
|
-
end
|
283
|
-
end
|
284
|
-
end
|
285
|
-
end
|
@@ -1,218 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Astronoby
|
4
|
-
class RiseTransitSetIteration
|
5
|
-
EARTH_SIDEREAL_ROTATION_RATE = 360.98564736629
|
6
|
-
|
7
|
-
# Source:
|
8
|
-
# Title: Astronomical Algorithms
|
9
|
-
# Author: Jean Meeus
|
10
|
-
# Edition: 2nd edition
|
11
|
-
# Chapter: 15 - Rising, Transit, and Setting
|
12
|
-
|
13
|
-
# @param observer [Astronoby::Observer] Observer
|
14
|
-
# @param date [Date] Date of the event
|
15
|
-
# @param coordinates_of_the_previous_day [Astronoby::Coordinates::Equatorial]
|
16
|
-
# Coordinates of the body of the previous day
|
17
|
-
# @param coordinates_of_the_day [Astronoby::Coordinates::Equatorial]
|
18
|
-
# Coordinates of the body of the day
|
19
|
-
# @param coordinates_of_the_next_day [Astronoby::Coordinates::Equatorial]
|
20
|
-
# Coordinates of the body of the next day
|
21
|
-
# @param shift [Astronoby::Angle] Altitude shift
|
22
|
-
# @param initial_rising [Float] Initial rising
|
23
|
-
# @param initial_transit [Float] Initial transit
|
24
|
-
# @param initial_setting [Float] Initial setting
|
25
|
-
def initialize(
|
26
|
-
observer:,
|
27
|
-
date:,
|
28
|
-
coordinates_of_the_previous_day:,
|
29
|
-
coordinates_of_the_day:,
|
30
|
-
coordinates_of_the_next_day:,
|
31
|
-
shift:,
|
32
|
-
initial_rising:,
|
33
|
-
initial_transit:,
|
34
|
-
initial_setting:
|
35
|
-
)
|
36
|
-
@observer = observer
|
37
|
-
@date = date
|
38
|
-
@coordinates_of_the_previous_day = coordinates_of_the_previous_day
|
39
|
-
@coordinates_of_the_day = coordinates_of_the_day
|
40
|
-
@coordinates_of_the_next_day = coordinates_of_the_next_day
|
41
|
-
@shift = shift
|
42
|
-
@initial_rising = initial_rising
|
43
|
-
@initial_transit = initial_transit
|
44
|
-
@initial_setting = initial_setting
|
45
|
-
end
|
46
|
-
|
47
|
-
# @return [Array<Float>] Iteration results
|
48
|
-
def iterate
|
49
|
-
[
|
50
|
-
delta_m_rising,
|
51
|
-
delta_m_transit,
|
52
|
-
delta_m_setting
|
53
|
-
]
|
54
|
-
end
|
55
|
-
|
56
|
-
private
|
57
|
-
|
58
|
-
def delta_m_rising
|
59
|
-
(local_horizontal_altitude_rising - @shift).degrees./(
|
60
|
-
Constants::DEGREES_PER_CIRCLE *
|
61
|
-
declination_rising.cos *
|
62
|
-
@observer.latitude.cos *
|
63
|
-
local_hour_angle_rising.sin
|
64
|
-
)
|
65
|
-
end
|
66
|
-
|
67
|
-
def delta_m_transit
|
68
|
-
-local_hour_angle_transit.degrees / Constants::DEGREES_PER_CIRCLE
|
69
|
-
end
|
70
|
-
|
71
|
-
def delta_m_setting
|
72
|
-
(local_horizontal_altitude_setting - @shift).degrees./(
|
73
|
-
Constants::DEGREES_PER_CIRCLE *
|
74
|
-
declination_setting.cos *
|
75
|
-
@observer.latitude.cos *
|
76
|
-
local_hour_angle_setting.sin
|
77
|
-
)
|
78
|
-
end
|
79
|
-
|
80
|
-
def observer_longitude
|
81
|
-
# Longitude must be treated positively westwards from the meridian of
|
82
|
-
# Greenwich, and negatively to the east
|
83
|
-
@observer_longitude ||= -@observer.longitude
|
84
|
-
end
|
85
|
-
|
86
|
-
def apparent_gst_at_midnight
|
87
|
-
@apparent_gst_at_midnight ||= Angle.from_hours(
|
88
|
-
GreenwichSiderealTime.from_utc(
|
89
|
-
Time.utc(@date.year, @date.month, @date.day)
|
90
|
-
).time
|
91
|
-
)
|
92
|
-
end
|
93
|
-
|
94
|
-
def gst_rising
|
95
|
-
@gst_rising ||= Angle.from_degrees(
|
96
|
-
apparent_gst_at_midnight.degrees +
|
97
|
-
EARTH_SIDEREAL_ROTATION_RATE * @initial_rising
|
98
|
-
)
|
99
|
-
end
|
100
|
-
|
101
|
-
def gst_transit
|
102
|
-
@gst_transit ||= Angle.from_degrees(
|
103
|
-
apparent_gst_at_midnight.degrees +
|
104
|
-
EARTH_SIDEREAL_ROTATION_RATE * @initial_transit
|
105
|
-
)
|
106
|
-
end
|
107
|
-
|
108
|
-
def gst_setting
|
109
|
-
@gst_setting ||= Angle.from_degrees(
|
110
|
-
apparent_gst_at_midnight.degrees +
|
111
|
-
EARTH_SIDEREAL_ROTATION_RATE * @initial_setting
|
112
|
-
)
|
113
|
-
end
|
114
|
-
|
115
|
-
def local_hour_angle_rising
|
116
|
-
@local_hour_angle_rising ||=
|
117
|
-
gst_rising - observer_longitude - right_ascension_rising
|
118
|
-
end
|
119
|
-
|
120
|
-
def local_hour_angle_transit
|
121
|
-
gst_transit - observer_longitude - right_ascension_transit
|
122
|
-
end
|
123
|
-
|
124
|
-
def local_hour_angle_setting
|
125
|
-
@local_hour_angle_setting ||=
|
126
|
-
gst_setting - observer_longitude - right_ascension_setting
|
127
|
-
end
|
128
|
-
|
129
|
-
def local_horizontal_altitude_rising
|
130
|
-
Angle.asin(
|
131
|
-
@observer.latitude.sin * declination_rising.sin +
|
132
|
-
@observer.latitude.cos * declination_rising.cos * local_hour_angle_rising.cos
|
133
|
-
)
|
134
|
-
end
|
135
|
-
|
136
|
-
def local_horizontal_altitude_setting
|
137
|
-
Angle.asin(
|
138
|
-
@observer.latitude.sin * declination_setting.sin +
|
139
|
-
@observer.latitude.cos * declination_setting.cos * local_hour_angle_setting.cos
|
140
|
-
)
|
141
|
-
end
|
142
|
-
|
143
|
-
def right_ascension_rising
|
144
|
-
Angle.from_degrees(
|
145
|
-
Util::Maths.interpolate(
|
146
|
-
Util::Maths.normalize_angles_for_interpolation(
|
147
|
-
[
|
148
|
-
@coordinates_of_the_previous_day.right_ascension.degrees,
|
149
|
-
@coordinates_of_the_day.right_ascension.degrees,
|
150
|
-
@coordinates_of_the_next_day.right_ascension.degrees
|
151
|
-
]
|
152
|
-
),
|
153
|
-
@initial_rising
|
154
|
-
)
|
155
|
-
)
|
156
|
-
end
|
157
|
-
|
158
|
-
def right_ascension_transit
|
159
|
-
Angle.from_degrees(
|
160
|
-
Util::Maths.interpolate(
|
161
|
-
Util::Maths.normalize_angles_for_interpolation(
|
162
|
-
[
|
163
|
-
@coordinates_of_the_previous_day.right_ascension.degrees,
|
164
|
-
@coordinates_of_the_day.right_ascension.degrees,
|
165
|
-
@coordinates_of_the_next_day.right_ascension.degrees
|
166
|
-
]
|
167
|
-
),
|
168
|
-
@initial_transit
|
169
|
-
)
|
170
|
-
)
|
171
|
-
end
|
172
|
-
|
173
|
-
def right_ascension_setting
|
174
|
-
Angle.from_degrees(
|
175
|
-
Util::Maths.interpolate(
|
176
|
-
Util::Maths.normalize_angles_for_interpolation(
|
177
|
-
[
|
178
|
-
@coordinates_of_the_previous_day.right_ascension.degrees,
|
179
|
-
@coordinates_of_the_day.right_ascension.degrees,
|
180
|
-
@coordinates_of_the_next_day.right_ascension.degrees
|
181
|
-
]
|
182
|
-
),
|
183
|
-
@initial_setting
|
184
|
-
)
|
185
|
-
)
|
186
|
-
end
|
187
|
-
|
188
|
-
def declination_rising
|
189
|
-
Angle.from_degrees(
|
190
|
-
Util::Maths.interpolate(
|
191
|
-
Util::Maths.normalize_angles_for_interpolation(
|
192
|
-
[
|
193
|
-
@coordinates_of_the_previous_day.declination.degrees,
|
194
|
-
@coordinates_of_the_day.declination.degrees,
|
195
|
-
@coordinates_of_the_next_day.declination.degrees
|
196
|
-
]
|
197
|
-
),
|
198
|
-
@initial_rising
|
199
|
-
)
|
200
|
-
)
|
201
|
-
end
|
202
|
-
|
203
|
-
def declination_setting
|
204
|
-
Angle.from_degrees(
|
205
|
-
Util::Maths.interpolate(
|
206
|
-
Util::Maths.normalize_angles_for_interpolation(
|
207
|
-
[
|
208
|
-
@coordinates_of_the_previous_day.declination.degrees,
|
209
|
-
@coordinates_of_the_day.declination.degrees,
|
210
|
-
@coordinates_of_the_next_day.declination.degrees
|
211
|
-
]
|
212
|
-
),
|
213
|
-
@initial_setting
|
214
|
-
)
|
215
|
-
)
|
216
|
-
end
|
217
|
-
end
|
218
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Astronoby
|
4
|
-
module Util
|
5
|
-
module Astrodynamics
|
6
|
-
class << self
|
7
|
-
# Source:
|
8
|
-
# Title: Celestial Calculations
|
9
|
-
# Author: J. L. Lawrence
|
10
|
-
# Edition: MIT Press
|
11
|
-
# Chapter: 4 - Orbits and Coordinate Systems
|
12
|
-
def eccentric_anomaly_newton_raphson(
|
13
|
-
mean_anomaly,
|
14
|
-
orbital_eccentricity,
|
15
|
-
precision,
|
16
|
-
maximum_iteration_count,
|
17
|
-
current_iteration = 0,
|
18
|
-
solution_on_previous_interation = nil
|
19
|
-
)
|
20
|
-
previous_solution = solution_on_previous_interation&.radians
|
21
|
-
|
22
|
-
solution = if previous_solution.nil?
|
23
|
-
if orbital_eccentricity <= 0.75
|
24
|
-
mean_anomaly.radians
|
25
|
-
else
|
26
|
-
Math::PI
|
27
|
-
end
|
28
|
-
else
|
29
|
-
previous_solution - (
|
30
|
-
(
|
31
|
-
previous_solution -
|
32
|
-
orbital_eccentricity * Math.sin(previous_solution) -
|
33
|
-
mean_anomaly.radians
|
34
|
-
) / (
|
35
|
-
1 - orbital_eccentricity * Math.cos(previous_solution)
|
36
|
-
)
|
37
|
-
)
|
38
|
-
end
|
39
|
-
|
40
|
-
if current_iteration >= maximum_iteration_count ||
|
41
|
-
(
|
42
|
-
previous_solution &&
|
43
|
-
(solution - previous_solution).abs <= precision
|
44
|
-
)
|
45
|
-
return Angle.from_radians(solution)
|
46
|
-
end
|
47
|
-
|
48
|
-
eccentric_anomaly_newton_raphson(
|
49
|
-
mean_anomaly,
|
50
|
-
orbital_eccentricity,
|
51
|
-
precision,
|
52
|
-
maximum_iteration_count,
|
53
|
-
current_iteration + 1,
|
54
|
-
Angle.from_radians(solution)
|
55
|
-
)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|