### Clone and Install libephemeris (Development) Source: https://github.com/g-battaglia/libephemeris/blob/main/README.md Steps to clone the libephemeris repository and install it with development dependencies. This setup is for contributing to the project or running its tests. ```bash git clone https://github.com/g-battaglia/libephemeris.git cd libephemeris && uv pip install -e ".[dev]" ``` -------------------------------- ### Install REBOUND and ASSIST for LibEphemeris Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/methodology/rebound-integration.md Installs the REBOUND and ASSIST libraries, which are optional dependencies for LibEphemeris to enable high-precision orbit propagation. It shows installation via pip with and without extras. ```bash pip install rebound assist ``` ```bash pip install libephemeris[precision] ``` -------------------------------- ### Install PyERFA dependencies Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/methodology/pyerfa-integration.md Commands to install the PyERFA library either directly or as an optional dependency of LibEphemeris. ```bash pip install pyerfa ``` ```bash pip install libephemeris[precision] ``` -------------------------------- ### Install libephemeris Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/guides/getting-started.md Installs the libephemeris library using pip. This is the primary step to begin using the library's functionalities. ```bash pip install libephemeris ``` -------------------------------- ### Install Test Dependencies Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/development/testing.md Commands to install optional dependencies required for running the full LibEphemeris test suite, including the C-based Swiss Ephemeris library and network utilities. ```bash pip install pyswisseph pip install requests ``` -------------------------------- ### Install Optional Extras for libephemeris Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/guides/getting-started.md Installs optional extras for libephemeris, such as n-body integration with REBOUND/ASSIST, star catalog building with astropy, or all available extras. ```bash pip install libephemeris[nbody] # REBOUND/ASSIST n-body integration for TNOs ``` ```bash pip install libephemeris[stars] # Star catalog building (astropy) ``` ```bash pip install libephemeris[all] # Everything ``` -------------------------------- ### Install and Configure LibEphemeris Source: https://github.com/g-battaglia/libephemeris/blob/main/README.md Commands to install the library via pip and download the necessary medium-sized ephemeris files for offline use. ```bash pip install libephemeris libephemeris download:medium ``` -------------------------------- ### Install spiceypy Dependency Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/methodology/planet-centers-spk.md Instructions for installing the 'spiceypy' Python package, which is required for handling SPICE kernels. This can be done using pip or uv. ```bash pip install "spiceypy>=6.0.0" # or uv pip install "spiceypy>=6.0.0" ``` -------------------------------- ### Best Practices for Maximum Precision (Modern Dates) Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/guides/precision-tuning.md Provides a Python code example demonstrating the recommended setup for achieving maximum precision in modern astronomical calculations. This includes enabling IERS Delta T, downloading necessary data, and configuring automatic SPK downloads for minor bodies. ```python import libephemeris as eph from libephemeris.iers_data import download_delta_t_data, set_iers_auto_download # 1. Enable IERS Delta T for recent dates set_iers_auto_download(True) download_delta_t_data() eph.set_iers_delta_t_enabled(True) # 2. Use SPK kernels for minor bodies eph.set_auto_spk_download(True) eph.set_spk_cache_dir("./spk_cache") eph.set_spk_date_padding(365) # 3. Use default DE440 ephemeris (already default) # eph.set_ephemeris_file("de440.bsp") ``` -------------------------------- ### Install LibEphemeris and Ephemeris Data Source: https://context7.com/g-battaglia/libephemeris/llms.txt Commands to install the library via pip and download necessary ephemeris files for offline or high-speed calculations. ```bash pip install libephemeris pip install libephemeris[nbody] pip install libephemeris[stars] pip install libephemeris[all] libephemeris download:medium libephemeris download:base libephemeris download:extended libephemeris download:leb:medium ``` -------------------------------- ### Install and Maintain Development Environment Source: https://github.com/g-battaglia/libephemeris/blob/main/CLAUDE.md Commands to set up the development environment using uv and run quality assurance tasks like linting, formatting, and type checking. ```bash uv pip install -e ".[dev]" poe lint poe format poe typecheck ``` -------------------------------- ### GET /lun_eclipse_when Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/manual/en/09-eclipses.md Finds the next lunar eclipse event starting from a given Julian Day. ```APIDOC ## GET /lun_eclipse_when ### Description Finds the next lunar eclipse occurrence after the specified Julian Day. ### Method GET ### Endpoint ephem.lun_eclipse_when(jd) ### Parameters #### Path Parameters - **jd** (float) - Required - The Julian Day to start searching from. ### Response #### Success Response (200) - **ecl_type** (int) - Bitmask representing the eclipse type (Total, Partial, Penumbral). - **tret** (tuple) - A tuple containing 8 timestamps for different phases of the eclipse (max, partial start/end, total start/end, penumbral start/end). ### Response Example { "ecl_type": 4, "tret": [2460400.5, 0, 0, 0, 0, 2460399.0, 2460402.0] } ``` -------------------------------- ### Get ASSIST Version Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/methodology/rebound-integration.md Fetches the version string for the ASSIST small-body ephemeris extension. This information is useful for verifying the installed ASSIST version. ```python from libephemeris.rebound_integration import get_assist_version version = get_assist_version() print(f"ASSIST version: {version}") ``` -------------------------------- ### Initialize ReboundIntegrator with ASSIST Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/methodology/rebound-integration.md Demonstrates how to initialize the main ReboundIntegrator class from LibEphemeris, configuring it with ASSIST ephemeris settings. This is the starting point for N-body simulations using REBOUND and ASSIST. ```python from libephemeris.rebound_integration import ReboundIntegrator, AssistEphemConfig # Create integrator with ASSIST configuration integrator = ReboundIntegrator(AssistEphemConfig()) ``` -------------------------------- ### Get REBOUND Version Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/methodology/rebound-integration.md Retrieves the installed version string of the REBOUND N-body integrator. Knowing the version can be important for compatibility checks and debugging. ```python from libephemeris.rebound_integration import get_rebound_version version = get_rebound_version() print(f"REBOUND version: {version}") ``` -------------------------------- ### Comparing Ayanamsha Systems Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/manual/en/11-sidereal-zodiac.md This example demonstrates how to calculate and compare the ayanamsha values for several popular systems on a given date using the libephemeris library. ```APIDOC ## Comparing Ayanamsha Systems ### Description This example demonstrates how to calculate and compare the ayanamsha values for several popular systems on a given date using the libephemeris library. ### Method GET (conceptual, as this is a calculation example) ### Endpoint N/A (This is a code example for library usage) ### Parameters None ### Request Example ```python import libephemeris as ephem jd = ephem.julday(2024, 4, 8, 12.0) systems = [ (ephem.SE_SIDM_LAHIRI, "Lahiri"), (ephem.SE_SIDM_FAGAN_BRADLEY, "Fagan-Bradley"), (ephem.SE_SIDM_RAMAN, "Raman"), (ephem.SE_SIDM_KRISHNAMURTI, "Krishnamurti"), (ephem.SE_SIDM_TRUE_CITRA, "True Citra"), (ephem.SE_SIDM_TRUE_REVATI, "True Revati"), (ephem.SE_SIDM_GALCENT_0SAG, "Galactic 0 Sag"), ] print(f"Ayanamsha on {8}/04/2024:\n") for mode, name in systems: ephem.set_sid_mode(mode) ayan = ephem.get_ayanamsa_ut(jd) print(f" {name:20s} {ayan:.4f}°") # The name of a system name = ephem.get_ayanamsa_name(ephem.SE_SIDM_LAHIRI) print(f"\nName: {name}") ``` ### Response #### Success Response (200) Output showing the calculated ayanamsha for each system. #### Response Example ```default Ayanamsha on 8/04/2024: Lahiri 24.1961° Fagan-Bradley 25.0793° Raman 22.7498° Krishnamurti 24.0993° True Citra 24.1843° True Revati 20.3779° Galactic 0 Sag 27.1850° Name: Lahiri ``` ``` -------------------------------- ### Get Observed Delta T Data Range (Python) Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/api_reference.md Retrieves the date range (start and end Julian Days) for which observed Delta T data is available. ```python def get_observed_delta_t_data_range(): """Get the date range for available observed Delta T data. * **Returns:** Tuple of (start_jd, end_jd) Julian Days * **Return type:** [tuple](https://docs.python.org/3/library/stdtypes.html#tuple)[[float](https://docs.python.org/3/library/functions.html#float), [float](https://docs.python.org/3/library/functions.html#float)] """ pass ``` -------------------------------- ### Manual SPK Kernel Registration in Python Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/guides/precision-tuning.md Demonstrates how to download a specific SPK kernel file for a minor body and register it with the library to enable high-precision calculations. ```python import libephemeris as eph spk_path = eph.download_spk( body="Chiron", start="2000-01-01", end="2100-01-01", directory="./spk_kernels" ) eph.register_spk_body( ipl=eph.SE_CHIRON, spk_path=spk_path, naif_id=eph.NAIF_CHIRON ) pos, _ = eph.calc_ut(2451545.0, eph.SE_CHIRON, eph.SEFLG_SPEED) print(f"Chiron (SPK): {pos[0]:.6f}°") ``` -------------------------------- ### Get IERS Data Date Range (Python) Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/api_reference.md Determines the date range (start and end Julian Days) covered by the currently loaded IERS data. ```python def get_iers_data_range(): """Get the date range covered by loaded IERS data. * **Returns:** Tuple of (start_jd, end_jd) Julian Days * **Return type:** [tuple](https://docs.python.org/3/library/stdtypes.html#tuple)[[float](https://docs.python.org/3/library/functions.html#float), [float](https://docs.python.org/3/library/functions.html#float)] """ pass ``` -------------------------------- ### Get Solar Eclipse Contact Times Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/manual/en/09-eclipses.md Retrieves and prints the start and end times for solar eclipses based on provided Julian dates. It uses the ephem.revjul function to convert Julian dates into human-readable date and time formats. ```python if tret[1] > 0: y1, m1, d1, h1 = ephem.revjul(tret[1]) print(f"Start (1st contact): {d1}/{m1}/{y1} {int(h1):02d}:{int((h1%1)*60):02d} UT") if tret[4] > 0: y4, m4, d4, h4 = ephem.revjul(tret[4]) print(f"End (4th contact): {d4}/{m4}/{y4} {int(h4):02d}:{int((h4%1)*60):02d} UT") ``` -------------------------------- ### Initialize Ephemeris Data (CLI) Source: https://github.com/g-battaglia/libephemeris/blob/main/CHANGELOG.md Provides CLI commands for initializing ephemeris data. `libephemeris init` performs a full initialization, downloading necessary SPK kernels and ephemeris files. `libephemeris init-fast` offers a quicker initialization for the modern era. Includes options for custom cache directories and progress indicators. ```Shell # libephemeris init command for full initialization # libephemeris init-fast command for modern-era initialization # --cache-dir CLI option for custom SPK cache directory ``` -------------------------------- ### Configure Data Directory via Environment Variables Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/manual/en/14-precision-performance.md Demonstrates how to set the data storage directory using shell environment variables and verify the path within Python. ```bash export LIBEPHEMERIS_DATA_DIR=/data/ephemerides ``` ```python import libephemeris as ephem print(f"Data directory: {ephem.get_library_path()}") ``` -------------------------------- ### Get Current Ephemeris Data and Close Files Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/guides/precision-tuning.md Retrieves information about the currently loaded ephemeris file, including its path, start and end Julian Dates, and the ephemeris number. It also demonstrates how to close ephemeris files, which is optional but recommended for long-running applications. ```python import libephemeris as eph path, start, end, denum = eph.get_current_file_data() print(f"Using DE{denum}: JD {start:.1f} to {end:.1f}") eph.close() ``` -------------------------------- ### CompareHelper Calculation Modes Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/leb/testing.md Demonstrates how the CompareHelper class executes calculations using both Skyfield (reference) and LEB (precomputed) modes to verify accuracy. ```python # Skyfield mode (reference): direct calculation from NASA ephemerides ref, _ = compare.skyfield(ephem.swe_calc_ut, jd, body_id, SEFLG_SPEED) # LEB mode: calculation via precomputed Chebyshev polynomials leb, _ = compare.leb(ephem.swe_calc_ut, jd, body_id, SEFLG_SPEED) ``` -------------------------------- ### Configure Session-wide SPK and Sidereal Settings Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/development/testing.md A comprehensive conftest.py setup that enables auto-downloading of SPK kernels and resets sidereal modes for consistent test results. ```python import pytest import libephemeris as eph from libephemeris.constants import ( SE_CHIRON, SE_CERES, SE_PALLAS, SE_JUNO, SE_VESTA, SE_SIDM_FAGAN_BRADLEY, ) @pytest.fixture(scope="session", autouse=True) def setup_libephemeris(): """ Session-scoped setup for libephemeris. Downloads SPK kernels once at session start for consistent, high-precision asteroid calculations across all tests. """ eph.set_auto_spk_download(True) eph.set_strict_precision(False) for body in [SE_CHIRON, SE_CERES, SE_PALLAS, SE_JUNO, SE_VESTA]: eph.ensure_major_asteroid_spk(body) yield @pytest.fixture(autouse=True) def reset_sidereal_mode(): """Reset sidereal mode between tests.""" eph.swe_set_sid_mode(SE_SIDM_FAGAN_BRADLEY) yield eph.swe_set_sid_mode(SE_SIDM_FAGAN_BRADLEY) ``` -------------------------------- ### Enable LEB Fast Mode for Performance Source: https://context7.com/g-battaglia/libephemeris/llms.txt Shows how to enable LibEphemeris Binary (LEB) files to accelerate planetary calculations by approximately 14x. Includes benchmarking against standard Skyfield calculations. ```python import libephemeris as swe from libephemeris import set_leb_file, set_calc_mode from libephemeris.constants import SE_MARS, SEFLG_SPEED import time jd = swe.julday(2024, 4, 8, 14.5) set_calc_mode("auto") def benchmark(iterations=1000): start = time.time() for _ in range(iterations): pos, _ = swe.calc_ut(jd, SE_MARS, SEFLG_SPEED) return (time.time() - start) / iterations * 1000 set_calc_mode("skyfield") skyfield_time = benchmark() print(f"Skyfield: {skyfield_time:.3f} ms/call") try: set_calc_mode("leb") leb_time = benchmark() print(f"LEB: {leb_time:.3f} ms/call") except RuntimeError: print("LEB file not available") ``` -------------------------------- ### Example Configuration for Vectors Source: https://github.com/g-battaglia/libephemeris/blob/main/proposals/horizons-live-backend.md An example of how to configure the JPL Horizons API request to retrieve Cartesian state vectors for Mars. ```APIDOC ## GET https://ssd.jpl.nasa.gov/api/horizons.api?format=json&COMMAND='499'&EPHEM_TYPE='VECTORS'&CENTER='500@399'&TLIST='2451545.0'&TLIST_TYPE='JD'&VEC_TABLE='2'&OUT_UNITS='AU-D'&VEC_CORR='NONE'&CSV_FORMAT='YES'&REF_SYSTEM='ICRF'&TIME_TYPE='UT' ### Description This example demonstrates a typical request to the JPL Horizons API to obtain state vectors (position and velocity) for Mars (COMMAND='499') from a geocentric perspective (CENTER='500@399') at a specific Julian Date (TLIST='2451545.0'). The output is requested in JSON format with units of Astronomical Units (AU) and days. ### Method GET ### Endpoint https://ssd.jpl.nasa.gov/api/horizons.api ### Query Parameters - **format** (string) - `json` - Specifies JSON output. - **COMMAND** (string) - `'499'` - Mars (planet center). - **EPHEM_TYPE** (string) - `'VECTORS'` - Request Cartesian state vectors. - **CENTER** (string) - `'500@399'` - Geocentric observation point. - **TLIST** (string) - `'2451545.0'` - Single Julian Date for the observation. - **TLIST_TYPE** (string) - `'JD'` - Time list type is Julian Date. - **VEC_TABLE** (string) - `'2'` - Vector table includes x, y, z, vx, vy, vz. - **OUT_UNITS** (string) - `'AU-D'` - Output units are Astronomical Units and days. - **VEC_CORR** (string) - `'NONE'` - No vector corrections applied (geometric). - **CSV_FORMAT** (string) - `'YES'` - Output in CSV format (within the JSON result). - **REF_SYSTEM** (string) - `'ICRF'` - International Celestial Reference Frame. - **TIME_TYPE** (string) - `'UT'` - Time type is Universal Time. ``` -------------------------------- ### Fast Astronomical Calculation Entry Points (Python) Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/leb/guide.md Provides entry points for fast astronomical calculations in UT and TT. These functions handle unsupported flags, snapshot sidereal states, convert UT to TT using a high-precision model (avoiding potential errors from linear interpolation), and delegate core calculations to `_fast_calc_core()`. ```python def fast_calc_ut(reader, tjd_ut, ipl, iflag, *, sid_mode=None, sid_t0=None, sid_ayan_t0=None) -> ((lon, lat, dist, dlon, dlat, ddist), iflag): # ... implementation details ... pass def fast_calc_tt(reader, tjd_tt, ipl, iflag, *, sid_mode=None, sid_t0=None, sid_ayan_t0=None) -> ((lon, lat, dist, dlon, dlat, ddist), iflag): # ... implementation details ... pass ``` -------------------------------- ### Install astroquery for Automatic SPK Download Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/guides/precision-tuning.md Installs the 'astroquery' package, which is a dependency for LibEphemeris to automatically download SPK kernels on demand. ```bash pip install astroquery ``` -------------------------------- ### User-Defined Ayanamsha Setup (Python) Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/reference/ayanamsha.md Demonstrates how to set a user-defined ayanamsha mode in libephemeris, mimicking the Lahiri ayanamsha by specifying a reference epoch (t0) and the ayanamsha value at that epoch (ayan_t0). This allows for custom sidereal calculations. ```python import libephemeris as leph from libephemeris.constants import SE_SIDM_USER # Lahiri parameters: ayan_t0 = 23.857092 at J2000 leph.swe_set_sid_mode(SE_SIDM_USER, t0=2451545.0, ayan_t0=23.857092) ``` -------------------------------- ### Initialize Planetary and Star Data for Conjunction Checks Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/manual/en/08-fixed-stars.md Sets up the necessary data structures to check for conjunctions between planets and fixed stars by defining a list of stars and planetary constants. ```python import libephemeris as ephem jd = ephem.julday(2024, 4, 8, 12.0) stelle_da_cercare = ["Aldebaran", "Regulus", "Antares", "Fomalhaut", "Sirius", "Spica", "Algol", "Vega"] pianeti = [(ephem.SE_SUN, "Sun"), (ephem.SE_MOON, "Moon"), (ephem.SE_MERCURY, "Mercury"), (ephem.SE_VENUS, "Venus"), (ephem.SE_MARS, "Mars"), (ephem.SE_JUPITER, "Jupiter"), (ephem.SE_SATURN, "Saturn")] ``` -------------------------------- ### Generate and Merge LEB Files with CLI Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/leb/guide.md Demonstrates the command-line usage for generating individual ephemeris groups (planets, asteroids, analytical) and then merging them into a single, complete LEB file. Includes options for verification and a shortcut for the full workflow. ```bash python scripts/generate_leb.py --tier base --group planets python scripts/generate_leb.py --tier base --group asteroids python scripts/generate_leb.py --tier base --group analytical python scripts/generate_leb.py --tier base --merge \ data/leb/ephemeris_base_planets.leb \ data/leb/ephemeris_base_asteroids.leb \ data/leb/ephemeris_base_analytical.leb \ --verify # Or all at once via poe poe leb:generate:base:groups ``` ```bash # Regenerating a Single Group python scripts/generate_leb.py --tier base --group asteroids python scripts/generate_leb.py --tier base --merge \ data/leb/ephemeris_base_planets.leb \ data/leb/ephemeris_base_asteroids.leb \ data/leb/ephemeris_base_analytical.leb \ --verify ``` -------------------------------- ### GET /spk/bodies Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/api_reference.md Lists all bodies currently registered with SPK kernels. ```APIDOC ## GET /spk/bodies ### Description Retrieves a list of all body IDs that have active SPK kernel registrations. ### Method GET ### Endpoint /spk/bodies ### Response #### Success Response (200) - **bodies** (list[int]) - List of registered body IDs ``` -------------------------------- ### GET /swe_calc_ut Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/api_reference.md Calculates the planetary position for a specific Universal Time. ```APIDOC ## GET /swe_calc_ut ### Description Calculate planetary position for Universal Time. ### Method GET ### Endpoint /swe_calc_ut ### Parameters #### Query Parameters - **tjd_ut** (float) - Required - Julian Day in Universal Time (UT1) - **ipl** (int) - Required - Planet/body ID - **iflag** (int) - Required - Calculation flags ### Response #### Success Response (200) - **position** (tuple) - Array containing [longitude, latitude, distance, speed_lon, speed_lat, speed_dist] - **return_flag** (int) - Calculation status flag ``` -------------------------------- ### LEB2 Compression Pipeline Overview Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/leb/guide.md This snippet outlines the steps involved in the LEB2 compression pipeline. It details the stages from raw float64 coefficients to the final compressed blob, including mantissa truncation, coefficient reordering, byte shuffling, and zstd compression. This process reduces file sizes significantly while maintaining precision. ```text Raw float64 coefficients ↓ [1] Mantissa truncation — zero unneeded mantissa bits per coefficient order ↓ (high-order coefficients need very few bits) [2] Coefficient-major — reorder (segments, coeffs) → (coeffs, segments) reorder so same-order coefficients are contiguous ↓ [3] Byte shuffle — transpose byte lanes (HDF5/Blosc-style) ↓ [4] zstd level 19 — the regularized data compresses well ↓ Compressed blob ``` -------------------------------- ### GET /calc_interpolated_perigee Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/manual/en/06-moon.md Calculates the smoothed, interpolated perigee of the lunar orbit. ```APIDOC ## GET /calc_interpolated_perigee ### Description Calculates the interpolated perigee for precision lunar distance and position calculations. ### Method GET ### Endpoint ephem.calc_interpolated_perigee(jd_tt) ### Parameters #### Path Parameters - **jd_tt** (float) - Required - Julian Date in Terrestrial Time ### Response #### Success Response (200) - **lon** (float) - Longitude of perigee - **lat** (float) - Latitude of perigee - **dist** (float) - Distance in AU ``` -------------------------------- ### Initialize LibEphemeris Calculation Source: https://github.com/g-battaglia/libephemeris/blob/main/proposals/horizons-live-backend.md Demonstrates the current method of invoking ephemeris calculations using the libephemeris library, which currently triggers a local file download if dependencies are missing. ```bash pip install libephemeris python -c "import libephemeris as swe; print(swe.swe_calc_ut(2451545.0, swe.SE_MARS, swe.SEFLG_SPEED))" ``` -------------------------------- ### GET /get_orbital_elements Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/manual/en/05-planet-positions.md Returns the Keplerian orbital parameters for a celestial body. ```APIDOC ## GET /get_orbital_elements ### Description Returns the parameters of the Keplerian orbit including semi-major axis, eccentricity, and inclination. ### Method GET ### Endpoint /get_orbital_elements ### Parameters #### Query Parameters - **jd_tt** (float) - Required - Julian date in Terrestrial Time. - **body** (int) - Required - The celestial body identifier. - **flag** (int) - Required - Configuration flags. ``` -------------------------------- ### Example Log Format for Data Sources Source: https://github.com/g-battaglia/libephemeris/blob/main/CHANGELOG.md Illustrates the format of log messages generated when data source logging is enabled. This format provides details about the body, Julian date, and the source used for calculation. ```Text [libephemeris] DEBUG: body= jd= source= ``` -------------------------------- ### GET /pheno_ut Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/manual/en/05-planet-positions.md Retrieves physical appearance data for a celestial body. ```APIDOC ## GET /pheno_ut ### Description Provides information on the physical appearance of a planet including magnitude, phase, and elongation. ### Method GET ### Endpoint /pheno_ut ### Parameters #### Query Parameters - **jd** (float) - Required - The Julian date. - **body** (int) - Required - The celestial body identifier. - **flag** (int) - Required - Configuration flags. ### Response #### Success Response (200) - **magnitude** (float) - Brightness of the body. - **phase** (float) - Illuminated percentage. - **elongation** (float) - Angular distance from the Sun. ``` -------------------------------- ### LEB Fast Path Dispatch in swe_calc_ut Source: https://github.com/g-battaglia/libephemeris/blob/main/docs/leb/guide.md Illustrates how the `swe_calc_ut` function dispatches calculations. It first attempts to use the LEB fast path via `get_leb_reader()`. If that fails or is unavailable, it falls back to the full Skyfield pipeline. ```python def swe_calc_ut(tjd_ut, ipl, iflag): # ... SE_ECL_NUT handling, MOSEPH stripping ... # --- LEB fast path --- reader = get_leb_reader() if reader is not None: try: return fast_calc.fast_calc_ut(reader, tjd_ut, ipl, iflag) except (KeyError, ValueError): pass # fall through to Skyfield # --- END LEB fast path --- # Full Skyfield pipeline return _calc_body(t, ipl, iflag) ```