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.
-
.ecliptic_latlon(jd_ut, planet_id) ⇒ Object
Apparent geocentric ecliptic [longitude, latitude] in degrees for the Sun, Moon, VSOP87 planets and Pluto (nodes are not physical bodies).
-
.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 |
.ecliptic_latlon(jd_ut, planet_id) ⇒ Object
Apparent geocentric ecliptic [longitude, latitude] in degrees for the Sun, Moon, VSOP87 planets and Pluto (nodes are not physical bodies).
54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/astro_chart/pure.rb', line 54 def ecliptic_latlon(jd_ut, planet_id) case planet_id when *VSOP87_PLANET_IDS Vsop87.apparent_ecliptic(planet_id, jd_ut) when MOON_ID Moon.apparent_ecliptic(jd_ut) when PLUTO_ID Pluto.apparent_ecliptic(jd_ut) else raise ArgumentError, "ecliptic_latlon unsupported planet_id #{planet_id.inspect} " \ "(supported: Sun 0, planets 2-8, Moon, Pluto)" end end |
.houses(jd_ut, latitude, longitude, hsys = "P") ⇒ Object
House cusps + ascendant + MC. Placidus ("P") and Whole Sign ("W"). hsys accepts "P"/"W" or 80/87 (ord values) to mirror the C extension's int argument.
71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/astro_chart/pure.rb', line 71 def houses(jd_ut, latitude, longitude, hsys = "P") case hsys when "P", 80 then Houses.calc(jd_ut, latitude, longitude, "P") when "W", 87 then Houses.calc(jd_ut, latitude, longitude, "W") when "E", 69 then Houses.calc(jd_ut, latitude, longitude, "E") when "O", 79 then Houses.calc(jd_ut, latitude, longitude, "O") else raise ArgumentError, "unsupported house system #{hsys.inspect} " \ "(pure backend supports Placidus \"P\"/80, Whole Sign \"W\"/87, " \ "Equal \"E\"/69 and Porphyry \"O\"/79)" end end |