Class: Astronoby::LunarEclipseCalculator
- Inherits:
-
Object
- Object
- Astronoby::LunarEclipseCalculator
- Defined in:
- lib/astronoby/events/lunar_eclipse_calculator.rb
Overview
Computes lunar eclipses over a time range.
A lunar eclipse is a geocentric event, identical for every observer who can see the Moon, so no observer is involved. The geometry is built from the apparent geocentric positions of the Sun and Moon: this matches the standard reduction used by IMCCE, validated against IMCCE (Opale, INPOP19A) where the eclipse kind, greatest eclipse, magnitudes, and contact times all agree to within a second or two.
Candidate full moons are seeded analytically from Events::MoonPhases, then refined against the ephemeris: full moons far from a node are skipped, the greatest eclipse is the least distance of the Moon’s centre from the shadow axis, and each contact is found by bisecting between greatest eclipse (inside the shadow) and the edge of the search window (outside it).
Source:
Title: Explanatory Supplement to the Astronomical Almanac
Authors: Sean E. Urban and P. Kenneth Seidelmann
Chapter: 11 - Eclipses of the Sun and Moon
Defined Under Namespace
Classes: Geometry
Constant Summary collapse
- SHADOW_ENLARGEMENT =
Atmospheric enlargement of Earth’s shadow (Danjon-style): Earth’s radius is enlarged before the shadow cones are built, which propagates into both the umbra and the penumbra. The 1/99 factor is calibrated against IMCCE (which uses the same INPOP19A ephemeris): it reproduces IMCCE’s umbra and penumbra angular radii to about 0.1 arcsecond across the 2023-2025 eclipses.
1.0 + 1.0 / 99
- SUN_RADIUS_KM =
Sun::EQUATORIAL_RADIUS.km
- MOON_RADIUS_KM =
Moon::EQUATORIAL_RADIUS.km
- EARTH_RADIUS_KM =
Constants::WGS84_EARTH_EQUATORIAL_RADIUS_IN_METERS / 1000.0
- MAX_ECLIPSE_GAMMA =
Largest distance of the Moon’s centre from the shadow axis, in Earth radii, at which any (penumbral) eclipse is still possible is about 1.57. Full moons whose seed already exceeds this margin cannot be eclipses and skip the minimum search entirely.
1.8- GREATEST_HALF_WINDOW =
Half-window, in days, for the local greatest-eclipse search around a full moon. A lunar eclipse occurs within minutes of full moon.
0.25- CONTACT_HALF_WINDOW =
Half-window, in days, for the contact search around greatest eclipse. Wide enough to bracket the longest penumbral phase (about 3 hours each side).
0.21- SEARCH_SAMPLES =
48- CONTACT_TOLERANCE =
Bisection tolerance, in days, for a contact time. ~1e-7 day is ~8.6 ms, well below the one-second resolution the contacts are reported at.
1e-7
Instance Method Summary collapse
-
#events_between(start_time, end_time) ⇒ Array<Astronoby::LunarEclipse>
Eclipses whose greatest instant lies in the range, sorted by time.
-
#initialize(ephem:) ⇒ LunarEclipseCalculator
constructor
A new instance of LunarEclipseCalculator.
Constructor Details
#initialize(ephem:) ⇒ LunarEclipseCalculator
Returns a new instance of LunarEclipseCalculator.
103 104 105 106 |
# File 'lib/astronoby/events/lunar_eclipse_calculator.rb', line 103 def initialize(ephem:) @ephem = ephem @geometry_cache = {} end |
Instance Method Details
#events_between(start_time, end_time) ⇒ Array<Astronoby::LunarEclipse>
Returns eclipses whose greatest instant lies in the range, sorted by time.
112 113 114 115 116 117 118 |
# File 'lib/astronoby/events/lunar_eclipse_calculator.rb', line 112 def events_between(start_time, end_time) full_moon_seeds(start_time, end_time) .filter_map { |seed_jd| eclipse_near(seed_jd) } .select do |eclipse| eclipse.instant.to_time.between?(start_time, end_time) end end |