Module: AstroChart::Pure
- Defined in:
- lib/astro_chart/pure.rb,
lib/astro_chart/pure/core.rb,
lib/astro_chart/pure/moon.rb,
lib/astro_chart/pure/pluto.rb,
lib/astro_chart/pure/houses.rb,
lib/astro_chart/pure/vsop87.rb,
lib/astro_chart/pure/moon_elp.rb,
lib/astro_chart/pure/vsop87_data.rb
Overview
Pure-Ruby ephemeris backend (MIT-safe, zero external dependencies).
Front-facing API mirrors the Swiss Ephemeris C extension (AstroChart::Ext):
Pure.julday(year, month, day, hour) -> JD(UT) Float
Pure.calc_ut(jd_ut, planet_id) -> apparent ecliptic longitude (deg, 0-360)
Pure.houses(jd_ut, lat, lon, hsys = "P") -> { "cusps" => [12], "ascendant" => f, "mc" => f }
planet_id follows the SE convention:
SUN=0 MOON=1 MERCURY=2 VENUS=3 MARS=4 JUPITER=5 SATURN=6
URANUS=7 NEPTUNE=8 PLUTO=9 TRUE_NODE=11
Defined Under Namespace
Modules: Core, Houses, Moon, Pluto, Vsop87, Vsop87Data
Constant Summary collapse
- VSOP87_PLANET_IDS =
planet_id (SE convention) -> handled by which pure module
[0, 2, 3, 4, 5, 6, 7, 8].freeze
- MOON_ID =
1- PLUTO_ID =
9- TRUE_NODE_ID =
11
Class Method Summary collapse
-
.calc_ut(jd_ut, planet_id) ⇒ Object
Apparent ecliptic longitude (degrees, [0, 360)) for the given body.
-
.houses(jd_ut, latitude, longitude, hsys = "P") ⇒ Object
House cusps + ascendant + MC.
-
.julday(year, month, day, hour) ⇒ Object
Convert calendar date/time (UT) to Julian Day number.
Class Method Details
.calc_ut(jd_ut, planet_id) ⇒ Object
Apparent ecliptic longitude (degrees, [0, 360)) for the given body.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/astro_chart/pure.rb', line 35 def calc_ut(jd_ut, planet_id) case planet_id when *VSOP87_PLANET_IDS Vsop87.apparent_longitude(planet_id, jd_ut) when MOON_ID Moon.apparent_longitude(jd_ut) when PLUTO_ID Pluto.apparent_longitude(jd_ut) when TRUE_NODE_ID Moon.true_node(jd_ut) else raise ArgumentError, "unsupported planet_id #{planet_id.inspect} " \ "(supported: 0-9 and 11/TRUE_NODE, SE convention)" end end |
.houses(jd_ut, latitude, longitude, hsys = "P") ⇒ Object
House cusps + ascendant + MC. Only Placidus is implemented. hsys accepts "P" or 80 ("P".ord) to mirror the C extension's int argument.
54 55 56 57 58 59 60 61 |
# File 'lib/astro_chart/pure.rb', line 54 def houses(jd_ut, latitude, longitude, hsys = "P") unless hsys == "P" || hsys == 80 raise ArgumentError, "unsupported house system #{hsys.inspect} (pure backend only supports Placidus: \"P\" / 80)" end Houses.calc(jd_ut, latitude, longitude) end |