astronoby 0.9.0 → 0.11.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 -1
- data/CHANGELOG.md +235 -0
- data/README.md +19 -1
- data/UPGRADING.md +270 -0
- data/docs/README.md +105 -16
- data/docs/altitude_crossings.md +92 -0
- data/docs/angles.md +1 -0
- data/docs/configuration.md +28 -17
- data/docs/coordinates.md +72 -12
- data/docs/deep_sky_bodies.md +46 -1
- data/docs/ephem.md +5 -2
- data/docs/equinoxes_solstices_times.md +4 -3
- data/docs/glossary.md +99 -1
- data/docs/iers.md +40 -0
- data/docs/instant.md +33 -21
- data/docs/lunar_eclipses.md +208 -0
- data/docs/lunar_observation.md +87 -0
- data/docs/moon_phases.md +4 -1
- data/docs/observer.md +20 -6
- data/docs/planetary_phenomena.md +78 -0
- data/docs/reference_frames.md +192 -34
- data/docs/rise_transit_set_times.md +6 -4
- data/docs/solar_system_bodies.md +26 -4
- data/docs/twilight_times.md +43 -24
- data/lib/astronoby/angle.rb +63 -2
- data/lib/astronoby/angles/dms.rb +18 -1
- data/lib/astronoby/angles/hms.rb +14 -1
- data/lib/astronoby/angular_velocity.rb +21 -0
- data/lib/astronoby/bodies/deep_sky_object.rb +6 -1
- data/lib/astronoby/bodies/deep_sky_object_position.rb +35 -38
- data/lib/astronoby/bodies/earth.rb +7 -44
- data/lib/astronoby/bodies/jupiter.rb +10 -0
- data/lib/astronoby/bodies/mars.rb +10 -0
- data/lib/astronoby/bodies/mercury.rb +10 -0
- data/lib/astronoby/bodies/moon.rb +158 -32
- data/lib/astronoby/bodies/neptune.rb +10 -0
- data/lib/astronoby/bodies/saturn.rb +10 -0
- data/lib/astronoby/bodies/solar_system_body.rb +240 -61
- data/lib/astronoby/bodies/sun.rb +79 -4
- data/lib/astronoby/bodies/uranus.rb +10 -0
- data/lib/astronoby/bodies/venus.rb +10 -0
- data/lib/astronoby/body.rb +6 -0
- data/lib/astronoby/cache.rb +13 -0
- data/lib/astronoby/center.rb +84 -0
- data/lib/astronoby/constants.rb +1 -2
- data/lib/astronoby/constellation.rb +9 -1
- data/lib/astronoby/constellations/data.rb +1 -1
- data/lib/astronoby/coordinates/ecliptic.rb +10 -1
- data/lib/astronoby/coordinates/equatorial.rb +79 -13
- data/lib/astronoby/coordinates/geodetic.rb +102 -0
- data/lib/astronoby/coordinates/horizontal.rb +13 -1
- data/lib/astronoby/delta_t.rb +44 -0
- data/lib/astronoby/distance.rb +35 -0
- data/lib/astronoby/duration.rb +116 -0
- data/lib/astronoby/earth_rotation.rb +70 -0
- data/lib/astronoby/equinox_solstice.rb +31 -8
- data/lib/astronoby/errors.rb +11 -0
- data/lib/astronoby/events/altitude_crossing.rb +29 -0
- data/lib/astronoby/events/altitude_crossing_calculator.rb +511 -0
- data/lib/astronoby/events/altitude_extreme.rb +31 -0
- data/lib/astronoby/events/conjunction.rb +51 -0
- data/lib/astronoby/events/conjunction_opposition_calculator.rb +84 -0
- data/lib/astronoby/events/extremum_calculator.rb +23 -176
- data/lib/astronoby/events/greatest_elongation.rb +58 -0
- data/lib/astronoby/events/greatest_elongation_calculator.rb +56 -0
- data/lib/astronoby/events/lunar_eclipse.rb +111 -0
- data/lib/astronoby/events/lunar_eclipse_calculator.rb +397 -0
- data/lib/astronoby/events/lunar_eclipse_geometry.rb +115 -0
- data/lib/astronoby/events/lunar_eclipse_phase.rb +45 -0
- data/lib/astronoby/events/lunar_eclipse_visibility.rb +296 -0
- data/lib/astronoby/events/opposition.rb +19 -0
- data/lib/astronoby/events/rise_transit_set_calculator.rb +9 -13
- data/lib/astronoby/events/rise_transit_set_event.rb +12 -1
- data/lib/astronoby/events/rise_transit_set_events.rb +12 -1
- data/lib/astronoby/events/twilight_calculator.rb +37 -147
- data/lib/astronoby/events/twilight_event.rb +24 -6
- data/lib/astronoby/events/twilight_events.rb +26 -6
- data/lib/astronoby/extremum_finder.rb +148 -0
- data/lib/astronoby/horizon.rb +40 -0
- data/lib/astronoby/horizontal_transformation.rb +112 -0
- data/lib/astronoby/instant.rb +56 -16
- data/lib/astronoby/libration.rb +25 -0
- data/lib/astronoby/mean_obliquity.rb +8 -0
- data/lib/astronoby/moon_orientation_ephemeris.rb +69 -0
- data/lib/astronoby/moon_physical_ephemeris.rb +263 -0
- data/lib/astronoby/nutation.rb +10 -20
- data/lib/astronoby/observer.rb +67 -49
- data/lib/astronoby/orientation.rb +107 -0
- data/lib/astronoby/position.rb +16 -0
- data/lib/astronoby/precession.rb +62 -61
- data/lib/astronoby/reference_frame.rb +80 -9
- data/lib/astronoby/reference_frames/apparent.rb +43 -12
- data/lib/astronoby/reference_frames/astrometric.rb +14 -1
- data/lib/astronoby/reference_frames/geometric.rb +7 -1
- data/lib/astronoby/reference_frames/mean_of_date.rb +19 -1
- data/lib/astronoby/reference_frames/teme.rb +159 -0
- data/lib/astronoby/reference_frames/topocentric.rb +36 -4
- data/lib/astronoby/refraction.rb +26 -5
- data/lib/astronoby/root_finder.rb +90 -0
- data/lib/astronoby/rotation.rb +49 -0
- data/lib/astronoby/time/greenwich_apparent_sidereal_time.rb +19 -8
- data/lib/astronoby/time/greenwich_mean_sidereal_time.rb +44 -5
- data/lib/astronoby/time/greenwich_sidereal_time.rb +21 -0
- data/lib/astronoby/time/local_apparent_sidereal_time.rb +21 -0
- data/lib/astronoby/time/local_mean_sidereal_time.rb +21 -0
- data/lib/astronoby/time/local_sidereal_time.rb +24 -0
- data/lib/astronoby/time/sidereal_time.rb +23 -1
- data/lib/astronoby/true_obliquity.rb +4 -0
- data/lib/astronoby/util/maths.rb +8 -0
- data/lib/astronoby/util/time.rb +0 -497
- data/lib/astronoby/vector.rb +10 -0
- data/lib/astronoby/velocity.rb +39 -0
- data/lib/astronoby/version.rb +1 -1
- data/lib/astronoby.rb +30 -0
- metadata +80 -5
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Astronoby
|
|
4
|
+
# Represents the Earth. Provides ephemeris segments for computing Earth's
|
|
5
|
+
# geometric position.
|
|
4
6
|
class Earth < SolarSystemBody
|
|
7
|
+
ORBITAL_PERIOD = 365.256
|
|
8
|
+
|
|
9
|
+
# @param ephem_source [Symbol] the ephemeris source type
|
|
10
|
+
# @return [Array<Array>] ephemeris segment identifiers
|
|
5
11
|
def self.ephemeris_segments(ephem_source)
|
|
6
12
|
if ephem_source == ::Ephem::SPK::JPL_DE
|
|
7
13
|
[
|
|
@@ -15,52 +21,9 @@ module Astronoby
|
|
|
15
21
|
end
|
|
16
22
|
end
|
|
17
23
|
|
|
24
|
+
# @return [nil] Earth has no phase angle as seen from itself
|
|
18
25
|
def phase_angle
|
|
19
26
|
nil
|
|
20
27
|
end
|
|
21
|
-
|
|
22
|
-
private
|
|
23
|
-
|
|
24
|
-
# Attributes that require Sun data like phase angle or magnitude are not
|
|
25
|
-
# applicable for Earth.
|
|
26
|
-
def requires_sun_data?
|
|
27
|
-
true
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def compute_astrometric(_ephem)
|
|
31
|
-
Astrometric.new(
|
|
32
|
-
position: Vector[
|
|
33
|
-
Distance.zero,
|
|
34
|
-
Distance.zero,
|
|
35
|
-
Distance.zero
|
|
36
|
-
],
|
|
37
|
-
velocity: Vector[
|
|
38
|
-
Velocity.zero,
|
|
39
|
-
Velocity.zero,
|
|
40
|
-
Velocity.zero
|
|
41
|
-
],
|
|
42
|
-
instant: @instant,
|
|
43
|
-
center_identifier: EARTH,
|
|
44
|
-
target_body: self.class
|
|
45
|
-
)
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def compute_mean_of_date(_ephem)
|
|
49
|
-
MeanOfDate.new(
|
|
50
|
-
position: Vector[
|
|
51
|
-
Distance.zero,
|
|
52
|
-
Distance.zero,
|
|
53
|
-
Distance.zero
|
|
54
|
-
],
|
|
55
|
-
velocity: Vector[
|
|
56
|
-
Velocity.zero,
|
|
57
|
-
Velocity.zero,
|
|
58
|
-
Velocity.zero
|
|
59
|
-
],
|
|
60
|
-
instant: @instant,
|
|
61
|
-
center_identifier: EARTH,
|
|
62
|
-
target_body: self.class
|
|
63
|
-
)
|
|
64
|
-
end
|
|
65
28
|
end
|
|
66
29
|
end
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Astronoby
|
|
4
|
+
# Represents Jupiter.
|
|
4
5
|
class Jupiter < SolarSystemBody
|
|
5
6
|
EQUATORIAL_RADIUS = Distance.from_meters(71_492_000)
|
|
6
7
|
ABSOLUTE_MAGNITUDE = -9.395
|
|
8
|
+
ORBITAL_PERIOD = 4332.59
|
|
7
9
|
|
|
10
|
+
# @return [Boolean] true; Jupiter is a superior planet
|
|
11
|
+
def self.superior_planet?
|
|
12
|
+
true
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# @param _ephem_source [Symbol] the ephemeris source type
|
|
16
|
+
# @return [Array<Array>] ephemeris segment identifiers
|
|
8
17
|
def self.ephemeris_segments(_ephem_source)
|
|
9
18
|
[[SOLAR_SYSTEM_BARYCENTER, JUPITER_BARYCENTER]]
|
|
10
19
|
end
|
|
11
20
|
|
|
21
|
+
# @return [Float] absolute magnitude
|
|
12
22
|
def self.absolute_magnitude
|
|
13
23
|
ABSOLUTE_MAGNITUDE
|
|
14
24
|
end
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Astronoby
|
|
4
|
+
# Represents Mars.
|
|
4
5
|
class Mars < SolarSystemBody
|
|
5
6
|
EQUATORIAL_RADIUS = Distance.from_meters(3_396_200)
|
|
6
7
|
ABSOLUTE_MAGNITUDE = -1.601
|
|
8
|
+
ORBITAL_PERIOD = 686.98
|
|
7
9
|
|
|
10
|
+
# @return [Boolean] true; Mars is a superior planet
|
|
11
|
+
def self.superior_planet?
|
|
12
|
+
true
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# @param _ephem_source [Symbol] the ephemeris source type
|
|
16
|
+
# @return [Array<Array>] ephemeris segment identifiers
|
|
8
17
|
def self.ephemeris_segments(_ephem_source)
|
|
9
18
|
[[SOLAR_SYSTEM_BARYCENTER, MARS_BARYCENTER]]
|
|
10
19
|
end
|
|
11
20
|
|
|
21
|
+
# @return [Float] absolute magnitude
|
|
12
22
|
def self.absolute_magnitude
|
|
13
23
|
ABSOLUTE_MAGNITUDE
|
|
14
24
|
end
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Astronoby
|
|
4
|
+
# Represents Mercury.
|
|
4
5
|
class Mercury < SolarSystemBody
|
|
5
6
|
EQUATORIAL_RADIUS = Distance.from_meters(2_439_700)
|
|
6
7
|
ABSOLUTE_MAGNITUDE = -0.613
|
|
8
|
+
ORBITAL_PERIOD = 87.969
|
|
7
9
|
|
|
10
|
+
# @return [Boolean] true; Mercury is an inferior planet
|
|
11
|
+
def self.inferior_planet?
|
|
12
|
+
true
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# @param _ephem_source [Symbol] the ephemeris source type
|
|
16
|
+
# @return [Array<Array>] ephemeris segment identifiers
|
|
8
17
|
def self.ephemeris_segments(_ephem_source)
|
|
9
18
|
[[SOLAR_SYSTEM_BARYCENTER, MERCURY_BARYCENTER]]
|
|
10
19
|
end
|
|
11
20
|
|
|
21
|
+
# @return [Float] absolute magnitude
|
|
12
22
|
def self.absolute_magnitude
|
|
13
23
|
ABSOLUTE_MAGNITUDE
|
|
14
24
|
end
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Astronoby
|
|
4
|
+
# Represents the Moon. Provides phase events, apoapsis/periapsis events,
|
|
5
|
+
# and phase fraction.
|
|
4
6
|
class Moon < SolarSystemBody
|
|
5
7
|
SEMIDIAMETER_VARIATION = 0.7275
|
|
6
8
|
EQUATORIAL_RADIUS = Distance.from_meters(1_737_400)
|
|
7
9
|
ABSOLUTE_MAGNITUDE = 0.28
|
|
10
|
+
ORBITAL_PERIOD = 27.504339
|
|
8
11
|
|
|
12
|
+
# @param ephem_source [Symbol] the ephemeris source type
|
|
13
|
+
# @return [Array<Array>] ephemeris segment identifiers
|
|
9
14
|
def self.ephemeris_segments(ephem_source)
|
|
10
15
|
if ephem_source == ::Ephem::SPK::JPL_DE
|
|
11
16
|
[
|
|
@@ -33,38 +38,155 @@ module Astronoby
|
|
|
33
38
|
Events::MoonPhases.phases_for(year: year, month: month)
|
|
34
39
|
end
|
|
35
40
|
|
|
41
|
+
# @return [Float] absolute magnitude
|
|
36
42
|
def self.absolute_magnitude
|
|
37
43
|
ABSOLUTE_MAGNITUDE
|
|
38
44
|
end
|
|
39
45
|
|
|
46
|
+
# Finds all apoapsis events between two times
|
|
47
|
+
# @param ephem [::Ephem::SPK] Ephemeris data source
|
|
48
|
+
# @param start_time [Time] Start time
|
|
49
|
+
# @param end_time [Time] End time
|
|
50
|
+
# @return [Array<Astronoby::ExtremumEvent>] Array of apoapsis events
|
|
51
|
+
def self.apoapsis_events(
|
|
52
|
+
ephem:,
|
|
53
|
+
start_time:,
|
|
54
|
+
end_time:,
|
|
55
|
+
samples_per_period: 60
|
|
56
|
+
)
|
|
57
|
+
ExtremumCalculator.new(
|
|
58
|
+
body: self,
|
|
59
|
+
primary_body: Earth,
|
|
60
|
+
ephem: ephem,
|
|
61
|
+
samples_per_period: samples_per_period
|
|
62
|
+
).apoapsis_events_between(start_time, end_time)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Finds all periapsis events between two times
|
|
66
|
+
# @param ephem [::Ephem::SPK] Ephemeris data source
|
|
67
|
+
# @param start_time [Time] Start time
|
|
68
|
+
# @param end_time [Time] End time
|
|
69
|
+
# @return [Array<Astronoby::ExtremumEvent>] Array of periapsis events
|
|
70
|
+
def self.periapsis_events(
|
|
71
|
+
ephem:,
|
|
72
|
+
start_time:,
|
|
73
|
+
end_time:,
|
|
74
|
+
samples_per_period: 60
|
|
75
|
+
)
|
|
76
|
+
ExtremumCalculator.new(
|
|
77
|
+
body: self,
|
|
78
|
+
primary_body: Earth,
|
|
79
|
+
ephem: ephem,
|
|
80
|
+
samples_per_period: samples_per_period
|
|
81
|
+
).periapsis_events_between(start_time, end_time)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Finds all lunar eclipses whose greatest instant falls between two times
|
|
85
|
+
# @param ephem [::Ephem::SPK] Ephemeris data source
|
|
86
|
+
# @param start_time [Time] Start time
|
|
87
|
+
# @param end_time [Time] End time
|
|
88
|
+
# @return [Array<Astronoby::LunarEclipse>] Lunar eclipses in the range
|
|
89
|
+
def self.eclipse_events(ephem:, start_time:, end_time:)
|
|
90
|
+
LunarEclipseCalculator
|
|
91
|
+
.new(ephem: ephem)
|
|
92
|
+
.events_between(start_time, end_time)
|
|
93
|
+
end
|
|
94
|
+
|
|
40
95
|
# @return [Float] Phase fraction, from 0 to 1
|
|
41
96
|
def current_phase_fraction
|
|
42
97
|
mean_elongation.degrees / Constants::DEGREES_PER_CIRCLE
|
|
43
98
|
end
|
|
44
99
|
|
|
45
|
-
#
|
|
46
|
-
#
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
100
|
+
# Total geocentric libration of the Moon, in longitude and latitude.
|
|
101
|
+
#
|
|
102
|
+
# With an orientation kernel (see +orientation:+ on the constructor), this
|
|
103
|
+
# is the sub-Earth point from the integrated DE orientation, accurate to
|
|
104
|
+
# better than an arcsecond. Without one, it is the analytic optical plus
|
|
105
|
+
# physical libration (Meeus, Astronomical Algorithms, 2nd ed., chapter 53).
|
|
106
|
+
#
|
|
107
|
+
# @return [Astronoby::Libration] Libration in longitude and latitude
|
|
108
|
+
def libration
|
|
109
|
+
lunar_ephemeris.libration
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Position angle of the Moon's axis of rotation, measured eastward from the
|
|
113
|
+
# north point of the disk.
|
|
114
|
+
#
|
|
115
|
+
# With an orientation kernel this comes from the integrated DE orientation;
|
|
116
|
+
# without one, from the analytic series (Meeus, Astronomical Algorithms,
|
|
117
|
+
# 2nd ed., chapter 53).
|
|
118
|
+
#
|
|
119
|
+
# @return [Astronoby::Angle] Position angle of the axis
|
|
120
|
+
def position_angle_of_axis
|
|
121
|
+
lunar_ephemeris.position_angle_of_axis
|
|
58
122
|
end
|
|
59
123
|
|
|
60
|
-
#
|
|
61
|
-
#
|
|
62
|
-
|
|
63
|
-
|
|
124
|
+
# Position angle of the Moon's bright limb: the position angle of the
|
|
125
|
+
# midpoint of the illuminated limb, measured eastward from the north point
|
|
126
|
+
# of the disk. Geocentric, from the apparent equatorial coordinates of the
|
|
127
|
+
# Moon and the Sun.
|
|
128
|
+
#
|
|
129
|
+
# Source:
|
|
130
|
+
# Title: Astronomical Algorithms
|
|
131
|
+
# Author: Jean Meeus
|
|
132
|
+
# Edition: 2nd edition
|
|
133
|
+
# Chapter: 48 - Illuminated Fraction of the Moon's Disk
|
|
134
|
+
# @return [Astronoby::Angle, nil] Position angle of the bright limb, between
|
|
135
|
+
# 0 and 360 degrees
|
|
136
|
+
def bright_limb_position_angle
|
|
137
|
+
return unless sun
|
|
138
|
+
|
|
139
|
+
@bright_limb_position_angle ||= begin
|
|
140
|
+
angle = apparent.equatorial.position_angle_to(sun.apparent.equatorial)
|
|
141
|
+
Angle.from_degrees(angle.degrees % Constants::DEGREES_PER_CIRCLE)
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Parallactic angle of the Moon for a given observer: the angle at the Moon
|
|
146
|
+
# between the direction of the north celestial pole and the direction of
|
|
147
|
+
# the observer's zenith. Computed from the topocentric place, where lunar
|
|
148
|
+
# parallax is significant.
|
|
149
|
+
#
|
|
150
|
+
# Source:
|
|
151
|
+
# Title: Astronomical Algorithms
|
|
152
|
+
# Author: Jean Meeus
|
|
153
|
+
# Edition: 2nd edition
|
|
154
|
+
# Chapter: 14 - The Parallactic Angle
|
|
155
|
+
# @param observer [Astronoby::Observer] Observer for whom to compute the
|
|
156
|
+
# parallactic angle
|
|
157
|
+
# @return [Astronoby::Angle] Parallactic angle
|
|
158
|
+
def parallactic_angle(observer:)
|
|
159
|
+
equatorial = observed_by(observer).equatorial
|
|
160
|
+
declination = equatorial.declination
|
|
161
|
+
hour_angle = equatorial.compute_hour_angle(
|
|
162
|
+
time: @instant.to_time,
|
|
163
|
+
longitude: observer.longitude
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
Angle.from_radians(
|
|
167
|
+
Math.atan2(
|
|
168
|
+
hour_angle.sin,
|
|
169
|
+
observer.latitude.tan * declination.cos -
|
|
170
|
+
declination.sin * hour_angle.cos
|
|
171
|
+
)
|
|
172
|
+
)
|
|
64
173
|
end
|
|
65
174
|
|
|
66
175
|
private
|
|
67
176
|
|
|
177
|
+
def lunar_ephemeris
|
|
178
|
+
@lunar_ephemeris ||=
|
|
179
|
+
if orientation
|
|
180
|
+
MoonOrientationEphemeris.new(self)
|
|
181
|
+
else
|
|
182
|
+
MoonPhysicalEphemeris.new(self)
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def primary_body_geometric
|
|
187
|
+
earth_geometric
|
|
188
|
+
end
|
|
189
|
+
|
|
68
190
|
# Source:
|
|
69
191
|
# Title: Astronomical Algorithms
|
|
70
192
|
# Author: Jean Meeus
|
|
@@ -86,29 +208,33 @@ module Astronoby
|
|
|
86
208
|
(@instant.tt - JulianDate::DEFAULT_EPOCH) / Constants::DAYS_PER_JULIAN_CENTURY
|
|
87
209
|
end
|
|
88
210
|
|
|
89
|
-
private
|
|
90
|
-
|
|
91
211
|
# Source:
|
|
92
212
|
# Title: Computing Apparent Planetary Magnitudes for The Astronomical
|
|
93
213
|
# Almanac (2018)
|
|
94
214
|
# Authors: Anthony Mallama and James L. Hilton
|
|
95
215
|
def magnitude_correction_term
|
|
96
216
|
phase_angle_degrees = phase_angle.degrees
|
|
97
|
-
if phase_angle_degrees <= 150 && current_phase_fraction
|
|
98
|
-
|
|
99
|
-
1.6057 * 10**-4 * phase_angle_degrees**2 +
|
|
100
|
-
3.1543 * 10**-6 * phase_angle_degrees**3 -
|
|
101
|
-
2.0667 * 10**-8 * phase_angle_degrees**4 +
|
|
102
|
-
6.2553 * 10**-11 * phase_angle_degrees**5
|
|
103
|
-
elsif phase_angle_degrees <= 150 && current_phase_fraction > 0.5
|
|
104
|
-
3.3234 * 10**-2 * phase_angle_degrees -
|
|
105
|
-
3.0725 * 10**-4 * phase_angle_degrees**2 +
|
|
106
|
-
6.1575 * 10**-6 * phase_angle_degrees**3 -
|
|
107
|
-
4.7723 * 10**-8 * phase_angle_degrees**4 +
|
|
108
|
-
1.4681 * 10**-10 * phase_angle_degrees**5
|
|
217
|
+
if phase_angle_degrees <= 150 && current_phase_fraction > 0.5
|
|
218
|
+
waning_magnitude_correction(phase_angle_degrees)
|
|
109
219
|
else
|
|
110
|
-
|
|
220
|
+
waxing_magnitude_correction(phase_angle_degrees)
|
|
111
221
|
end
|
|
112
222
|
end
|
|
223
|
+
|
|
224
|
+
def waxing_magnitude_correction(phase_angle_degrees)
|
|
225
|
+
2.9994 * 10**-2 * phase_angle_degrees -
|
|
226
|
+
1.6057 * 10**-4 * phase_angle_degrees**2 +
|
|
227
|
+
3.1543 * 10**-6 * phase_angle_degrees**3 -
|
|
228
|
+
2.0667 * 10**-8 * phase_angle_degrees**4 +
|
|
229
|
+
6.2553 * 10**-11 * phase_angle_degrees**5
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
def waning_magnitude_correction(phase_angle_degrees)
|
|
233
|
+
3.3234 * 10**-2 * phase_angle_degrees -
|
|
234
|
+
3.0725 * 10**-4 * phase_angle_degrees**2 +
|
|
235
|
+
6.1575 * 10**-6 * phase_angle_degrees**3 -
|
|
236
|
+
4.7723 * 10**-8 * phase_angle_degrees**4 +
|
|
237
|
+
1.4681 * 10**-10 * phase_angle_degrees**5
|
|
238
|
+
end
|
|
113
239
|
end
|
|
114
240
|
end
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Astronoby
|
|
4
|
+
# Represents Neptune.
|
|
4
5
|
class Neptune < SolarSystemBody
|
|
5
6
|
EQUATORIAL_RADIUS = Distance.from_meters(24_764_000)
|
|
6
7
|
ABSOLUTE_MAGNITUDE = -7.0
|
|
8
|
+
ORBITAL_PERIOD = 60182.0
|
|
7
9
|
|
|
10
|
+
# @return [Boolean] true; Neptune is a superior planet
|
|
11
|
+
def self.superior_planet?
|
|
12
|
+
true
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# @param _ephem_source [Symbol] the ephemeris source type
|
|
16
|
+
# @return [Array<Array>] ephemeris segment identifiers
|
|
8
17
|
def self.ephemeris_segments(_ephem_source)
|
|
9
18
|
[[SOLAR_SYSTEM_BARYCENTER, NEPTUNE_BARYCENTER]]
|
|
10
19
|
end
|
|
11
20
|
|
|
21
|
+
# @return [Float] absolute magnitude
|
|
12
22
|
def self.absolute_magnitude
|
|
13
23
|
ABSOLUTE_MAGNITUDE
|
|
14
24
|
end
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Astronoby
|
|
4
|
+
# Represents Saturn.
|
|
4
5
|
class Saturn < SolarSystemBody
|
|
5
6
|
EQUATORIAL_RADIUS = Distance.from_meters(60_268_000)
|
|
6
7
|
ABSOLUTE_MAGNITUDE = -8.914
|
|
8
|
+
ORBITAL_PERIOD = 10759.22
|
|
7
9
|
|
|
10
|
+
# @return [Boolean] true; Saturn is a superior planet
|
|
11
|
+
def self.superior_planet?
|
|
12
|
+
true
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# @param _ephem_source [Symbol] the ephemeris source type
|
|
16
|
+
# @return [Array<Array>] ephemeris segment identifiers
|
|
8
17
|
def self.ephemeris_segments(_ephem_source)
|
|
9
18
|
[[SOLAR_SYSTEM_BARYCENTER, SATURN_BARYCENTER]]
|
|
10
19
|
end
|
|
11
20
|
|
|
21
|
+
# @return [Float] absolute magnitude
|
|
12
22
|
def self.absolute_magnitude
|
|
13
23
|
ABSOLUTE_MAGNITUDE
|
|
14
24
|
end
|