Skip to main content

Ephemeris generator, moon tracker, and planet viewer tools

Project description

rms-ephemeris-tools

GitHub release; latest by date GitHub Release Date Test Status Documentation Status Code coverage
PyPI - Version PyPI - Format PyPI - Downloads PyPI - Python Version
GitHub commits since latest release GitHub commit activity GitHub last commit
Number of GitHub open issues Number of GitHub closed issues Number of GitHub open pull requests Number of GitHub closed pull requests
GitHub License Number of GitHub stars GitHub forks DOI

Introduction

Planetary ephemeris generator, moon tracker, and planet viewer (Python port of the PDS Ring-Moon Systems Node FORTRAN tools).

Full documentation: Read the Docs.

For users

Install

Create a virtual environment and install the package into it (do not install into system Python):

python3 -m venv .venv
source .venv/bin/activate
pip install rms-ephemeris-tools

This provides the ephemeris-tools command.

To deploy the bundled web forms and sample files (e.g. for a CGI server), use the install_ephemeris_tools_files command with a target directory:

install_ephemeris_tools_files /path/to/htdocs/tools

Environment variables

Variable Purpose Default
SPICE_PATH Root directory for SPICE kernels. Must contain SPICE_planets.txt, SPICE_spacecraft.txt, and kernel files (e.g. leapseconds.ker, planet/moon SPKs). /var/www/SPICE/
TEMP_PATH Directory for temporary or output files. /var/www/work/
STARLIST_PATH Directory for star catalog files (e.g. starlist_sat.txt). /var/www/documents/tools/
JULIAN_LEAPSECS Path to a NAIF LSK leap-second file. If unset, the code looks under SPICE_PATH, then leapsecs.txt; if missing or not LSK format, rms-julian’s bundled LSK is used. (see above)
EPHEMERIS_TOOLS_LOG_LEVEL Logging level: DEBUG, INFO, WARNING, ERROR, or CRITICAL. WARNING

Ensure SPICE_PATH contains (or points to) the expected config and kernel files. Without these, ephemeris/tracker/viewer runs will fail when loading kernels.

Running the tools

ephemeris-tools <command> [options]

Ephemeris table

ephemeris-tools ephemeris --planet saturn --start "2025-01-01 00:00" --stop "2025-01-01 02:00" --interval 1 --time-unit hour -o ephem.txt

--planet accepts a name (mars, jupiter, saturn, uranus, neptune, pluto) or number 4–9. Use --observer as a shortcut to set the observer in one argument (e.g. --observer Cassini or --observer 19.82 -155.47 4205). Use -v / --verbose for INFO-level logging. All three subcommands accept --cgi to read parameters from environment variables instead of the command line (for CGI server integration). See the CLI reference for the full argument list.

Moon tracker

ephemeris-tools tracker --planet saturn --start "2025-01-01 00:00" --stop "2025-01-02 00:00" -o tracker.ps

To convert the PostScript output to PNG (requires Ghostscript):

gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -r150 -sOutputFile=tracker.png tracker.ps

Planet viewer

ephemeris-tools viewer --planet saturn --time "2025-01-01 12:00" -o view.ps

To convert the PostScript output to PNG (requires Ghostscript):

gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -r150 -sOutputFile=view.png view.ps

For developers

Installation

  1. Clone the repository:

    git clone https://github.com/SETI/rms-ephemeris-tools.git
    cd rms-ephemeris-tools
    
  2. Create and activate a virtual environment:

    python -m venv venv
    source venv/bin/activate
    
  3. Install the package in editable mode with dev extras:

    pip install -e ".[dev]"
    
  4. Set up environment variables: configure all of the variables listed in the user section (SPICE_PATH, TEMP_PATH, STARLIST_PATH, JULIAN_LEAPSECS, EPHEMERIS_TOOLS_LOG_LEVEL) as needed so ephemeris, tracker, and viewer runs (and tests that need kernels) can find config and kernel files.

Documentation

Documentation is built with Sphinx and published at Read the Docs. To build locally (dev extras include Sphinx):

cd docs && make html

Output is in docs/_build/html.

Testing

With the dev extras installed:

pytest tests/ -v

Tests that require SPICE kernels but cannot find them (e.g. missing or invalid SPICE_PATH) will be skipped. Tests that do not need kernels run without any SPICE setup.

Lint and type-check:

ruff check src tests
ruff format src tests
mypy src

Quality checks

Run linting, type checking, tests, Sphinx docs build, and Markdown lint in one command:

./scripts/run-all-checks.sh           # all checks, parallel (default)
./scripts/run-all-checks.sh -c        # code checks only (ruff, mypy, pytest)
./scripts/run-all-checks.sh -d        # docs checks only (sphinx, pymarkdown)

Parameter sweep scripts

Exercise ephemeris-tools across many parameter combinations:

./scripts/test_ephemeris_param_sweep.sh [OUTDIR]
./scripts/test_viewer_param_sweep.sh [OUTDIR]
./scripts/test_tracker_param_sweep.sh [OUTDIR]

Set EPHEMERIS_TOOLS_CMD to override the command. Viewer and tracker sweeps require Ghostscript for PS to PNG conversion. See scripts/README_param_sweep.md for details.

Server comparison

Compare live server output against stored golden copies:

python -m tests.compare_servers
python -m tests.compare_servers --replace --server staging

See tests/compare_servers/README.md for full options.

FORTRAN comparison scripts

The repository includes scripts for generating random query URLs and running FORTRAN-vs-Python comparisons.

Generate random URLs

python scripts/generate_random_query_urls.py -n 100 -o /tmp/random_urls.txt --tool viewer

Run FORTRAN comparison with predefined test files

To run the comparison using the hand-written URL lists in test_files/:

./scripts/run-fortran-comparison-test-files.sh --jobs 8

Uses test_files/ephemeris-test-urls.txt, test_files/tracker-test-urls.txt, and test_files/viewer-test-urls.txt. Output and failure directories are the same as for random comparisons (and are rotated if they already exist).

Run FORTRAN comparison manually

To compare Python output against FORTRAN for a single URL or a file of URLs:

python -m tests.compare_fortran viewer --test-file /tmp/random_urls.txt -o /tmp/compare -j 4

Use ephemeris, tracker, or viewer as the tool; pass --url <url> for a single URL or --test-file <path> for a list. With multiple URLs, use -j N for parallel runs. See the Developer's Guide for full options.

Random comparisons (ephemeris, tracker, viewer)

The script below generates random URLs for all three tools and runs the FORTRAN comparison for each (i.e. it runs both URL generation and tests.compare_fortran per tool):

./scripts/run-random-fortran-comparisons.sh 100 --jobs 8
./scripts/run-random-fortran-comparisons.sh 50 --dir /path/to/my/dir --jobs 4
  • Positional argument: number of random queries per tool.
  • Optional --jobs N is passed through to tests.compare_fortran.
  • Optional --dir DIR: top-level directory for output and query files (default: /tmp). Uses DIR/<tool>_out, DIR/<tool>_failed, and DIR/random_queries_<tool>.txt.
  • Output directories (under /tmp or --dir): ephemeris_out, tracker_out, viewer_out, and ephemeris_failed, tracker_failed, viewer_failed.
  • If a target directory already exists, it is renamed with a single timestamp suffix per run (e.g. viewer_out_20260226_185932).

Contributing

See the Contributing Guide.

Licensing

Licensed under the Apache License v2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rms_ephemeris_tools-0.0.1.tar.gz (995.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rms_ephemeris_tools-0.0.1-py3-none-any.whl (437.6 kB view details)

Uploaded Python 3

File details

Details for the file rms_ephemeris_tools-0.0.1.tar.gz.

File metadata

  • Download URL: rms_ephemeris_tools-0.0.1.tar.gz
  • Upload date:
  • Size: 995.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rms_ephemeris_tools-0.0.1.tar.gz
Algorithm Hash digest
SHA256 04f571b113d2398fda147a5862fc0ea464d56bd6ce028cd09519066c99bb3c5c
MD5 b9004ef5e4943b6112c8a708687491f7
BLAKE2b-256 dae9199628ddf7262e819647ac91231ca6d95be949f65ee330880908c440d390

See more details on using hashes here.

File details

Details for the file rms_ephemeris_tools-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for rms_ephemeris_tools-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 42e46b21eaf3aa037aa48574aeff395a004a617f79961549306cc3b5301ed8fa
MD5 49e274f84fff39df7fb12d9d0009432e
BLAKE2b-256 75b329ac9dd43065f23535ed50528af34379831f0b45e2820fbbe7a96ca155a8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page