Module: Swisseph
- Defined in:
- lib/swisseph.rb,
lib/swisseph.rb,
ext/swisseph/swisseph.c
Constant Summary collapse
- LOCK =
The Swiss Ephemeris C library keeps its mutable state in one
struct swe_data swed. On a build whereswedis a plain process global it is NOT thread-safe: two threads inside the C library at once can segfault the process, so every native call is serialized through this global re-entrant lock.BUT libswe declares
swedwith theTLSmacro (sweodef.h). On any build where TLS resolves to real thread-local storage (__thread/_Thread_local/__declspec(thread)) each thread gets its ownswed-- own file descriptors, own caches -- and the library is genuinely per-thread reentrant. That is the case on Linux, and on macOS with the extconf.rb patch that drops the legacy__APPLE__exclusion (modern clang supports __thread). On such a build the lock is pure overhead: it serializes ephemeris work that could run in parallel. Monitor.new
- LOCKING =
Serialize native calls through LOCK unless explicitly disabled. Set SWISSEPH_NOLOCK=1 ONLY on a thread-local (TLS) build -- disabling the lock on a non-TLS build will segfault under concurrency. Reentrancy verified 2026-08-19 under ThreadSanitizer (12 threads, no lock, zero data races, exact values).
ENV['SWISSEPH_NOLOCK'] != '1'
- SE_SUN =
Constants
INT2FIX(SE_SUN)
- SE_MOON =
INT2FIX(SE_MOON)
- SE_MERCURY =
INT2FIX(SE_MERCURY)
- SE_VENUS =
INT2FIX(SE_VENUS)
- SE_MARS =
INT2FIX(SE_MARS)
- SE_JUPITER =
INT2FIX(SE_JUPITER)
- SE_SATURN =
INT2FIX(SE_SATURN)
- SE_URANUS =
INT2FIX(SE_URANUS)
- SE_NEPTUNE =
INT2FIX(SE_NEPTUNE)
- SE_PLUTO =
INT2FIX(SE_PLUTO)
- SE_MEAN_NODE =
INT2FIX(SE_MEAN_NODE)
- SE_TRUE_NODE =
INT2FIX(SE_TRUE_NODE)
- SE_MEAN_APOG =
INT2FIX(SE_MEAN_APOG)
- SE_OSCU_APOG =
INT2FIX(SE_OSCU_APOG)
- SE_EARTH =
INT2FIX(SE_EARTH)
- SE_CHIRON =
INT2FIX(SE_CHIRON)
- SE_PHOLUS =
INT2FIX(SE_PHOLUS)
- SE_CERES =
INT2FIX(SE_CERES)
- SE_PALLAS =
INT2FIX(SE_PALLAS)
- SE_JUNO =
INT2FIX(SE_JUNO)
- SE_VESTA =
INT2FIX(SE_VESTA)
- SE_CUPIDO =
INT2FIX(SE_CUPIDO)
- SE_HADES =
INT2FIX(SE_HADES)
- SE_ZEUS =
INT2FIX(SE_ZEUS)
- SE_KRONOS =
INT2FIX(SE_KRONOS)
- SE_APOLLON =
INT2FIX(SE_APOLLON)
- SE_ADMETOS =
INT2FIX(SE_ADMETOS)
- SE_VULKANUS =
INT2FIX(SE_VULKANUS)
- SE_POSEIDON =
INT2FIX(SE_POSEIDON)
- SE_INTP_APOG =
INT2FIX(SE_INTP_APOG)
- SE_INTP_PERG =
INT2FIX(SE_INTP_PERG)
- SEFLG_JPLEPH =
INT2FIX(SEFLG_JPLEPH)
- SEFLG_SWIEPH =
INT2FIX(SEFLG_SWIEPH)
- SEFLG_MOSEPH =
INT2FIX(SEFLG_MOSEPH)
- SEFLG_HELCTR =
INT2FIX(SEFLG_HELCTR)
- SEFLG_TRUEPOS =
INT2FIX(SEFLG_TRUEPOS)
- SEFLG_J2000 =
INT2FIX(SEFLG_J2000)
- SEFLG_NONUT =
INT2FIX(SEFLG_NONUT)
- SEFLG_SPEED3 =
INT2FIX(SEFLG_SPEED3)
- SEFLG_SPEED =
INT2FIX(SEFLG_SPEED)
- SEFLG_NOGDEFL =
INT2FIX(SEFLG_NOGDEFL)
- SEFLG_NOABERR =
INT2FIX(SEFLG_NOABERR)
- SEFLG_EQUATORIAL =
INT2FIX(SEFLG_EQUATORIAL)
- SEFLG_XYZ =
INT2FIX(SEFLG_XYZ)
- SEFLG_RADIANS =
INT2FIX(SEFLG_RADIANS)
- SEFLG_BARYCTR =
INT2FIX(SEFLG_BARYCTR)
- SEFLG_TOPOCTR =
INT2FIX(SEFLG_TOPOCTR)
- SEFLG_SIDEREAL =
INT2FIX(SEFLG_SIDEREAL)
- SEFLG_ICRS =
INT2FIX(SEFLG_ICRS)
- SE_SIDM_FAGAN_BRADLEY =
0
INT2FIX(SE_SIDM_FAGAN_BRADLEY)
- SE_SIDM_LAHIRI =
0
INT2FIX(SE_SIDM_LAHIRI)
- SE_SIDM_DELUCE =
INT2FIX(SE_SIDM_DELUCE)
- SE_SIDM_RAMAN =
INT2FIX(SE_SIDM_RAMAN)
- SE_SIDM_USHASHASHI =
INT2FIX(SE_SIDM_USHASHASHI)
- SE_SIDM_KRISHNAMURTI =
INT2FIX(SE_SIDM_KRISHNAMURTI)
- SE_SIDM_DJWHAL_KHUL =
INT2FIX(SE_SIDM_DJWHAL_KHUL)
- SE_SIDM_YUKTESHWAR =
INT2FIX(SE_SIDM_YUKTESHWAR)
- SE_SIDM_JN_BHASIN =
INT2FIX(SE_SIDM_JN_BHASIN)
- SE_SIDM_BABYL_KUGLER1 =
INT2FIX(SE_SIDM_BABYL_KUGLER1)
- SE_SIDM_BABYL_KUGLER2 =
INT2FIX(SE_SIDM_BABYL_KUGLER2)
- SE_SIDM_BABYL_KUGLER3 =
INT2FIX(SE_SIDM_BABYL_KUGLER3)
- SE_SIDM_BABYL_HUBER =
INT2FIX(SE_SIDM_BABYL_HUBER)
- SE_SIDM_BABYL_ETPSC =
INT2FIX(SE_SIDM_BABYL_ETPSC)
- SE_SIDM_ALDEBARAN_15TAU =
INT2FIX(SE_SIDM_ALDEBARAN_15TAU)
- SE_SIDM_HIPPARCHOS =
INT2FIX(SE_SIDM_HIPPARCHOS)
- SE_SIDM_SASSANIAN =
INT2FIX(SE_SIDM_SASSANIAN)
- SE_SIDM_GALCENT_0SAG =
INT2FIX(SE_SIDM_GALCENT_0SAG)
- SE_SIDM_J2000 =
INT2FIX(SE_SIDM_J2000)
- SE_SIDM_J1900 =
INT2FIX(SE_SIDM_J1900)
- SE_SIDM_B1950 =
INT2FIX(SE_SIDM_B1950)
- SE_SIDM_SURYASIDDHANTA =
INT2FIX(SE_SIDM_SURYASIDDHANTA)
- SE_SIDM_SURYASIDDHANTA_MSUN =
INT2FIX(SE_SIDM_SURYASIDDHANTA_MSUN)
- SE_SIDM_ARYABHATA =
INT2FIX(SE_SIDM_ARYABHATA)
- SE_SIDM_ARYABHATA_MSUN =
INT2FIX(SE_SIDM_ARYABHATA_MSUN)
- SE_SIDM_SS_REVATI =
INT2FIX(SE_SIDM_SS_REVATI)
- SE_SIDM_SS_CITRA =
INT2FIX(SE_SIDM_SS_CITRA)
- SE_SIDM_TRUE_CITRA =
INT2FIX(SE_SIDM_TRUE_CITRA)
- SE_SIDM_TRUE_REVATI =
INT2FIX(SE_SIDM_TRUE_REVATI)
- SE_SIDM_TRUE_PUSHYA =
INT2FIX(SE_SIDM_TRUE_PUSHYA)
- SE_SIDM_GALCENT_RGILBRAND =
INT2FIX(SE_SIDM_GALCENT_RGILBRAND)
- SE_SIDM_GALEQU_IAU1958 =
INT2FIX(SE_SIDM_GALEQU_IAU1958)
- SE_SIDM_GALEQU_TRUE =
INT2FIX(SE_SIDM_GALEQU_TRUE)
- SE_SIDM_GALEQU_MULA =
INT2FIX(SE_SIDM_GALEQU_MULA)
- SE_SIDM_GALALIGN_MARDYKS =
INT2FIX(SE_SIDM_GALALIGN_MARDYKS)
- SE_SIDM_TRUE_MULA =
INT2FIX(SE_SIDM_TRUE_MULA)
- SE_SIDM_GALCENT_MULA_WILHELM =
INT2FIX(SE_SIDM_GALCENT_MULA_WILHELM)
- SE_SIDM_ARYABHATA_522 =
INT2FIX(SE_SIDM_ARYABHATA_522)
- SE_SIDM_BABYL_BRITTON =
INT2FIX(SE_SIDM_BABYL_BRITTON)
- SE_SIDM_TRUE_SHEORAN =
INT2FIX(SE_SIDM_TRUE_SHEORAN)
- SE_SIDM_GALCENT_COCHRANE =
INT2FIX(SE_SIDM_GALCENT_COCHRANE)
- SE_SIDM_GALEQU_FIORENZA =
INT2FIX(SE_SIDM_GALEQU_FIORENZA)
- SE_SIDM_VALENS_MOON =
INT2FIX(SE_SIDM_VALENS_MOON)
- SE_SIDM_LAHIRI_1940 =
INT2FIX(SE_SIDM_LAHIRI_1940)
- SE_SIDM_LAHIRI_VP285 =
INT2FIX(SE_SIDM_LAHIRI_VP285)
- SE_SIDM_KRISHNAMURTI_VP291 =
INT2FIX(SE_SIDM_KRISHNAMURTI_VP291)
- SE_SIDM_LAHIRI_ICRC =
46
INT2FIX(SE_SIDM_LAHIRI_ICRC)
- SE_SIDM_USER =
255
INT2FIX(SE_SIDM_USER)
- SE_GREG_CAL =
255
INT2FIX(SE_GREG_CAL)
- SE_JUL_CAL =
INT2FIX(SE_JUL_CAL)
- SE_ECL2HOR =
INT2FIX(SE_ECL2HOR)
- SE_EQU2HOR =
INT2FIX(SE_EQU2HOR)
- SE_NODBIT_MEAN =
INT2FIX(SE_NODBIT_MEAN)
- SE_NODBIT_OSCU =
INT2FIX(SE_NODBIT_OSCU)
- SE_NODBIT_OSCU_BAR =
INT2FIX(SE_NODBIT_OSCU_BAR)
- SE_NODBIT_FOPOINT =
INT2FIX(SE_NODBIT_FOPOINT)
- SE_CALC_RISE =
INT2FIX(SE_CALC_RISE)
- SE_CALC_SET =
INT2FIX(SE_CALC_SET)
- SE_CALC_MTRANSIT =
INT2FIX(SE_CALC_MTRANSIT)
- SE_CALC_ITRANSIT =
INT2FIX(SE_CALC_ITRANSIT)
- SE_BIT_DISC_CENTER =
INT2FIX(SE_BIT_DISC_CENTER)
- SE_BIT_DISC_BOTTOM =
INT2FIX(SE_BIT_DISC_BOTTOM)
- SE_BIT_GEOCTR_NO_ECL_LAT =
INT2FIX(SE_BIT_GEOCTR_NO_ECL_LAT)
- SE_BIT_NO_REFRACTION =
INT2FIX(SE_BIT_NO_REFRACTION)
- SE_BIT_CIVIL_TWILIGHT =
INT2FIX(SE_BIT_CIVIL_TWILIGHT)
- SE_BIT_NAUTIC_TWILIGHT =
INT2FIX(SE_BIT_NAUTIC_TWILIGHT)
- SE_BIT_ASTRO_TWILIGHT =
INT2FIX(SE_BIT_ASTRO_TWILIGHT)
- SE_BIT_FIXED_DISC_SIZE =
INT2FIX(SE_BIT_FIXED_DISC_SIZE)
- SE_BIT_HINDU_RISING =
INT2FIX(SE_BIT_HINDU_RISING)
- SE_HOR2ECL =
for swe_azalt_rev()
INT2FIX(SE_HOR2ECL)
- SE_HOR2EQU =
INT2FIX(SE_HOR2EQU)
- SE_TRUE_TO_APP =
for swe_refrac()
INT2FIX(SE_TRUE_TO_APP)
- SE_APP_TO_TRUE =
INT2FIX(SE_APP_TO_TRUE)
- SE_SPLIT_DEG_ROUND_SEC =
for swe_split_deg()
INT2FIX(SE_SPLIT_DEG_ROUND_SEC)
- SE_SPLIT_DEG_ROUND_MIN =
INT2FIX(SE_SPLIT_DEG_ROUND_MIN)
- SE_SPLIT_DEG_ROUND_DEG =
INT2FIX(SE_SPLIT_DEG_ROUND_DEG)
- SE_SPLIT_DEG_ZODIACAL =
INT2FIX(SE_SPLIT_DEG_ZODIACAL)
- SE_SPLIT_DEG_NAKSHATRA =
INT2FIX(SE_SPLIT_DEG_NAKSHATRA)
- SE_SPLIT_DEG_KEEP_SIGN =
INT2FIX(SE_SPLIT_DEG_KEEP_SIGN)
- SE_SPLIT_DEG_KEEP_DEG =
INT2FIX(SE_SPLIT_DEG_KEEP_DEG)
- SE_ECL_CENTRAL =
for eclipse functions
INT2FIX(SE_ECL_CENTRAL)
- SE_ECL_NONCENTRAL =
INT2FIX(SE_ECL_NONCENTRAL)
- SE_ECL_TOTAL =
INT2FIX(SE_ECL_TOTAL)
- SE_ECL_ANNULAR =
INT2FIX(SE_ECL_ANNULAR)
- SE_ECL_PARTIAL =
INT2FIX(SE_ECL_PARTIAL)
- SE_ECL_ANNULAR_TOTAL =
INT2FIX(SE_ECL_ANNULAR_TOTAL)
- SE_ECL_HYBRID =
INT2FIX(SE_ECL_HYBRID)
- SE_ECL_PENUMBRAL =
INT2FIX(SE_ECL_PENUMBRAL)
- SE_ECL_ALLTYPES_SOLAR =
INT2FIX(SE_ECL_ALLTYPES_SOLAR)
- SE_ECL_ALLTYPES_LUNAR =
INT2FIX(SE_ECL_ALLTYPES_LUNAR)
- SE_ECL_VISIBLE =
INT2FIX(SE_ECL_VISIBLE)
- SE_ECL_MAX_VISIBLE =
INT2FIX(SE_ECL_MAX_VISIBLE)
- SE_ECL_1ST_VISIBLE =
INT2FIX(SE_ECL_1ST_VISIBLE)
- SE_ECL_2ND_VISIBLE =
INT2FIX(SE_ECL_2ND_VISIBLE)
- SE_ECL_3RD_VISIBLE =
INT2FIX(SE_ECL_3RD_VISIBLE)
- SE_ECL_4TH_VISIBLE =
INT2FIX(SE_ECL_4TH_VISIBLE)
- SE_ECL_ONE_TRY =
INT2FIX(SE_ECL_ONE_TRY)
- SE_HELIACAL_RISING =
for heliacal functions
INT2FIX(SE_HELIACAL_RISING)
- SE_HELIACAL_SETTING =
INT2FIX(SE_HELIACAL_SETTING)
- SE_MORNING_FIRST =
INT2FIX(SE_MORNING_FIRST)
- SE_EVENING_LAST =
INT2FIX(SE_EVENING_LAST)
- SE_EVENING_FIRST =
INT2FIX(SE_EVENING_FIRST)
- SE_MORNING_LAST =
INT2FIX(SE_MORNING_LAST)
- SE_HELFLAG_LONG_SEARCH =
INT2FIX(SE_HELFLAG_LONG_SEARCH)
- SE_HELFLAG_HIGH_PRECISION =
INT2FIX(SE_HELFLAG_HIGH_PRECISION)
- SE_HELFLAG_OPTICAL_PARAMS =
INT2FIX(SE_HELFLAG_OPTICAL_PARAMS)
- SE_HELFLAG_NO_DETAILS =
INT2FIX(SE_HELFLAG_NO_DETAILS)
Class Method Summary collapse
- .swe_azalt(julian_day, flag, lon, lat, height, pressure, temp, in0, in1, in2) ⇒ Object
- .swe_azalt_rev(julian_day, flag, lon, lat, height, azimuth, altitude) ⇒ Object
-
.swe_calc(julian_et, body, iflag) ⇒ Object
Calculation of planets, moon, asteroids, etc.
- .swe_calc_pctr(julian_et, body, center, iflag) ⇒ Object
- .swe_calc_ut(julian_ut, body, iflag) ⇒ Object
- .swe_close ⇒ Object
- .swe_cotrans(*args) ⇒ Object
- .swe_cotrans_sp(eps, lon, lat, dist, lon_speed, lat_speed, dist_speed) ⇒ Object
- .swe_day_of_week(jd) ⇒ Object
- .swe_degnorm(deg) ⇒ Object
- .swe_deltat(julian_ut) ⇒ Object
- .swe_deltat_ex(julian_ut, iflag) ⇒ Object
- .swe_fixstar(star, julian_et, iflag) ⇒ Object
- .swe_fixstar2(star, julian_et, iflag) ⇒ Object
- .swe_fixstar2_mag(star) ⇒ Object
- .swe_fixstar2_ut(star, julian_ut, iflag) ⇒ Object
- .swe_fixstar_mag(star) ⇒ Object
- .swe_fixstar_ut(star, julian_ut, iflag) ⇒ Object
- .swe_gauquelin_sector(tjd_ut, body, iflag, imeth, lon, lat, height, atpress, attemp) ⇒ Object
- .swe_get_ayanamsa(julian_et) ⇒ Object
- .swe_get_ayanamsa_ex(julian_et, flag) ⇒ Object
- .swe_get_ayanamsa_ex_ut(julian_ut, flag) ⇒ Object
- .swe_get_ayanamsa_name(isidmode) ⇒ Object
- .swe_get_ayanamsa_ut(julian_ut) ⇒ Object
- .swe_get_orbital_elements(julian_et, body, iflag) ⇒ Object
- .swe_get_planet_name(ipl) ⇒ Object
- .swe_heliacal_angle(*args) ⇒ Object
- .swe_heliacal_pheno_ut(*args) ⇒ Object
- .swe_heliacal_ut(*args) ⇒ Object
- .swe_helio_cross(body, x2cross, tjd_et, iflag, dir) ⇒ Object
- .swe_helio_cross_ut(body, x2cross, tjd_ut, iflag, dir) ⇒ Object
- .swe_house_name(hsys) ⇒ Object
- .swe_house_pos(armc, geolat, eps, hsys, eclon, eclat) ⇒ Object
- .swe_houses(julian_day, latitude, longitude, house_system) ⇒ Object
- .swe_houses_armc(armc, latitude, eps, house_system) ⇒ Object
- .swe_houses_ex(julian_day, iflag, latitude, longitude, house_system) ⇒ Object
- .swe_houses_ex2(julian_day, flag, latitude, longitude, house_system) ⇒ Object
- .swe_jdut1_to_utc(*args) ⇒ Object
- .swe_julday(*args) ⇒ Object
- .swe_lat_to_lmt(tjd_lat, geolon) ⇒ Object
- .swe_lmt_to_lat(tjd_lmt, geolon) ⇒ Object
- .swe_lun_eclipse_how(tjd, ifl, lon, lat, height) ⇒ Object
- .swe_lun_eclipse_when(tjd_start, ifl, ifltype, backward) ⇒ Object
- .swe_lun_eclipse_when_loc(tjd_start, ifl, lon, lat, height, backward) ⇒ Object
- .swe_lun_occult_when_glob(tjd_start, ipl, starname, ifl, ifltype, backward) ⇒ Object
- .swe_lun_occult_when_loc(tjd_start, ipl, starname, ifl, lon, lat, height, backward) ⇒ Object
- .swe_lun_occult_where(tjd, ipl, starname, ifl) ⇒ Object
- .swe_mooncross(x2cross, tjd_et, iflag) ⇒ Object
- .swe_mooncross_node(tjd_et, iflag) ⇒ Object
- .swe_mooncross_node_ut(tjd_ut, iflag) ⇒ Object
- .swe_mooncross_ut(x2cross, tjd_ut, iflag) ⇒ Object
- .swe_nod_aps(julian_et, body, iflag, method) ⇒ Object
- .swe_nod_aps_ut(julian_ut, body, iflag, method) ⇒ Object
- .swe_pheno_ut(julian_ut, ipl, iflag) ⇒ Object
- .swe_radnorm(rad) ⇒ Object
- .swe_refrac(inalt, atpress, attemp, calc_flag) ⇒ Object
- .swe_refrac_extended(inalt, geoalt, atpress, attemp, lapse_rate, calc_flag) ⇒ Object
- .swe_revjul(*args) ⇒ Object
- .swe_rise_trans(julian_day, body, flag, rmsi, lon, lat, height, pressure, temp) ⇒ Object
- .swe_rise_trans_true_hor(julian_day, body, flag, rmsi, lon, lat, height, pressure, temp, hor_height) ⇒ Object
-
.swe_set_ephe_path(path) ⇒ Object
Set directory path of ephemeris files http://www.astro.com/swisseph/swephprg.htm#_Toc283735481 int swe_set_ephe_path(char *path);.
- .swe_set_jpl_file(path) ⇒ Object
- .swe_set_sid_mode(mode, t0, ayan_t0) ⇒ Object
- .swe_set_topo(lon, lat, alt) ⇒ Object
- .swe_sidtime(julian_ut) ⇒ Object
- .swe_sidtime0(julian_ut, eps, nut) ⇒ Object
- .swe_sol_eclipse_how(tjd, ifl, lon, lat, height) ⇒ Object
- .swe_sol_eclipse_when_glob(tjd_start, ifl, ifltype, backward) ⇒ Object
- .swe_sol_eclipse_when_loc(tjd_start, ifl, lon, lat, height, backward) ⇒ Object
- .swe_sol_eclipse_where(tjd, ifl) ⇒ Object
- .swe_solcross(x2cross, tjd_et, iflag) ⇒ Object
- .swe_solcross_ut(x2cross, tjd_ut, iflag) ⇒ Object
- .swe_split_deg(ddeg, roundflag) ⇒ Object
- .swe_time_equ(tjd) ⇒ Object
- .swe_topo_arcus_visionis(*args) ⇒ Object
- .swe_utc_to_jd(*args) ⇒ Object
- .swe_version ⇒ Object
- .swe_vis_limit_mag(*args) ⇒ Object
Class Method Details
.swe_azalt(julian_day, flag, lon, lat, height, pressure, temp, in0, in1, in2) ⇒ Object
688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 |
# File 'ext/swisseph/swisseph.c', line 688
static VALUE t_swe_azalt(VALUE self, VALUE julian_day, VALUE flag, VALUE lon, VALUE lat, VALUE height, VALUE pressure, VALUE temp, VALUE in0, VALUE in1, VALUE in2)
{
double geopos[3];
geopos[0] = NUM2DBL(lon);
geopos[1] = NUM2DBL(lat);
geopos[2] = NUM2DBL(height);
double xin[3];
xin[0] = NUM2DBL(in0);
xin[1] = NUM2DBL(in1);
xin[2] = NUM2DBL(in2);
double xaz[3];
swe_azalt(NUM2DBL(julian_day), NUM2INT(flag), geopos, NUM2DBL(pressure), NUM2DBL(temp), xin, xaz);
VALUE output = rb_ary_new();
rb_ary_push(output, rb_float_new(xaz[0]));
rb_ary_push(output, rb_float_new(xaz[1]));
rb_ary_push(output, rb_float_new(xaz[2]));
return output;
}
|
.swe_azalt_rev(julian_day, flag, lon, lat, height, azimuth, altitude) ⇒ Object
717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 |
# File 'ext/swisseph/swisseph.c', line 717
static VALUE t_swe_azalt_rev(VALUE self, VALUE julian_day, VALUE flag, VALUE lon, VALUE lat, VALUE height, VALUE azimuth, VALUE altitude)
{
double geopos[3];
geopos[0] = NUM2DBL(lon);
geopos[1] = NUM2DBL(lat);
geopos[2] = NUM2DBL(height);
double xin[2];
xin[0] = NUM2DBL(azimuth);
xin[1] = NUM2DBL(altitude);
double xout[2];
swe_azalt_rev(NUM2DBL(julian_day), NUM2INT(flag), geopos, xin, xout);
VALUE output = rb_ary_new();
rb_ary_push(output, rb_float_new(xout[0]));
rb_ary_push(output, rb_float_new(xout[1]));
return output;
}
|
.swe_calc(julian_et, body, iflag) ⇒ Object
Calculation of planets, moon, asteroids, etc. (ET/TT version) int32 swe_calc(double tjd_et, int ipl, int32 iflag, double *xx, char *serr);
266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
# File 'ext/swisseph/swisseph.c', line 266
static VALUE t_swe_calc(VALUE self, VALUE julian_et, VALUE body, VALUE iflag)
{
double results[6];
char serr[AS_MAXCH];
if (swe_calc(NUM2DBL(julian_et), NUM2INT(body), NUM2LONG(iflag), results, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
for (int i = 0; i < 6; i++)
rb_ary_push(output, rb_float_new(results[i]));
return output;
}
|
.swe_calc_pctr(julian_et, body, center, iflag) ⇒ Object
1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 |
# File 'ext/swisseph/swisseph.c', line 1130
static VALUE t_swe_calc_pctr(VALUE self, VALUE julian_et, VALUE body, VALUE center, VALUE iflag)
{
char serr[AS_MAXCH];
double xxret[6];
if (swe_calc_pctr(NUM2DBL(julian_et), NUM2INT(body), NUM2INT(center), NUM2INT(iflag), xxret, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
for (int i = 0; i < 6; i++)
rb_ary_push(output, rb_float_new(xxret[i]));
return output;
}
|
.swe_calc_ut(julian_ut, body, iflag) ⇒ Object
247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'ext/swisseph/swisseph.c', line 247
static VALUE t_swe_calc_ut(VALUE self, VALUE julian_ut, VALUE body, VALUE iflag)
{
double results[6];
char serr[AS_MAXCH];
if (swe_calc_ut(NUM2DBL(julian_ut), NUM2INT(body), NUM2LONG(iflag), results, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
for (int i = 0; i < 6; i++)
rb_ary_push(output, rb_float_new(results[i]));
return output;
}
|
.swe_close ⇒ Object
56 57 58 59 60 |
# File 'ext/swisseph/swisseph.c', line 56
static VALUE t_swe_close(VALUE self)
{
swe_close();
return Qnil;
}
|
.swe_cotrans(*args) ⇒ Object
828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 |
# File 'ext/swisseph/swisseph.c', line 828
static VALUE t_swe_cotrans(int argc, VALUE *argv, VALUE self)
{
// VALUE self, VALUE VALUE lon, VALUE lat, VALUE distance
if (argc < 3 || argc > 4)
{ // there should only be 3 or 4 arguments
rb_raise(rb_eArgError, "wrong number of arguments");
}
double eps = NUM2DBL(argv[0]);
double xpo[3];
xpo[0] = NUM2DBL(argv[1]); // NUM2DBL(lon);
xpo[1] = NUM2DBL(argv[2]); // NUM2DBL(lat);
xpo[2] = NUM2DBL((argc == 4) ? argv[3] : 1.0);
double xpn[3];
swe_cotrans(xpo, xpn, eps);
VALUE output = rb_ary_new();
rb_ary_push(output, rb_float_new(xpn[0]));
rb_ary_push(output, rb_float_new(xpn[1]));
if (argc == 4)
rb_ary_push(output, rb_float_new(xpn[2]));
return output;
}
|
.swe_cotrans_sp(eps, lon, lat, dist, lon_speed, lat_speed, dist_speed) ⇒ Object
859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 |
# File 'ext/swisseph/swisseph.c', line 859
static VALUE t_swe_cotrans_sp(VALUE self, VALUE eps, VALUE lon, VALUE lat, VALUE dist, VALUE lon_speed, VALUE lat_speed, VALUE dist_speed)
{
double xpo[6];
xpo[0] = NUM2DBL(lon);
xpo[1] = NUM2DBL(lat);
xpo[2] = NUM2DBL(dist);
xpo[3] = NUM2DBL(lon_speed);
xpo[4] = NUM2DBL(lat_speed);
xpo[5] = NUM2DBL(dist_speed);
double xpn[6];
swe_cotrans_sp(xpo, xpn, NUM2DBL(eps));
VALUE output = rb_ary_new();
for (int i = 0; i < 6; i++)
rb_ary_push(output, rb_float_new(xpn[i]));
return output;
}
|
.swe_day_of_week(jd) ⇒ Object
215 216 217 218 |
# File 'ext/swisseph/swisseph.c', line 215
static VALUE t_swe_day_of_week(VALUE self, VALUE jd)
{
return INT2NUM(swe_day_of_week(NUM2DBL(jd)));
}
|
.swe_degnorm(deg) ⇒ Object
301 302 303 304 |
# File 'ext/swisseph/swisseph.c', line 301
static VALUE t_swe_degnorm(VALUE self, VALUE deg)
{
return rb_float_new(swe_degnorm(NUM2DBL(deg)));
}
|
.swe_deltat(julian_ut) ⇒ Object
1194 1195 1196 1197 1198 |
# File 'ext/swisseph/swisseph.c', line 1194
static VALUE t_swe_deltat(VALUE self, VALUE julian_ut)
{
double delta_t = swe_deltat(NUM2DBL(julian_ut));
return rb_float_new(delta_t);
}
|
.swe_deltat_ex(julian_ut, iflag) ⇒ Object
1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 |
# File 'ext/swisseph/swisseph.c', line 1205
static VALUE t_swe_deltat_ex(VALUE self, VALUE julian_ut, VALUE iflag)
{
char serr[AS_MAXCH];
double delta_t = swe_deltat_ex(NUM2DBL(julian_ut), NUM2INT(iflag), serr);
// If there's an error message, return it along with the delta_t value
if (serr[0] != '\0')
{
VALUE result = rb_ary_new();
rb_ary_push(result, rb_float_new(delta_t));
rb_ary_push(result, rb_str_new_cstr(serr));
return result;
}
return rb_float_new(delta_t);
}
|
.swe_fixstar(star, julian_et, iflag) ⇒ Object
1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 |
# File 'ext/swisseph/swisseph.c', line 1222
static VALUE t_swe_fixstar(VALUE self, VALUE star, VALUE julian_et, VALUE iflag)
{
char serr[AS_MAXCH];
double results[6];
if (swe_fixstar(StringValuePtr(star), NUM2DBL(julian_et), NUM2INT(iflag), results, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
for (int i = 0; i < 6; i++)
rb_ary_push(output, rb_float_new(results[i]));
return output;
}
|
.swe_fixstar2(star, julian_et, iflag) ⇒ Object
1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 |
# File 'ext/swisseph/swisseph.c', line 1263
static VALUE t_swe_fixstar2(VALUE self, VALUE star, VALUE julian_et, VALUE iflag)
{
char serr[AS_MAXCH];
double results[6];
if (swe_fixstar2(StringValuePtr(star), NUM2DBL(julian_et), NUM2INT(iflag), results, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
for (int i = 0; i < 6; i++)
rb_ary_push(output, rb_float_new(results[i]));
return output;
}
|
.swe_fixstar2_mag(star) ⇒ Object
1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 |
# File 'ext/swisseph/swisseph.c', line 1293
static VALUE t_swe_fixstar2_mag(VALUE self, VALUE star)
{
char serr[AS_MAXCH];
double mag;
if (swe_fixstar2_mag(StringValuePtr(star), &mag, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
return rb_float_new(mag);
}
|
.swe_fixstar2_ut(star, julian_ut, iflag) ⇒ Object
1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 |
# File 'ext/swisseph/swisseph.c', line 1278
static VALUE t_swe_fixstar2_ut(VALUE self, VALUE star, VALUE julian_ut, VALUE iflag)
{
char serr[AS_MAXCH];
double results[6];
if (swe_fixstar2_ut(StringValuePtr(star), NUM2DBL(julian_ut), NUM2INT(iflag), results, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
for (int i = 0; i < 6; i++)
rb_ary_push(output, rb_float_new(results[i]));
return output;
}
|
.swe_fixstar_mag(star) ⇒ Object
1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 |
# File 'ext/swisseph/swisseph.c', line 1252
static VALUE t_swe_fixstar_mag(VALUE self, VALUE star)
{
char serr[AS_MAXCH];
double mag;
if (swe_fixstar_mag(StringValuePtr(star), &mag, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
return rb_float_new(mag);
}
|
.swe_fixstar_ut(star, julian_ut, iflag) ⇒ Object
1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 |
# File 'ext/swisseph/swisseph.c', line 1237
static VALUE t_swe_fixstar_ut(VALUE self, VALUE star, VALUE julian_ut, VALUE iflag)
{
char serr[AS_MAXCH];
double results[6];
if (swe_fixstar_ut(StringValuePtr(star), NUM2DBL(julian_ut), NUM2INT(iflag), results, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
for (int i = 0; i < 6; i++)
rb_ary_push(output, rb_float_new(results[i]));
return output;
}
|
.swe_gauquelin_sector(tjd_ut, body, iflag, imeth, lon, lat, height, atpress, attemp) ⇒ Object
1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 |
# File 'ext/swisseph/swisseph.c', line 1402
static VALUE t_swe_gauquelin_sector(VALUE self, VALUE tjd_ut, VALUE body, VALUE iflag, VALUE imeth, VALUE lon, VALUE lat, VALUE height, VALUE atpress, VALUE attemp)
{
char serr[AS_MAXCH];
double geopos[3];
geopos[0] = NUM2DBL(lon);
geopos[1] = NUM2DBL(lat);
geopos[2] = NUM2DBL(height);
double dgsect;
int ipl;
char *starname;
if (TYPE(body) == T_STRING) {
starname = StringValuePtr(body);
ipl = 0;
} else {
ipl = NUM2INT(body);
starname = NULL;
}
if (swe_gauquelin_sector(NUM2DBL(tjd_ut), ipl, starname, NUM2INT(iflag), NUM2INT(imeth), geopos, NUM2DBL(atpress), NUM2DBL(attemp), &dgsect, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
return rb_float_new(dgsect);
}
|
.swe_get_ayanamsa(julian_et) ⇒ Object
370 371 372 373 374 |
# File 'ext/swisseph/swisseph.c', line 370
static VALUE t_swe_get_ayanamsa(VALUE self, VALUE julian_et)
{
double ayanamsa = swe_get_ayanamsa(NUM2DBL(julian_et));
return rb_float_new(ayanamsa);
}
|
.swe_get_ayanamsa_ex(julian_et, flag) ⇒ Object
403 404 405 406 407 408 409 410 411 412 |
# File 'ext/swisseph/swisseph.c', line 403
static VALUE t_swe_get_ayanamsa_ex(VALUE self, VALUE julian_et, VALUE flag)
{
double ayanamsha;
char serr[AS_MAXCH];
if (swe_get_ayanamsa_ex(NUM2DBL(julian_et), NUM2INT(flag), &ayanamsha, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
return rb_float_new(ayanamsha);
}
|
.swe_get_ayanamsa_ex_ut(julian_ut, flag) ⇒ Object
388 389 390 391 392 393 394 395 396 397 |
# File 'ext/swisseph/swisseph.c', line 388
static VALUE t_swe_get_ayanamsa_ex_ut(VALUE self, VALUE julian_ut, VALUE flag)
{
double ayanamsha;
char serr[AS_MAXCH];
if (swe_get_ayanamsa_ex_ut(NUM2DBL(julian_ut), NUM2INT(flag), &ayanamsha, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
return rb_float_new(ayanamsha);
}
|
.swe_get_ayanamsa_name(isidmode) ⇒ Object
88 89 90 91 92 93 94 |
# File 'ext/swisseph/swisseph.c', line 88
static VALUE t_swe_get_ayanamsa_name(VALUE self, VALUE isidmode)
{
const char *name = swe_get_ayanamsa_name(NUM2INT(isidmode));
if (name == NULL)
return Qnil;
return rb_str_new_cstr(name);
}
|
.swe_get_ayanamsa_ut(julian_ut) ⇒ Object
360 361 362 363 364 |
# File 'ext/swisseph/swisseph.c', line 360
static VALUE t_swe_get_ayanamsa_ut(VALUE self, VALUE julian_ut)
{
double ayanamsa = swe_get_ayanamsa_ut(NUM2DBL(julian_ut));
return rb_float_new(ayanamsa);
}
|
.swe_get_orbital_elements(julian_et, body, iflag) ⇒ Object
1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 |
# File 'ext/swisseph/swisseph.c', line 1174
static VALUE t_swe_get_orbital_elements(VALUE self, VALUE julian_et, VALUE body, VALUE iflag)
{
char serr[AS_MAXCH];
double dret[17]; // Array to store the return values
if (swe_get_orbital_elements(NUM2DBL(julian_et), NUM2INT(body), NUM2INT(iflag), dret, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
for (int i = 0; i < 17; i++)
rb_ary_push(output, rb_float_new(dret[i]));
return output;
}
|
.swe_get_planet_name(ipl) ⇒ Object
77 78 79 80 81 82 |
# File 'ext/swisseph/swisseph.c', line 77
static VALUE t_swe_get_planet_name(VALUE self, VALUE ipl)
{
char name[AS_MAXCH];
swe_get_planet_name(NUM2INT(ipl), name);
return rb_str_new_cstr(name);
}
|
.swe_heliacal_angle(*args) ⇒ Object
1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 |
# File 'ext/swisseph/swisseph.c', line 1737
static VALUE t_swe_heliacal_angle(int argc, VALUE *argv, VALUE self)
{
if (argc != 12)
rb_raise(rb_eArgError, "wrong number of arguments (12 required: tjdut, helflag, mag, azi_obj, azi_sun, azi_moon, alt_moon, lon, lat, height, datm_array, dobs_array)");
char serr[AS_MAXCH];
double dgeo[3];
dgeo[0] = NUM2DBL(argv[7]); // lon
dgeo[1] = NUM2DBL(argv[8]); // lat
dgeo[2] = NUM2DBL(argv[9]); // height
VALUE datm_arr = argv[10];
if (TYPE(datm_arr) != T_ARRAY || RARRAY_LEN(datm_arr) < 4)
rb_raise(rb_eArgError, "datm must be array of 4 values [pressure, temp, humidity, extinction_coeff]");
double datm[4];
for (int i = 0; i < 4; i++)
datm[i] = NUM2DBL(rb_ary_entry(datm_arr, i));
VALUE dobs_arr = argv[11];
if (TYPE(dobs_arr) != T_ARRAY || RARRAY_LEN(dobs_arr) < 6)
rb_raise(rb_eArgError, "dobs must be array of 6 values [age, snellen_left, snellen_right, telescope_mag, telescope_diam, binoc_factor]");
double dobs[6];
for (int i = 0; i < 6; i++)
dobs[i] = NUM2DBL(rb_ary_entry(dobs_arr, i));
double dret[20];
if (swe_heliacal_angle(NUM2DBL(argv[0]), dgeo, datm, dobs, NUM2INT(argv[1]),
NUM2DBL(argv[2]), NUM2DBL(argv[3]), NUM2DBL(argv[4]), NUM2DBL(argv[5]), NUM2DBL(argv[6]), dret, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
for (int i = 0; i < 3; i++)
rb_ary_push(output, rb_float_new(dret[i]));
return output;
}
|
.swe_heliacal_pheno_ut(*args) ⇒ Object
1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 |
# File 'ext/swisseph/swisseph.c', line 1692
static VALUE t_swe_heliacal_pheno_ut(int argc, VALUE *argv, VALUE self)
{
if (argc != 9)
rb_raise(rb_eArgError, "wrong number of arguments (9 required: tjd_ut, object_name, type_event, helflag, lon, lat, height, datm_array, dobs_array)");
char serr[AS_MAXCH];
double geopos[3];
geopos[0] = NUM2DBL(argv[4]); // lon
geopos[1] = NUM2DBL(argv[5]); // lat
geopos[2] = NUM2DBL(argv[6]); // height
VALUE datm_arr = argv[7];
if (TYPE(datm_arr) != T_ARRAY || RARRAY_LEN(datm_arr) < 4)
rb_raise(rb_eArgError, "datm must be array of 4 values [pressure, temp, humidity, extinction_coeff]");
double datm[4];
for (int i = 0; i < 4; i++)
datm[i] = NUM2DBL(rb_ary_entry(datm_arr, i));
VALUE dobs_arr = argv[8];
if (TYPE(dobs_arr) != T_ARRAY || RARRAY_LEN(dobs_arr) < 6)
rb_raise(rb_eArgError, "dobs must be array of 6 values [age, snellen_left, snellen_right, telescope_mag, telescope_diam, binoc_factor]");
double dobs[6];
for (int i = 0; i < 6; i++)
dobs[i] = NUM2DBL(rb_ary_entry(dobs_arr, i));
double darr[50];
char *object_name = StringValuePtr(argv[1]);
if (swe_heliacal_pheno_ut(NUM2DBL(argv[0]), geopos, datm, dobs, object_name, NUM2INT(argv[2]), NUM2INT(argv[3]), darr, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
for (int i = 0; i < 50; i++)
rb_ary_push(output, rb_float_new(darr[i]));
return output;
}
|
.swe_heliacal_ut(*args) ⇒ Object
1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 |
# File 'ext/swisseph/swisseph.c', line 1313
static VALUE t_swe_heliacal_ut(int argc, VALUE *argv, VALUE self)
{
if (argc != 9)
rb_raise(rb_eArgError, "wrong number of arguments (9 required: tjd_ut, object_name, type_event, iflag, lon, lat, height, datm_array, dobs_array)");
char serr[AS_MAXCH];
double geopos[3];
geopos[0] = NUM2DBL(argv[4]); // lon
geopos[1] = NUM2DBL(argv[5]); // lat
geopos[2] = NUM2DBL(argv[6]); // height
// datm: atmospheric data array (4 doubles)
VALUE datm_arr = argv[7];
if (TYPE(datm_arr) != T_ARRAY || RARRAY_LEN(datm_arr) < 4)
rb_raise(rb_eArgError, "datm must be array of 4 values [pressure, temp, humidity, extinction_coeff]");
double datm[4];
for (int i = 0; i < 4; i++)
datm[i] = NUM2DBL(rb_ary_entry(datm_arr, i));
// dobs: observer data array (6 doubles)
VALUE dobs_arr = argv[8];
if (TYPE(dobs_arr) != T_ARRAY || RARRAY_LEN(dobs_arr) < 6)
rb_raise(rb_eArgError, "dobs must be array of 6 values [age, snellen_left, snellen_right, telescope_mag, telescope_diam, binoc_factor]");
double dobs[6];
for (int i = 0; i < 6; i++)
dobs[i] = NUM2DBL(rb_ary_entry(dobs_arr, i));
double dret[50];
char *object_name = StringValuePtr(argv[1]);
if (swe_heliacal_ut(NUM2DBL(argv[0]), geopos, datm, dobs, object_name, NUM2INT(argv[2]), NUM2INT(argv[3]), dret, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
for (int i = 0; i < 50; i++)
rb_ary_push(output, rb_float_new(dret[i]));
return output;
}
|
.swe_helio_cross(body, x2cross, tjd_et, iflag, dir) ⇒ Object
1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 |
# File 'ext/swisseph/swisseph.c', line 1029
static VALUE t_swe_helio_cross(VALUE self, VALUE body, VALUE x2cross, VALUE tjd_et, VALUE iflag, VALUE dir)
{
char serr[AS_MAXCH];
serr[0] = '\0';
double jx;
int32 retval = swe_helio_cross(NUM2INT(body), NUM2DBL(x2cross), NUM2DBL(tjd_et), NUM2INT(iflag), NUM2INT(dir), &jx, serr);
if (retval < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
return rb_float_new(jx);
}
|
.swe_helio_cross_ut(body, x2cross, tjd_ut, iflag, dir) ⇒ Object
961 962 963 964 965 966 967 968 969 970 |
# File 'ext/swisseph/swisseph.c', line 961
static VALUE t_swe_helio_cross_ut(VALUE self, VALUE body, VALUE x2cross, VALUE tjd_ut, VALUE iflag, VALUE dir)
{
char serr[AS_MAXCH];
serr[0] = '\0';
double jx;
int32 retval = swe_helio_cross_ut(NUM2INT(body), NUM2DBL(x2cross), NUM2DBL(tjd_ut), NUM2INT(iflag), NUM2INT(dir), &jx, serr);
if (retval < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
return rb_float_new(jx);
}
|
.swe_house_name(hsys) ⇒ Object
583 584 585 586 |
# File 'ext/swisseph/swisseph.c', line 583
static VALUE t_swe_house_name(VALUE self, VALUE hsys)
{
return rb_str_new_cstr(swe_house_name(NUM2CHR(hsys)));
}
|
.swe_house_pos(armc, geolat, eps, hsys, eclon, eclat) ⇒ Object
879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 |
# File 'ext/swisseph/swisseph.c', line 879
static VALUE t_swe_house_pos(VALUE self, VALUE armc, VALUE geolat, VALUE eps, VALUE hsys, VALUE eclon, VALUE eclat)
{
// double armc, /* ARMC */
// double geolat, /* geographic latitude, in degrees */
// double eps, /* ecliptic obliquity, in degrees */
// int hsys, /* house method, one of the letters PKRCAV */
// double *xpin, /* array of 2 doubles: ecl. longitude and latitude of the planet */
// char *serr); /* return area for error or warning message */
double eclpos[2];
eclpos[0] = NUM2DBL(eclon);
eclpos[1] = NUM2DBL(eclat);
char serr[AS_MAXCH];
double retval = swe_house_pos(NUM2DBL(armc), NUM2DBL(geolat), NUM2DBL(eps), NUM2INT(hsys), eclpos, serr);
if (retval < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_float_new(retval);
return output;
}
|
.swe_houses(julian_day, latitude, longitude, house_system) ⇒ Object
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 |
# File 'ext/swisseph/swisseph.c', line 443
static VALUE t_swe_houses(VALUE self, VALUE julian_day, VALUE latitude, VALUE longitude, VALUE house_system)
{
double cusps[37]; // 37 for Gauquelin sectors, 13 for others
double ascmc[10];
char serr[AS_MAXCH];
char hsys = NUM2CHR(house_system);
int num_cusps = (hsys == 'G') ? 37 : 13;
if (swe_houses(NUM2DBL(julian_day), NUM2DBL(latitude), NUM2DBL(longitude), hsys, cusps, ascmc) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE _cusps = rb_ary_new();
for (int i = 0; i < num_cusps; i++)
rb_ary_push(_cusps, rb_float_new(cusps[i]));
VALUE _ascmc = rb_ary_new();
for (int i = 0; i < 10; i++)
rb_ary_push(_ascmc, rb_float_new(ascmc[i]));
VALUE output = rb_ary_new();
rb_ary_push(output, _cusps);
rb_ary_push(output, _ascmc);
return output;
}
|
.swe_houses_armc(armc, latitude, eps, house_system) ⇒ Object
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 |
# File 'ext/swisseph/swisseph.c', line 501
static VALUE t_swe_houses_armc(VALUE self, VALUE armc, VALUE latitude, VALUE eps, VALUE house_system)
{
double cusps[37]; // 37 for Gauquelin sectors, 13 for others
double ascmc[10];
char serr[AS_MAXCH];
char hsys = NUM2CHR(house_system);
int num_cusps = (hsys == 'G') ? 37 : 13;
if (swe_houses_armc(NUM2DBL(armc), NUM2DBL(latitude), NUM2DBL(eps), hsys, cusps, ascmc) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE _cusps = rb_ary_new();
for (int i = 0; i < num_cusps; i++)
rb_ary_push(_cusps, rb_float_new(cusps[i]));
VALUE _ascmc = rb_ary_new();
for (int i = 0; i < 10; i++)
rb_ary_push(_ascmc, rb_float_new(ascmc[i]));
VALUE output = rb_ary_new();
rb_ary_push(output, _cusps);
rb_ary_push(output, _ascmc);
return output;
}
|
.swe_houses_ex(julian_day, iflag, latitude, longitude, house_system) ⇒ Object
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 |
# File 'ext/swisseph/swisseph.c', line 472
static VALUE t_swe_houses_ex(VALUE self, VALUE julian_day, VALUE iflag, VALUE latitude, VALUE longitude, VALUE house_system)
{
double cusps[37]; // 37 for Gauquelin sectors, 13 for others
double ascmc[10];
char serr[AS_MAXCH];
char hsys = NUM2CHR(house_system);
int num_cusps = (hsys == 'G') ? 37 : 13;
if (swe_houses_ex(NUM2DBL(julian_day), NUM2INT(iflag), NUM2DBL(latitude), NUM2DBL(longitude), hsys, cusps, ascmc) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE _cusps = rb_ary_new();
for (int i = 0; i < num_cusps; i++)
rb_ary_push(_cusps, rb_float_new(cusps[i]));
VALUE _ascmc = rb_ary_new();
for (int i = 0; i < 10; i++)
rb_ary_push(_ascmc, rb_float_new(ascmc[i]));
VALUE output = rb_ary_new();
rb_ary_push(output, _cusps);
rb_ary_push(output, _ascmc);
return output;
}
|
.swe_houses_ex2(julian_day, flag, latitude, longitude, house_system) ⇒ Object
544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 |
# File 'ext/swisseph/swisseph.c', line 544
static VALUE t_swe_houses_ex2(VALUE self, VALUE julian_day, VALUE flag, VALUE latitude, VALUE longitude, VALUE house_system)
{
double cusps[37]; // 37 for Gauquelin sectors, 13 for others
double ascmc[10];
double cusps_speed[37]; // 37 for Gauquelin sectors, 13 for others
double ascmc_speed[10];
char serr[AS_MAXCH];
char hsys = NUM2CHR(house_system);
int num_cusps = (hsys == 'G') ? 37 : 13;
if (swe_houses_ex2(NUM2DBL(julian_day), NUM2INT(flag), NUM2DBL(latitude), NUM2DBL(longitude), hsys, cusps, ascmc, cusps_speed, ascmc_speed, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE _cusps = rb_ary_new();
for (int i = 0; i < num_cusps; i++)
rb_ary_push(_cusps, rb_float_new(cusps[i]));
VALUE _ascmc = rb_ary_new();
for (int i = 0; i < 10; i++)
rb_ary_push(_ascmc, rb_float_new(ascmc[i]));
VALUE _cusps_speed = rb_ary_new();
for (int i = 0; i < num_cusps; i++)
rb_ary_push(_cusps_speed, rb_float_new(cusps_speed[i]));
VALUE _ascmc_speed = rb_ary_new();
for (int i = 0; i < 10; i++)
rb_ary_push(_ascmc_speed, rb_float_new(ascmc_speed[i]));
VALUE output = rb_ary_new();
rb_ary_push(output, _cusps);
rb_ary_push(output, _ascmc);
rb_ary_push(output, _cusps_speed);
rb_ary_push(output, _ascmc_speed);
return output;
}
|
.swe_jdut1_to_utc(*args) ⇒ Object
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'ext/swisseph/swisseph.c', line 189
static VALUE t_swe_jdut1_to_utc(int argc, VALUE *argv, VALUE self)
{
if (argc < 1 || argc > 2)
rb_raise(rb_eArgError, "wrong number of arguments (1 or 2)");
int32 gregflag = (argc == 2) ? NUM2INT(argv[1]) : SE_GREG_CAL;
int32 year, month, day, hour, min;
double sec;
swe_jdut1_to_utc(NUM2DBL(argv[0]), gregflag, &year, &month, &day, &hour, &min, &sec);
VALUE output = rb_ary_new();
rb_ary_push(output, INT2NUM(year));
rb_ary_push(output, INT2NUM(month));
rb_ary_push(output, INT2NUM(day));
rb_ary_push(output, INT2NUM(hour));
rb_ary_push(output, INT2NUM(min));
rb_ary_push(output, rb_float_new(sec));
return output;
}
|
.swe_julday(*args) ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'ext/swisseph/swisseph.c', line 107
static VALUE t_swe_julday(int argc, VALUE *argv, VALUE self)
{
VALUE greg_flag;
if (argc > 5 || argc < 4)
{ // there should only be 4 or 5 arguments
rb_raise(rb_eArgError, "wrong number of arguments");
}
greg_flag = (argc == 5) ? NUM2INT(argv[4]) : SE_GREG_CAL;
double julday = swe_julday(NUM2INT(argv[0]), NUM2INT(argv[1]), NUM2INT(argv[2]), NUM2DBL(argv[3]), greg_flag);
return rb_float_new(julday);
}
|
.swe_lat_to_lmt(tjd_lat, geolon) ⇒ Object
809 810 811 812 813 814 815 816 817 818 |
# File 'ext/swisseph/swisseph.c', line 809
static VALUE t_swe_lat_to_lmt(VALUE self, VALUE tjd_lat, VALUE geolon)
{
double tjd_lmt;
char serr[AS_MAXCH];
if (swe_lat_to_lmt(NUM2DBL(tjd_lat), NUM2DBL(geolon), &tjd_lmt, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
return rb_float_new(tjd_lmt);
}
|
.swe_lmt_to_lat(tjd_lmt, geolon) ⇒ Object
794 795 796 797 798 799 800 801 802 803 |
# File 'ext/swisseph/swisseph.c', line 794
static VALUE t_swe_lmt_to_lat(VALUE self, VALUE tjd_lmt, VALUE geolon)
{
double tjd_lat;
char serr[AS_MAXCH];
if (swe_lmt_to_lat(NUM2DBL(tjd_lmt), NUM2DBL(geolon), &tjd_lat, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
return rb_float_new(tjd_lat);
}
|
.swe_lun_eclipse_how(tjd, ifl, lon, lat, height) ⇒ Object
1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 |
# File 'ext/swisseph/swisseph.c', line 1644
static VALUE t_swe_lun_eclipse_how(VALUE self, VALUE tjd, VALUE ifl, VALUE lon, VALUE lat, VALUE height)
{
char serr[AS_MAXCH];
double geopos[3];
geopos[0] = NUM2DBL(lon);
geopos[1] = NUM2DBL(lat);
geopos[2] = NUM2DBL(height);
double attr[20];
int32 result = swe_lun_eclipse_how(NUM2DBL(tjd), NUM2INT(ifl), geopos, attr, serr);
if (result < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
rb_ary_push(output, INT2NUM(result)); // eclipse type flags
for (int i = 0; i < 20; i++)
rb_ary_push(output, rb_float_new(attr[i]));
return output;
}
|
.swe_lun_eclipse_when(tjd_start, ifl, ifltype, backward) ⇒ Object
1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 |
# File 'ext/swisseph/swisseph.c', line 1576
static VALUE t_swe_lun_eclipse_when(VALUE self, VALUE tjd_start, VALUE ifl, VALUE ifltype, VALUE backward)
{
char serr[AS_MAXCH];
double tret[10];
int32 result = swe_lun_eclipse_when(NUM2DBL(tjd_start), NUM2INT(ifl), NUM2INT(ifltype), tret, NUM2INT(backward), serr);
if (result < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
rb_ary_push(output, INT2NUM(result)); // eclipse type flags
for (int i = 0; i < 10; i++)
rb_ary_push(output, rb_float_new(tret[i]));
return output;
}
|
.swe_lun_eclipse_when_loc(tjd_start, ifl, lon, lat, height, backward) ⇒ Object
1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 |
# File 'ext/swisseph/swisseph.c', line 1597
static VALUE t_swe_lun_eclipse_when_loc(VALUE self, VALUE tjd_start, VALUE ifl, VALUE lon, VALUE lat, VALUE height, VALUE backward)
{
char serr[AS_MAXCH];
double geopos[3];
geopos[0] = NUM2DBL(lon);
geopos[1] = NUM2DBL(lat);
geopos[2] = NUM2DBL(height);
double tret[10];
double attr[20];
int32 result = swe_lun_eclipse_when_loc(NUM2DBL(tjd_start), NUM2INT(ifl), geopos, tret, attr, NUM2INT(backward), serr);
if (result < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
rb_ary_push(output, INT2NUM(result)); // eclipse type flags
VALUE _tret = rb_ary_new();
for (int i = 0; i < 10; i++)
rb_ary_push(_tret, rb_float_new(tret[i]));
rb_ary_push(output, _tret);
VALUE _attr = rb_ary_new();
for (int i = 0; i < 20; i++)
rb_ary_push(_attr, rb_float_new(attr[i]));
rb_ary_push(output, _attr);
return output;
}
|
.swe_lun_occult_when_glob(tjd_start, ipl, starname, ifl, ifltype, backward) ⇒ Object
1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 |
# File 'ext/swisseph/swisseph.c', line 1914
static VALUE t_swe_lun_occult_when_glob(VALUE self, VALUE tjd_start, VALUE ipl, VALUE starname, VALUE ifl, VALUE ifltype, VALUE backward)
{
char serr[AS_MAXCH];
char star[AS_MAXCH];
double tret[10];
if (NIL_P(starname))
star[0] = '\0';
else {
strncpy(star, StringValueCStr(starname), AS_MAXCH - 1);
star[AS_MAXCH - 1] = '\0';
}
int32 result = swe_lun_occult_when_glob(NUM2DBL(tjd_start), NUM2INT(ipl), star, NUM2INT(ifl), NUM2INT(ifltype), tret, NUM2INT(backward), serr);
if (result < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
rb_ary_push(output, INT2NUM(result)); // eclipse type flags
for (int i = 0; i < 10; i++)
rb_ary_push(output, rb_float_new(tret[i]));
return output;
}
|
.swe_lun_occult_when_loc(tjd_start, ipl, starname, ifl, lon, lat, height, backward) ⇒ Object
1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 |
# File 'ext/swisseph/swisseph.c', line 1866
static VALUE t_swe_lun_occult_when_loc(VALUE self, VALUE tjd_start, VALUE ipl, VALUE starname, VALUE ifl, VALUE lon, VALUE lat, VALUE height, VALUE backward)
{
char serr[AS_MAXCH];
char star[AS_MAXCH];
double geopos[3];
double tret[10];
double attr[20];
geopos[0] = NUM2DBL(lon);
geopos[1] = NUM2DBL(lat);
geopos[2] = NUM2DBL(height);
if (NIL_P(starname))
star[0] = '\0';
else {
strncpy(star, StringValueCStr(starname), AS_MAXCH - 1);
star[AS_MAXCH - 1] = '\0';
}
int32 result = swe_lun_occult_when_loc(NUM2DBL(tjd_start), NUM2INT(ipl), star, NUM2INT(ifl), geopos, tret, attr, NUM2INT(backward), serr);
if (result < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
rb_ary_push(output, INT2NUM(result)); // eclipse type flags
VALUE _tret = rb_ary_new();
for (int i = 0; i < 10; i++)
rb_ary_push(_tret, rb_float_new(tret[i]));
rb_ary_push(output, _tret);
VALUE _attr = rb_ary_new();
for (int i = 0; i < 20; i++)
rb_ary_push(_attr, rb_float_new(attr[i]));
rb_ary_push(output, _attr);
return output;
}
|
.swe_lun_occult_where(tjd, ipl, starname, ifl) ⇒ Object
1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 |
# File 'ext/swisseph/swisseph.c', line 1824
static VALUE t_swe_lun_occult_where(VALUE self, VALUE tjd, VALUE ipl, VALUE starname, VALUE ifl)
{
char serr[AS_MAXCH];
char star[AS_MAXCH];
double geopos[10];
double attr[20];
if (NIL_P(starname))
star[0] = '\0';
else {
strncpy(star, StringValueCStr(starname), AS_MAXCH - 1);
star[AS_MAXCH - 1] = '\0';
}
int32 result = swe_lun_occult_where(NUM2DBL(tjd), NUM2INT(ipl), star, NUM2INT(ifl), geopos, attr, serr);
if (result < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
rb_ary_push(output, INT2NUM(result)); // eclipse type flags
VALUE _geopos = rb_ary_new();
rb_ary_push(_geopos, rb_float_new(geopos[0])); // longitude
rb_ary_push(_geopos, rb_float_new(geopos[1])); // latitude
rb_ary_push(output, _geopos);
VALUE _attr = rb_ary_new();
for (int i = 0; i < 20; i++)
rb_ary_push(_attr, rb_float_new(attr[i]));
rb_ary_push(output, _attr);
return output;
}
|
.swe_mooncross(x2cross, tjd_et, iflag) ⇒ Object
992 993 994 995 996 997 998 999 1000 1001 1002 |
# File 'ext/swisseph/swisseph.c', line 992
static VALUE t_swe_mooncross(VALUE self, VALUE x2cross, VALUE tjd_et, VALUE iflag)
{
char serr[AS_MAXCH];
serr[0] = '\0';
double tjd = NUM2DBL(tjd_et);
double retval = swe_mooncross(NUM2DBL(x2cross), tjd, NUM2INT(iflag), serr);
if (retval < tjd)
rb_raise(rb_eRuntimeError, "%s", serr);
return rb_float_new(retval);
}
|
.swe_mooncross_node(tjd_et, iflag) ⇒ Object
1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 |
# File 'ext/swisseph/swisseph.c', line 1008
static VALUE t_swe_mooncross_node(VALUE self, VALUE tjd_et, VALUE iflag)
{
char serr[AS_MAXCH];
serr[0] = '\0';
double tjd = NUM2DBL(tjd_et);
double xlon, xlat;
double retval = swe_mooncross_node(tjd, NUM2INT(iflag), &xlon, &xlat, serr);
if (retval < tjd)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
rb_ary_push(output, rb_float_new(retval));
rb_ary_push(output, rb_float_new(xlon));
rb_ary_push(output, rb_float_new(xlat));
return output;
}
|
.swe_mooncross_node_ut(tjd_ut, iflag) ⇒ Object
941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 |
# File 'ext/swisseph/swisseph.c', line 941
static VALUE t_swe_mooncross_node_ut(VALUE self, VALUE tjd_ut, VALUE iflag)
{
char serr[AS_MAXCH];
serr[0] = '\0';
double tjd = NUM2DBL(tjd_ut);
double xlon, xlat;
double retval = swe_mooncross_node_ut(tjd, NUM2INT(iflag), &xlon, &xlat, serr);
if (retval < tjd)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
rb_ary_push(output, rb_float_new(retval));
rb_ary_push(output, rb_float_new(xlon));
rb_ary_push(output, rb_float_new(xlat));
return output;
}
|
.swe_mooncross_ut(x2cross, tjd_ut, iflag) ⇒ Object
921 922 923 924 925 926 927 928 929 930 931 |
# File 'ext/swisseph/swisseph.c', line 921
static VALUE t_swe_mooncross_ut(VALUE self, VALUE x2cross, VALUE tjd_ut, VALUE iflag)
{
char serr[AS_MAXCH];
serr[0] = '\0';
double tjd = NUM2DBL(tjd_ut);
double retval = swe_mooncross_ut(NUM2DBL(x2cross), tjd, NUM2INT(iflag), serr);
if (retval < tjd)
rb_raise(rb_eRuntimeError, "%s", serr);
return rb_float_new(retval);
}
|
.swe_nod_aps(julian_et, body, iflag, method) ⇒ Object
1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 |
# File 'ext/swisseph/swisseph.c', line 1084
static VALUE t_swe_nod_aps(VALUE self, VALUE julian_et, VALUE body, VALUE iflag, VALUE method)
{
char serr[AS_MAXCH];
double xnasc[6];
double xndsc[6];
double xperi[6];
double xaphe[6];
if (swe_nod_aps(NUM2DBL(julian_et), NUM2INT(body), NUM2INT(iflag), NUM2INT(method), xnasc, xndsc, xperi, xaphe, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
VALUE ascending = rb_ary_new();
for (int i = 0; i < 6; i++)
rb_ary_push(ascending, rb_float_new(xnasc[i]));
rb_ary_push(output, ascending);
VALUE descending = rb_ary_new();
for (int i = 0; i < 6; i++)
rb_ary_push(descending, rb_float_new(xndsc[i]));
rb_ary_push(output, descending);
VALUE perihelion = rb_ary_new();
for (int i = 0; i < 6; i++)
rb_ary_push(perihelion, rb_float_new(xperi[i]));
rb_ary_push(output, perihelion);
VALUE aphelion = rb_ary_new();
for (int i = 0; i < 6; i++)
rb_ary_push(aphelion, rb_float_new(xaphe[i]));
rb_ary_push(output, aphelion);
return output; // return array of arrays
}
|
.swe_nod_aps_ut(julian_ut, body, iflag, method) ⇒ Object
1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 |
# File 'ext/swisseph/swisseph.c', line 1044
static VALUE t_swe_nod_aps_ut(VALUE self, VALUE julian_ut, VALUE body, VALUE iflag, VALUE method)
{
char serr[AS_MAXCH];
double xnasc[6];
double xndsc[6];
double xperi[6];
double xaphe[6];
if (swe_nod_aps_ut(NUM2DBL(julian_ut), NUM2INT(body), NUM2INT(iflag), NUM2INT(method), xnasc, xndsc, xperi, xaphe, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
VALUE ascending = rb_ary_new();
for (int i = 0; i < 6; i++)
rb_ary_push(ascending, rb_float_new(xnasc[i]));
rb_ary_push(output, ascending);
VALUE descending = rb_ary_new();
for (int i = 0; i < 6; i++)
rb_ary_push(descending, rb_float_new(xndsc[i]));
rb_ary_push(output, descending);
VALUE perihelion = rb_ary_new();
for (int i = 0; i < 6; i++)
rb_ary_push(perihelion, rb_float_new(xperi[i]));
rb_ary_push(output, perihelion);
VALUE aphelion = rb_ary_new();
for (int i = 0; i < 6; i++)
rb_ary_push(aphelion, rb_float_new(xaphe[i]));
rb_ary_push(output, aphelion);
return output; // return array of arrays
}
|
.swe_pheno_ut(julian_ut, ipl, iflag) ⇒ Object
760 761 762 763 764 765 766 767 768 769 770 771 772 |
# File 'ext/swisseph/swisseph.c', line 760
static VALUE t_swe_pheno_ut(VALUE self, VALUE julian_ut, VALUE ipl, VALUE iflag)
{
double attr[20];
char serr[AS_MAXCH];
if (swe_pheno_ut(NUM2DBL(julian_ut), NUM2INT(ipl), NUM2INT(iflag), attr, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
for (int i = 0; i < 7; i++)
rb_ary_push(output, rb_float_new(attr[i]));
return output;
}
|
.swe_radnorm(rad) ⇒ Object
310 311 312 313 |
# File 'ext/swisseph/swisseph.c', line 310
static VALUE t_swe_radnorm(VALUE self, VALUE rad)
{
return rb_float_new(swe_radnorm(NUM2DBL(rad)));
}
|
.swe_refrac(inalt, atpress, attemp, calc_flag) ⇒ Object
742 743 744 745 746 |
# File 'ext/swisseph/swisseph.c', line 742
static VALUE t_swe_refrac(VALUE self, VALUE inalt, VALUE atpress, VALUE attemp, VALUE calc_flag)
{
double result = swe_refrac(NUM2DBL(inalt), NUM2DBL(atpress), NUM2DBL(attemp), NUM2INT(calc_flag));
return rb_float_new(result);
}
|
.swe_refrac_extended(inalt, geoalt, atpress, attemp, lapse_rate, calc_flag) ⇒ Object
1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 |
# File 'ext/swisseph/swisseph.c', line 1673
static VALUE t_swe_refrac_extended(VALUE self, VALUE inalt, VALUE geoalt, VALUE atpress, VALUE attemp, VALUE lapse_rate, VALUE calc_flag)
{
double dret[20];
double result = swe_refrac_extended(NUM2DBL(inalt), NUM2DBL(geoalt), NUM2DBL(atpress), NUM2DBL(attemp), NUM2DBL(lapse_rate), NUM2INT(calc_flag), dret);
VALUE output = rb_ary_new();
rb_ary_push(output, rb_float_new(result));
for (int i = 0; i < 4; i++)
rb_ary_push(output, rb_float_new(dret[i]));
return output;
}
|
.swe_revjul(*args) ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'ext/swisseph/swisseph.c', line 132
static VALUE t_swe_revjul(int argc, VALUE *argv, VALUE self)
{
if (argc > 2 || argc < 1)
{ // there should only be 2 or 3 arguments
rb_raise(rb_eArgError, "wrong number of arguments");
}
VALUE greg_flag = (argc == 2) ? NUM2INT(argv[1]) : SE_GREG_CAL;
int year, month, day;
double hour;
swe_revjul(NUM2DBL(argv[0]), greg_flag, &year, &month, &day, &hour);
VALUE output = rb_ary_new();
rb_ary_push(output, rb_uint_new(year));
rb_ary_push(output, rb_uint_new(month));
rb_ary_push(output, rb_uint_new(day));
rb_ary_push(output, rb_float_new(hour));
return output;
}
|
.swe_rise_trans(julian_day, body, flag, rmsi, lon, lat, height, pressure, temp) ⇒ Object
601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 |
# File 'ext/swisseph/swisseph.c', line 601
static VALUE t_swe_rise_trans(VALUE self, VALUE julian_day, VALUE body, VALUE flag, VALUE rmsi, VALUE lon, VALUE lat, VALUE height, VALUE pressure, VALUE temp)
{
double geopos[3];
geopos[0] = NUM2DBL(lon);
geopos[1] = NUM2DBL(lat);
geopos[2] = NUM2DBL(height);
int ipl;
char *starname;
if (TYPE(body) == T_STRING)
{
starname = StringValuePtr(body);
ipl = 0;
}
else
{
ipl = NUM2INT(body);
starname = NULL;
}
char serr[AS_MAXCH];
double retval;
if (swe_rise_trans(NUM2DBL(julian_day), ipl, starname, NUM2INT(flag), NUM2INT(rmsi), geopos, NUM2DBL(pressure), NUM2DBL(temp), &retval, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
return rb_float_new(retval);
}
|
.swe_rise_trans_true_hor(julian_day, body, flag, rmsi, lon, lat, height, pressure, temp, hor_height) ⇒ Object
641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 |
# File 'ext/swisseph/swisseph.c', line 641
static VALUE t_swe_rise_trans_true_hor(VALUE self, VALUE julian_day, VALUE body, VALUE flag, VALUE rmsi, VALUE lon, VALUE lat, VALUE height, VALUE pressure, VALUE temp, VALUE hor_height)
{
double geopos[3];
geopos[0] = NUM2DBL(lon);
geopos[1] = NUM2DBL(lat);
geopos[2] = NUM2DBL(height);
int ipl;
char *starname;
if (TYPE(body) == T_STRING)
{
starname = StringValuePtr(body);
ipl = 0;
}
else
{
ipl = NUM2INT(body);
starname = NULL;
}
char serr[AS_MAXCH];
double retval;
if (swe_rise_trans_true_hor(NUM2DBL(julian_day), ipl, starname, NUM2INT(flag), NUM2INT(rmsi), geopos, NUM2DBL(pressure), NUM2DBL(temp), NUM2DBL(hor_height), &retval, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
return rb_float_new(retval);
}
|
.swe_set_ephe_path(path) ⇒ Object
Set directory path of ephemeris files http://www.astro.com/swisseph/swephprg.htm#_Toc283735481 int swe_set_ephe_path(char *path);
35 36 37 38 39 |
# File 'ext/swisseph/swisseph.c', line 35
static VALUE t_swe_set_ephe_path(VALUE self, VALUE path)
{
swe_set_ephe_path(StringValuePtr(path));
return Qnil;
}
|
.swe_set_jpl_file(path) ⇒ Object
46 47 48 49 50 |
# File 'ext/swisseph/swisseph.c', line 46
static VALUE t_swe_set_jpl_file(VALUE self, VALUE path)
{
swe_set_jpl_file(StringValuePtr(path));
return Qnil;
}
|
.swe_set_sid_mode(mode, t0, ayan_t0) ⇒ Object
346 347 348 349 350 |
# File 'ext/swisseph/swisseph.c', line 346
static VALUE t_swe_set_sid_mode(VALUE self, VALUE mode, VALUE t0, VALUE ayan_t0)
{
swe_set_sid_mode(NUM2INT(mode), NUM2DBL(t0), NUM2DBL(ayan_t0));
return Qnil;
}
|
.swe_set_topo(lon, lat, alt) ⇒ Object
230 231 232 233 234 |
# File 'ext/swisseph/swisseph.c', line 230
static VALUE t_swe_set_topo(VALUE self, VALUE lon, VALUE lat, VALUE alt)
{
swe_set_topo(NUM2DBL(lon), NUM2DBL(lat), NUM2DBL(alt));
return Qnil;
}
|
.swe_sidtime(julian_ut) ⇒ Object
281 282 283 284 285 |
# File 'ext/swisseph/swisseph.c', line 281
static VALUE t_swe_sidtime(VALUE self, VALUE julian_ut)
{
double sidtime = swe_sidtime(NUM2DBL(julian_ut));
return rb_float_new(sidtime);
}
|
.swe_sidtime0(julian_ut, eps, nut) ⇒ Object
291 292 293 294 295 |
# File 'ext/swisseph/swisseph.c', line 291
static VALUE t_swe_sidtime0(VALUE self, VALUE julian_ut, VALUE eps, VALUE nut)
{
double sidtime = swe_sidtime0(NUM2DBL(julian_ut), NUM2DBL(eps), NUM2DBL(nut));
return rb_float_new(sidtime);
}
|
.swe_sol_eclipse_how(tjd, ifl, lon, lat, height) ⇒ Object
1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 |
# File 'ext/swisseph/swisseph.c', line 1511
static VALUE t_swe_sol_eclipse_how(VALUE self, VALUE tjd, VALUE ifl, VALUE lon, VALUE lat, VALUE height)
{
char serr[AS_MAXCH];
double geopos[3];
geopos[0] = NUM2DBL(lon);
geopos[1] = NUM2DBL(lat);
geopos[2] = NUM2DBL(height);
double attr[20];
int32 result = swe_sol_eclipse_how(NUM2DBL(tjd), NUM2INT(ifl), geopos, attr, serr);
if (result < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
rb_ary_push(output, INT2NUM(result)); // eclipse type flags
for (int i = 0; i < 20; i++)
rb_ary_push(output, rb_float_new(attr[i]));
return output;
}
|
.swe_sol_eclipse_when_glob(tjd_start, ifl, ifltype, backward) ⇒ Object
1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 |
# File 'ext/swisseph/swisseph.c', line 1444
static VALUE t_swe_sol_eclipse_when_glob(VALUE self, VALUE tjd_start, VALUE ifl, VALUE ifltype, VALUE backward)
{
char serr[AS_MAXCH];
double tret[10];
int32 result = swe_sol_eclipse_when_glob(NUM2DBL(tjd_start), NUM2INT(ifl), NUM2INT(ifltype), tret, NUM2INT(backward), serr);
if (result < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
rb_ary_push(output, INT2NUM(result)); // eclipse type flags
for (int i = 0; i < 10; i++)
rb_ary_push(output, rb_float_new(tret[i]));
return output;
}
|
.swe_sol_eclipse_when_loc(tjd_start, ifl, lon, lat, height, backward) ⇒ Object
1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 |
# File 'ext/swisseph/swisseph.c', line 1465
static VALUE t_swe_sol_eclipse_when_loc(VALUE self, VALUE tjd_start, VALUE ifl, VALUE lon, VALUE lat, VALUE height, VALUE backward)
{
char serr[AS_MAXCH];
double geopos[3];
geopos[0] = NUM2DBL(lon);
geopos[1] = NUM2DBL(lat);
geopos[2] = NUM2DBL(height);
double tret[10];
double attr[20];
int32 result = swe_sol_eclipse_when_loc(NUM2DBL(tjd_start), NUM2INT(ifl), geopos, tret, attr, NUM2INT(backward), serr);
if (result < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
rb_ary_push(output, INT2NUM(result)); // eclipse type flags
VALUE _tret = rb_ary_new();
for (int i = 0; i < 10; i++)
rb_ary_push(_tret, rb_float_new(tret[i]));
rb_ary_push(output, _tret);
VALUE _attr = rb_ary_new();
for (int i = 0; i < 20; i++)
rb_ary_push(_attr, rb_float_new(attr[i]));
rb_ary_push(output, _attr);
return output;
}
|
.swe_sol_eclipse_where(tjd, ifl) ⇒ Object
1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 |
# File 'ext/swisseph/swisseph.c', line 1536
static VALUE t_swe_sol_eclipse_where(VALUE self, VALUE tjd, VALUE ifl)
{
char serr[AS_MAXCH];
double geopos[10];
double attr[20];
int32 result = swe_sol_eclipse_where(NUM2DBL(tjd), NUM2INT(ifl), geopos, attr, serr);
if (result < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
rb_ary_push(output, INT2NUM(result)); // eclipse type flags
VALUE _geopos = rb_ary_new();
rb_ary_push(_geopos, rb_float_new(geopos[0])); // longitude
rb_ary_push(_geopos, rb_float_new(geopos[1])); // latitude
rb_ary_push(output, _geopos);
VALUE _attr = rb_ary_new();
for (int i = 0; i < 20; i++)
rb_ary_push(_attr, rb_float_new(attr[i]));
rb_ary_push(output, _attr);
return output;
}
|
.swe_solcross(x2cross, tjd_et, iflag) ⇒ Object
976 977 978 979 980 981 982 983 984 985 986 |
# File 'ext/swisseph/swisseph.c', line 976
static VALUE t_swe_solcross(VALUE self, VALUE x2cross, VALUE tjd_et, VALUE iflag)
{
char serr[AS_MAXCH];
serr[0] = '\0';
double tjd = NUM2DBL(tjd_et);
double retval = swe_solcross(NUM2DBL(x2cross), tjd, NUM2INT(iflag), serr);
if (retval < tjd)
rb_raise(rb_eRuntimeError, "%s", serr);
return rb_float_new(retval);
}
|
.swe_solcross_ut(x2cross, tjd_ut, iflag) ⇒ Object
905 906 907 908 909 910 911 912 913 914 915 |
# File 'ext/swisseph/swisseph.c', line 905
static VALUE t_swe_solcross_ut(VALUE self, VALUE x2cross, VALUE tjd_ut, VALUE iflag)
{
char serr[AS_MAXCH];
serr[0] = '\0';
double tjd = NUM2DBL(tjd_ut);
double retval = swe_solcross_ut(NUM2DBL(x2cross), tjd, NUM2INT(iflag), serr);
if (retval < tjd)
rb_raise(rb_eRuntimeError, "%s", serr);
return rb_float_new(retval);
}
|
.swe_split_deg(ddeg, roundflag) ⇒ Object
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
# File 'ext/swisseph/swisseph.c', line 321
static VALUE t_swe_split_deg(VALUE self, VALUE ddeg, VALUE roundflag)
{
int32 ideg, imin, isec, isgn;
double dsecfr;
swe_split_deg(NUM2DBL(ddeg), NUM2INT(roundflag), &ideg, &imin, &isec, &dsecfr, &isgn);
VALUE output = rb_ary_new();
rb_ary_push(output, INT2NUM(ideg));
rb_ary_push(output, INT2NUM(imin));
rb_ary_push(output, INT2NUM(isec));
rb_ary_push(output, rb_float_new(dsecfr));
rb_ary_push(output, INT2NUM(isgn));
return output;
}
|
.swe_time_equ(tjd) ⇒ Object
779 780 781 782 783 784 785 786 787 788 |
# File 'ext/swisseph/swisseph.c', line 779
static VALUE t_swe_time_equ(VALUE self, VALUE tjd)
{
double te;
char serr[AS_MAXCH];
if (swe_time_equ(NUM2DBL(tjd), &te, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
return rb_float_new(te);
}
|
.swe_topo_arcus_visionis(*args) ⇒ Object
1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 |
# File 'ext/swisseph/swisseph.c', line 1780
static VALUE t_swe_topo_arcus_visionis(int argc, VALUE *argv, VALUE self)
{
if (argc != 13)
rb_raise(rb_eArgError, "wrong number of arguments (13 required: tjdut, helflag, mag, azi_obj, alt_obj, azi_sun, azi_moon, alt_moon, lon, lat, height, datm_array, dobs_array)");
char serr[AS_MAXCH];
double dgeo[3];
dgeo[0] = NUM2DBL(argv[8]); // lon
dgeo[1] = NUM2DBL(argv[9]); // lat
dgeo[2] = NUM2DBL(argv[10]); // height
VALUE datm_arr = argv[11];
if (TYPE(datm_arr) != T_ARRAY || RARRAY_LEN(datm_arr) < 4)
rb_raise(rb_eArgError, "datm must be array of 4 values [pressure, temp, humidity, extinction_coeff]");
double datm[4];
for (int i = 0; i < 4; i++)
datm[i] = NUM2DBL(rb_ary_entry(datm_arr, i));
VALUE dobs_arr = argv[12];
if (TYPE(dobs_arr) != T_ARRAY || RARRAY_LEN(dobs_arr) < 6)
rb_raise(rb_eArgError, "dobs must be array of 6 values [age, snellen_left, snellen_right, telescope_mag, telescope_diam, binoc_factor]");
double dobs[6];
for (int i = 0; i < 6; i++)
dobs[i] = NUM2DBL(rb_ary_entry(dobs_arr, i));
double dret[20];
if (swe_topo_arcus_visionis(NUM2DBL(argv[0]), dgeo, datm, dobs, NUM2INT(argv[1]),
NUM2DBL(argv[2]), NUM2DBL(argv[3]), NUM2DBL(argv[4]), NUM2DBL(argv[5]), NUM2DBL(argv[6]), NUM2DBL(argv[7]), dret, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
rb_ary_push(output, rb_float_new(dret[0]));
return output;
}
|
.swe_utc_to_jd(*args) ⇒ Object
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'ext/swisseph/swisseph.c', line 160
static VALUE t_swe_utc_to_jd(int argc, VALUE *argv, VALUE self)
{
if (argc < 6 || argc > 7)
rb_raise(rb_eArgError, "wrong number of arguments (6 or 7)");
int32 gregflag = (argc == 7) ? NUM2INT(argv[6]) : SE_GREG_CAL;
double dret[2];
char serr[AS_MAXCH];
int32 result = swe_utc_to_jd(
NUM2INT(argv[0]), NUM2INT(argv[1]), NUM2INT(argv[2]),
NUM2INT(argv[3]), NUM2INT(argv[4]), NUM2DBL(argv[5]),
gregflag, dret, serr);
if (result < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
rb_ary_push(output, rb_float_new(dret[0])); // JD ET
rb_ary_push(output, rb_float_new(dret[1])); // JD UT
return output;
}
|
.swe_version ⇒ Object
66 67 68 69 70 71 |
# File 'ext/swisseph/swisseph.c', line 66
static VALUE t_swe_version(VALUE self)
{
char version[AS_MAXCH];
swe_version(version);
return rb_str_new_cstr(version);
}
|
.swe_vis_limit_mag(*args) ⇒ Object
1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 |
# File 'ext/swisseph/swisseph.c', line 1357
static VALUE t_swe_vis_limit_mag(int argc, VALUE *argv, VALUE self)
{
if (argc != 8)
rb_raise(rb_eArgError, "wrong number of arguments (8 required: tjd_ut, object_name, helflag, lon, lat, height, datm_array, dobs_array)");
char serr[AS_MAXCH];
double geopos[3];
geopos[0] = NUM2DBL(argv[3]); // lon
geopos[1] = NUM2DBL(argv[4]); // lat
geopos[2] = NUM2DBL(argv[5]); // height
// datm: atmospheric data array (4 doubles)
VALUE datm_arr = argv[6];
if (TYPE(datm_arr) != T_ARRAY || RARRAY_LEN(datm_arr) < 4)
rb_raise(rb_eArgError, "datm must be array of 4 values [pressure, temp, humidity, extinction_coeff]");
double datm[4];
for (int i = 0; i < 4; i++)
datm[i] = NUM2DBL(rb_ary_entry(datm_arr, i));
// dobs: observer data array (6 doubles)
VALUE dobs_arr = argv[7];
if (TYPE(dobs_arr) != T_ARRAY || RARRAY_LEN(dobs_arr) < 6)
rb_raise(rb_eArgError, "dobs must be array of 6 values [age, snellen_left, snellen_right, telescope_mag, telescope_diam, binoc_factor]");
double dobs[6];
for (int i = 0; i < 6; i++)
dobs[i] = NUM2DBL(rb_ary_entry(dobs_arr, i));
double dret[50];
char *object_name = StringValuePtr(argv[1]);
if (swe_vis_limit_mag(NUM2DBL(argv[0]), geopos, datm, dobs, object_name, NUM2INT(argv[2]), dret, serr) < 0)
rb_raise(rb_eRuntimeError, "%s", serr);
VALUE output = rb_ary_new();
for (int i = 0; i < 8; i++)
rb_ary_push(output, rb_float_new(dret[i]));
return output;
}
|