Let's break down the calculation process when iflag = swe.[Redacted Person] | swe.FLG_TRUEPOS | swe.FLG_SPEED in Swiss Ephemeris.
This iflag combination tells Swiss Ephemeris to:
-
swe.FLG_SWIEPH: Use the Swiss Ephemeris internal ephemeris. This means it won't use JPL or [Redacted Person] ephemerides. The calculations are based on the Swiss Ephemeris's own planetary theory.
-
swe.FLG_TRUEPOS: Calculate true positions. This is crucial. It means the calculated positions will include corrections for:
- Light deflection: The bending of light due to the Sun's gravity.
- Aberration: The apparent shift in a celestial object's position due to the finite speed of light and the Earth's motion.
- Nutation: The short-term oscillations in the Earth's axis of rotation.
-
swe.FLG_SPEED: Calculate the speed of the planet.
Now, let's trace the code path and the corrections applied:
The core calculation happens in swe_calc() (sweph.c). Because of FLG_SWIEPH, sweph() (sweph.c) is called. This function handles computations using the Swiss Ephemeris's own algorithms and data.
Inside sweph():
-
Initial Planetary Calculation: The fundamental planetary positions are calculated using the Swiss Ephemeris models. At this stage, these positions are not corrected.
-
Barycentric to geocentric: If necessary, the position is converted from barycentric (center of mass of the solar system) to geocentric (Earth-centered) coordinates.
-
app_pos_etc_plan() (sweph.c): This function is called, and within it, due to FLG_TRUEPOS:
-
swi_plan_for_osc_elem() (swephlib.c) is called. No specific corrections for true positions take place here. It prepares osculating orbital elements for inner planets to be used later.
-
app_pos_rest() (sweph.c) is where the corrections for FLG_TRUEPOS occur:
- Light Deflection:
swi_deflect_light() (swephlib.c) is called to apply the correction for the bending of light.
- Aberration:
swi_aberr_light() (swephlib.c) is called to correct for aberration.
- Precession: Note that precession, while technically not part of obtaining a true position, will be applied if not specifically disabled in the iflag. This function calculates and applies precession based on selected precession model.
-
Speed Calculation: Because FLG_SPEED is set, the speed of the planet is calculated by internally calling the position function with a slightly different time and taking a numerical derivative.
In summary: The specified iflag first computes the raw planetary position using the Swiss Ephemeris's internal models. It then adds corrections for light deflection and aberration to get the true position. Finally, it calculates the speed. It will also apply precession if not explicitly disabled by using flag SEFLG_J2000 or SEFLG_B1950. Nutation is already included in the fundamental calculation of planetary positions, so it is not considered as an additional correction in the context of the app_pos_rest function within Swiss Ephemeris.