Swiss Ephemeris

repository·master·Indexed 20 days ago

https://github.com/aloistr/swisseph

A high-precision astronomical library for calculating planets and houses. The repository includes C++ source code, instructions for building DLLs via Visual Studio 2017, and guidance on organizing ephemeris and JPL data files. It provides community-contributed wrappers and bindings for Python (pysweph), C#/.NET, Delphi, Java/Android (JNI), PHP, Perl, and Excel VBA.

Tokens
25K
Snippets
12
Records
25
Agent score
70%

What's inside swisseph

  1. How to organize Ephemeris files for Swiss Ephemeris

    master

    Swiss Ephemeris searches for data files using an internal path variable swed.ephepath. To ensure the engine finds your planetary and asteroid files, you must organize them according to these rules:

    1. Set the Ephemeris Path

    You can define where the engine looks for files in three ways:

    • Programmatically: Call the function swe_set_ephe_path() to set the path variable. You can include multiple paths separated by ; (Windows) or ; or : (Linux/Unix/macOS/Android).
    • Environment Variable: Set an environment variable to override the built-in defaults.
    • Default Paths:
      • Windows: \sweph\ephe
      • Linux/Unix/macOS: .:/users/ephe2/:/users/ephe/ (searches the current directory, /users/ephe2/, and /users/ephe/).

    2. File Placement Rules

    • Planetary Files: Files like sepl*.se1, sem*.se1, and seas*.se1 must be placed directly within one of the directories listed in your ephepath.
    • Asteroid Files: Asteroid files must be placed in subdirectories named astN, where N is the asteroid number divided by 1000 (e.g., asteroid 1234 goes in ast1, asteroid 5000 goes in ast5).

    3. Asteroid File Naming

    • Short files: Named with an s suffix (e.g., se1001s.se1) and cover 600 years (1500 CE to 2100 CE).
    • Long files: Named without the s suffix (e.g., se1001.se1) and cover 6000 years (3000 BCE to 3000 CE).
    • You can merge both short and long files into the same astN directory.
  2. Download and prepare JPL Ephemeris files

    master

    Swiss Ephemeris can use JPL Ephemeris data. If you download files directly from the JPL FTP server, you must rename them for the Swiss Ephemeris code to recognize them.

    Required Renaming Step: After downloading a file like de441/linux_m13000p17000.441, you must rename it to de441.eph.

    Available JPL Files:

    • de200.eph (41 Mb)
    • de406.eph (190 Mb)
    • de431.eph (2.6 Gb)
    • de441.eph (2.6 Gb)

    Files can be downloaded from the JPL FTP area or via Alois' Dropbox.

  3. Download Swiss Ephemeris planetary and asteroid files

    master

    You can obtain the compressed planetary and asteroid ephemeris files from the following locations:

    1. GitHub Repository

    Located in the ephe folder of the public repository: https://github.com/aloistr/swisseph/tree/master/ephe

    2. Dropbox

    Located in the ephe folder: https://www.dropbox.com/scl/fo/y3naz62gy6f6qfrhquu7u/h?rlkey=ejltdhb262zglm7eo6yfj2940&dl=0

    3. Scryr.io (Web Space)

    Provided by Phillip McCabe: https://ephe.scryr.io/ephe

  4. Build Swiss Ephemeris DLLs using Visual Studio 2017

    master

    To build the DLLs using Visual Studio 2017, follow these steps:

    1. Unpack sweph.zip into the src directory.
    2. Unpack projectPF_VS2017.zip.
    3. Navigate to the projectPF directory.
    4. Open the global solution sweph.sln to access the various vcxproj files required to build the DLLs.
  5. Download and use Swiss Ephemeris for Windows

    master

    To use Swiss Ephemeris on Windows, download the sweph.zip package from the windows directory of the repository. This package provides pre-compiled binaries and source files specifically for the Windows environment.

    Package Contents:

    • sweph/bin: Contains compiled 32-bit and 64-bit DLLs and compiled binary sample programs.
    • sweph/src: The C source code used to compile the DLLs and binaries (note: this may be an older version than the main repository).
    • sweph/src/projects: Visual Studio project files for building the binaries.
    • sweph/doc: Documentation files.
    • sweph/vb: Sample and support files for Visual Basic (use with caution as they may be outdated).
    • programs/: Compiled binary samples for the Windows command line.
    • swewin/: Compiled Windows sample programs.
    • vb/: Declaration files for Visual Basic.
    https://github.com/aloistr/swisseph/windows
  6. Run Swiss Ephemeris test cases using git and make

    master

    To verify changes in the Swiss Ephemeris source code, use the following procedure with git and make. This process involves generating expectation values from the stable master branch and then comparing them against the devel branch.

    1. Generate expectations from the stable release:
      • Checkout the master branch.
      • Run make text.exp. This builds the setest/setest executable (statically linked with SE) and creates the expectation values file at setest/t.exp.
    2. Run tests against development code:
      • Checkout the devel branch (which contains corrections or additions).
      • Run make test to execute the test suite and compare results against the expectations.

    Note: The master branch represents the released SE branch, while the devel branch is used for development and testing new features or fixes.

    # Generate expectations from master
    checkout master
    make text.exp
    
    # Run tests on devel
    checkout devel
    make test
  7. Use Swiss Ephemeris with Excel VBA and Visual Basic (32-bit)

    master

    The Sweph32_For_Excel_VBA_and_VB.zip package provides tools for 32-bit Visual Basic and Excel VBA integration. It contains:

    • modSwedll32.bas: API Declarations for Visual Basic 32-bit.
    • clsTestSwedll32.cls: Test subroutines for the API functions.
    • modTestSwedll32.bas: Module to call the test subroutines.
    • Swedll32.xls: An Excel file containing the standard/Class modules for immediate testing.