Class: Astronoby::LunarEclipse

Inherits:
Object
  • Object
show all
Defined in:
lib/astronoby/events/lunar_eclipse.rb

Overview

A lunar eclipse: a geocentric passage of the Moon through Earth’s shadow. Immutable; built by LunarEclipseCalculator.

The penumbral phase is always present. The partial phase is present for partial and total eclipses, and the total phase only for total eclipses.

Constant Summary collapse

PENUMBRAL =
:penumbral
PARTIAL =
:partial
TOTAL =
:total

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(instant:, kind:, umbral_magnitude:, penumbral_magnitude:, gamma:, shadow_axis_distance:, penumbral:, partial: nil, total: nil) ⇒ LunarEclipse

Returns a new instance of LunarEclipse.

Parameters:

  • instant (Astronoby::Instant)

    greatest eclipse

  • kind (Symbol)

    PENUMBRAL, PARTIAL or TOTAL

  • umbral_magnitude (Float)

    umbral magnitude at greatest eclipse

  • penumbral_magnitude (Float)

    penumbral magnitude at greatest eclipse

  • gamma (Float)

    least distance from the shadow axis, in Earth radii

  • shadow_axis_distance (Astronoby::Distance)

    least distance from the shadow axis

  • penumbral (Astronoby::EclipsePhase)

    the penumbral phase

  • partial (Astronoby::EclipsePhase, nil) (defaults to: nil)

    the partial phase

  • total (Astronoby::EclipsePhase, nil) (defaults to: nil)

    the total phase



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/astronoby/events/lunar_eclipse.rb', line 61

def initialize(
  instant:,
  kind:,
  umbral_magnitude:,
  penumbral_magnitude:,
  gamma:,
  shadow_axis_distance:,
  penumbral:,
  partial: nil,
  total: nil
)
  @instant = instant
  @kind = kind
  @umbral_magnitude = umbral_magnitude
  @penumbral_magnitude = penumbral_magnitude
  @gamma = gamma
  @shadow_axis_distance = shadow_axis_distance
  @penumbral = penumbral
  @partial = partial
  @total = total
  freeze
end

Instance Attribute Details

#gammaFloat (readonly)

Returns least distance of the Moon’s centre from the axis of Earth’s shadow at greatest eclipse, in Earth radii, positive when the Moon passes north of the axis.

Returns:

  • (Float)

    least distance of the Moon’s centre from the axis of Earth’s shadow at greatest eclipse, in Earth radii, positive when the Moon passes north of the axis



33
34
35
# File 'lib/astronoby/events/lunar_eclipse.rb', line 33

def gamma
  @gamma
end

#instantAstronoby::Instant (readonly) Also known as: greatest_eclipse

Returns greatest eclipse, when the Moon’s centre is least distant from the axis of Earth’s shadow.

Returns:

  • (Astronoby::Instant)

    greatest eclipse, when the Moon’s centre is least distant from the axis of Earth’s shadow



16
17
18
# File 'lib/astronoby/events/lunar_eclipse.rb', line 16

def instant
  @instant
end

#kindSymbol (readonly)

Returns PENUMBRAL, PARTIAL or TOTAL.

Returns:

  • (Symbol)

    PENUMBRAL, PARTIAL or TOTAL



20
21
22
# File 'lib/astronoby/events/lunar_eclipse.rb', line 20

def kind
  @kind
end

#partialAstronoby::EclipsePhase? (readonly)

Returns the partial phase, present for partial and total eclipses.

Returns:



45
46
47
# File 'lib/astronoby/events/lunar_eclipse.rb', line 45

def partial
  @partial
end

#penumbralAstronoby::EclipsePhase (readonly)

Returns the penumbral phase (always present).

Returns:



41
42
43
# File 'lib/astronoby/events/lunar_eclipse.rb', line 41

def penumbral
  @penumbral
end

#penumbral_magnitudeFloat (readonly)

Returns fraction of the Moon’s diameter immersed in the penumbra at greatest eclipse.

Returns:

  • (Float)

    fraction of the Moon’s diameter immersed in the penumbra at greatest eclipse



28
29
30
# File 'lib/astronoby/events/lunar_eclipse.rb', line 28

def penumbral_magnitude
  @penumbral_magnitude
end

#shadow_axis_distanceAstronoby::Distance (readonly)

Returns least distance of the Moon’s centre from the axis of Earth’s shadow at greatest eclipse. This is the unsigned length of which gamma is the value in Earth radii.

Returns:

  • (Astronoby::Distance)

    least distance of the Moon’s centre from the axis of Earth’s shadow at greatest eclipse. This is the unsigned length of which gamma is the value in Earth radii.



38
39
40
# File 'lib/astronoby/events/lunar_eclipse.rb', line 38

def shadow_axis_distance
  @shadow_axis_distance
end

#totalAstronoby::EclipsePhase? (readonly)

Returns the total phase (totality), present only for total eclipses.

Returns:



49
50
51
# File 'lib/astronoby/events/lunar_eclipse.rb', line 49

def total
  @total
end

#umbral_magnitudeFloat (readonly)

Returns fraction of the Moon’s diameter immersed in the umbra at greatest eclipse (negative when the Moon misses the umbra).

Returns:

  • (Float)

    fraction of the Moon’s diameter immersed in the umbra at greatest eclipse (negative when the Moon misses the umbra)



24
25
26
# File 'lib/astronoby/events/lunar_eclipse.rb', line 24

def umbral_magnitude
  @umbral_magnitude
end

Instance Method Details

#partial?Boolean

Returns true for a partial eclipse.

Returns:

  • (Boolean)

    true for a partial eclipse



90
91
92
# File 'lib/astronoby/events/lunar_eclipse.rb', line 90

def partial?
  @kind == PARTIAL
end

#penumbral?Boolean

Returns true for a penumbral eclipse (the Moon misses the umbra).

Returns:

  • (Boolean)

    true for a penumbral eclipse (the Moon misses the umbra)



85
86
87
# File 'lib/astronoby/events/lunar_eclipse.rb', line 85

def penumbral?
  @kind == PENUMBRAL
end

#total?Boolean

Returns true for a total eclipse.

Returns:

  • (Boolean)

    true for a total eclipse



95
96
97
# File 'lib/astronoby/events/lunar_eclipse.rb', line 95

def total?
  @kind == TOTAL
end