Module: AstroChart::Ephemeris
- Defined in:
- lib/astro_chart/ephemeris.rb
Overview
Backend-agnostic ephemeris facade. All public callers go through this module so the backend (:pure / :swiss) can be swapped without touching the rest of the code.
Constant Summary collapse
- PLANETS =
SE-convention planet ids (numeric literals so the :pure default works without the C extension loaded; values match AstroChart::Ext constants when the extension is present).
{ "太陽" => 0, # SUN "月亮" => 1, # MOON "水星" => 2, # MERCURY "金星" => 3, # VENUS "火星" => 4, # MARS "木星" => 5, # JUPITER "土星" => 6, # SATURN "天王星" => 7, # URANUS "海王星" => 8, # NEPTUNE "冥王星" => 9, # PLUTO "北交點" => 11, # TRUE_NODE }.freeze
Class Method Summary collapse
-
.calc_ut(jd, planet_id) ⇒ Object
Calculate planet apparent ecliptic longitude (degrees 0-360).
-
.houses(jd, latitude, longitude, system = "P") ⇒ Object
Calculate house cusps + ascendant.
-
.julday(year, month, day, hour) ⇒ Object
Convert date/time to Julian Day number.
Class Method Details
.calc_ut(jd, planet_id) ⇒ Object
Calculate planet apparent ecliptic longitude (degrees 0-360).
78 79 80 81 82 83 |
# File 'lib/astro_chart/ephemeris.rb', line 78 def self.calc_ut(jd, planet_id) case AstroChart.backend when :swiss then Ext.calc_ut(jd, planet_id) else Pure.calc_ut(jd, planet_id) end end |
.houses(jd, latitude, longitude, system = "P") ⇒ Object
Calculate house cusps + ascendant. Returns { "cusps" => [12 floats], "ascendant" => float, "mc" => float }
87 88 89 90 91 92 |
# File 'lib/astro_chart/ephemeris.rb', line 87 def self.houses(jd, latitude, longitude, system = "P") case AstroChart.backend when :swiss then Ext.houses(jd, latitude, longitude, system.ord) else Pure.houses(jd, latitude, longitude, system) end end |
.julday(year, month, day, hour) ⇒ Object
Convert date/time to Julian Day number.
70 71 72 73 74 75 |
# File 'lib/astro_chart/ephemeris.rb', line 70 def self.julday(year, month, day, hour) case AstroChart.backend when :swiss then Ext.julday(year, month, day, hour) else Pure.julday(year, month, day, hour) end end |