Swiss Ephemeris
repository·master·Indexed 20 days ago
https://github.com/aloistr/swissephA 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.
What's inside swisseph
- The documentation hosted in this GitHub repository is currently in an experimental stage and is undergoing a transition from MS-Word to Markdown format. For the most authoritative and complete documentation, use the official Swiss Ephemeris documentation hosted at https://www.astro.com/ftp/swisseph/doc/
How to organize Ephemeris files for Swiss Ephemeris
masterSwiss 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/).
- Windows:
2. File Placement Rules
- Planetary Files: Files like
sepl*.se1,sem*.se1, andseas*.se1must be placed directly within one of the directories listed in yourephepath. - Asteroid Files: Asteroid files must be placed in subdirectories named
astN, whereNis the asteroid number divided by 1000 (e.g., asteroid 1234 goes inast1, asteroid 5000 goes inast5).
3. Asteroid File Naming
- Short files: Named with an
ssuffix (e.g.,se1001s.se1) and cover 600 years (1500 CE to 2100 CE). - Long files: Named without the
ssuffix (e.g.,se1001.se1) and cover 6000 years (3000 BCE to 3000 CE). - You can merge both short and long files into the same
astNdirectory.
- Programmatically: Call the function
Use Swiss Ephemeris with PHP
masterThe
php-swephextension is available on GitHub. A compiled 64-bit binaryswephp.sois provided in theswephpsubdirectory. It was compiled on Redhat Enterprise Linux 7 and is compatible with most 64-bit Linux systems.Dependencies:
libm.so.6libc.so.6
https://github.com/cyjoelchen/php-swephDownload and prepare JPL Ephemeris files
masterSwiss 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 tode441.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.
Download Swiss Ephemeris planetary and asteroid files
masterYou can obtain the compressed planetary and asteroid ephemeris files from the following locations:
1. GitHub Repository
Located in the
ephefolder of the public repository:https://github.com/aloistr/swisseph/tree/master/ephe2. Dropbox
Located in the
ephefolder:https://www.dropbox.com/scl/fo/y3naz62gy6f6qfrhquu7u/h?rlkey=ejltdhb262zglm7eo6yfj2940&dl=03. Scryr.io (Web Space)
Provided by Phillip McCabe:
https://ephe.scryr.io/epheUse Swiss Ephemeris with Java/Android via JNI
masterA JNI (Java) interface for Swiss Ephemeris is available via Yuriy Krymlov. This includes compiled libraries specifically for Android.
https://github.com/krymlov/swe-jni-libBuild Swiss Ephemeris DLLs using Visual Studio 2017
masterTo build the DLLs using Visual Studio 2017, follow these steps:
- Unpack
sweph.zipinto thesrcdirectory. - Unpack
projectPF_VS2017.zip. - Navigate to the
projectPFdirectory. - Open the global solution
sweph.slnto access the variousvcxprojfiles required to build the DLLs.
- Unpack
Download and use Swiss Ephemeris for Windows
masterTo use Swiss Ephemeris on Windows, download the
sweph.zippackage from thewindowsdirectory 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/windowsUse Swiss Ephemeris with Delphi (Pascal)
masterAn interface for Delphi (Pascal code) to call Swiss Ephemeris functions is available in theswissdelphi_2.07.01.zipcontribution by Pierre Fontaine.Use Swiss Ephemeris with Python via pysweph
masterFor Python development, use the
pyswephfork maintained by Sailorfe. This is an up-to-date fork of the originaloPyswissephlibrary.https://github.com/sailorfe/pyswephRun Swiss Ephemeris test cases using git and make
masterTo 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
masterbranch and then comparing them against thedevelbranch.- Generate expectations from the stable release:
- Checkout the
masterbranch. - Run
make text.exp. This builds thesetest/setestexecutable (statically linked with SE) and creates the expectation values file atsetest/t.exp.
- Checkout the
- Run tests against development code:
- Checkout the
develbranch (which contains corrections or additions). - Run
make testto execute the test suite and compare results against the expectations.
- Checkout the
Note: The
masterbranch represents the released SE branch, while thedevelbranch 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- Generate expectations from the stable release:
Use Swiss Ephemeris with Excel VBA and Visual Basic (32-bit)
masterThe
Sweph32_For_Excel_VBA_and_VB.zippackage 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.