Skip to main content

orbit-gen

Periodic orbit family generation and continuation in the Circular Restricted Three-Body Problem (CR3BP).

Overview

orbit-gen generates families of periodic orbits in the CR3BP using single-shooting differential correction and pseudo-arclength continuation. It currently supports various families in the Earth-Moon and Sun-Earth systems.

Installation

pip install orbit-gen

Or to install with plotting dependencies

pip install "orbit-gen[plotting]"

Requires Python 3.11+.

Usage

From a config file

# orbit_config.yaml
system: SE                      # "EM" (Earth-Moon) or "SE" (Sun-Earth)
preset: L2_Northern_Halo

max_iter: 100                   # Maximum Newton iterations for a single differential correct attempt
eps: 1.0e-10                    # Convergence tolerance on the residual norm (corrector and continuation steps)
step: 0.01                      # Pseudo-arclength step size
max_solutions: 20               # Maximum number of continuation steps
max_period_days: .inf           # Maximum full orbit period in days (.inf for no limit)

output_dir: results
show_plots: false               # Optional; for user use only
verbose: true                   # Print progress messages (warnings always show)

Note: step is the distance moved along the family's tangent direction at each step. Its sign sets the initial direction: a positive value results in an initially increasing period, a negative value results in an initially decreasing period.

Note: A relative output_dir is resolved from the folder containing the config file.

Note: All continuation parameters are optional; any left out take the defaults shown above. Write numbers in exponent form with a decimal point and a signed exponent (1.0e-10, not 1e-10).

from orbit_gen import Family, RunConfig

cfg = RunConfig.from_yaml("orbit_config.yaml")
fam = Family(cfg)

fam.save()
if cfg.show_plots:
    fam.plot()

Note: Constructing Family(cfg) runs the continuation, but does not save or plot results on its own — call .save() / .plot() explicitly, as shown above.

Programmatically; without a config file

from orbit_gen import Family, RunConfig
from orbit_gen.setup.system_config import SE_SYSTEM
from orbit_gen.setup.presets import PRESETS

cfg = RunConfig(system=SE_SYSTEM, ic=PRESETS["L2_Northern_Halo"]["SE"])
fam = Family(cfg)
fam.save()

Available preset keys, and their supported systems listed in brackets (see orbit_gen.setup.presets.PRESETS): L1_Northern_Halo[SE,EM], L2_Northern_Halo[SE,EM], L2_Southern_Halo[SE,EM], DRO[SE,EM], L2_Lyapunov[SE,EM], Northern_Butterfly[SE,EM], Northern_Dragonfly[SE,EM], 3_1_Lunar_Resonant_Planar[EM], L2_Double_Loop[SE].

Supported Systems

Key System
EM Earth-Moon
SE Sun-Earth

Output

fam.save() writes a .npz file (named after the preset, in cfg.output_dir) containing initial states, periods, and mu_star for all converged orbits:

import numpy as np
data = np.load("results/SE_L2_Northern_Halo.npz")
data["states"]              # (N, 6) containing initial [x, y, z, vx, vy, vz] in canonical units for each orbit
data["periods"]             # (N,) containing full period in canonical units for each orbit
data["mu_star"]             # System mass ratio

Contributing

NOTE: Use of uv is recommended for contributing to the repository. Installation instructions can be found here.

Setup

Create a fork of the repository, clone the fork onto your local system, and run

uv sync

to install the package in editable mode plus dev dependencies (pytest, ruff, deptry). uv also installs a matching Python if needed.

Optionally if plotting capabilities are desired, run

uv sync --extra plotting

Note that plain uv sync removes the plotting extra

Tests

uv run pytest

Note that the first run downloads NAIF SPICE kernels into user cache, so it needs network access.

Checks

uv run ruff check     # Lint
uv run ruff format    # Format
uv run deptry src     # Check imports

Scripts

The repo includes a driver script, scripts/generate_family.py, which reads orbit_config.yaml from the project root, runs continuation, saves results, and shows plots if show_plots: true and the plotting optional dependencies are installed.

An example configuration file (orbit_config.example.yaml), is included in the repository, and orbit_config.yaml can be created and used by running:

cp orbit_config.example.yaml orbit_config.yaml   # edit as needed
uv run scripts/generate_family.py

A second script, scripts/animate_family.py, animates the family saved for the current orbit_config.yaml and writes a rotating GIF to animations/. It requires the plotting optional dependencies and a saved family, so scripts/generate_family.py must be run first. Settings such as frame rate and resolution can be changed at the top of the script.

uv run scripts/animate_family.py

License

MIT — see LICENSE.

Credits and Acknowledgements

Created by Jayden Ripic

The differential correction and continuation algorithms were adapted from SIOSlab/starlift, written by Grace Genszler

Metadata

Release files for orbit-gen 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for orbit-gen 1.0.0
File Size Uploaded Provenance Actions
orbit_gen-1.0.0.tar.gz 18.0 kB With provenance Details for orbit_gen-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for orbit-gen 1.0.0
File Interpreter ABI Platform Actions
orbit_gen-1.0.0-py3-none-any.whl Python 3 none any Details for orbit_gen-1.0.0-py3-none-any.whl

Total release size: 39.1 kB

Release files / orbit_gen-1.0.0.tar.gz

Download URL orbit_gen-1.0.0.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
dffb8000cb08ae3a07ab7282eefb0dd54dcf0e936d8866a033a274c3b080e476
BLAKE2b-256 checksum
How to use checksums
2d135b5c3a810a90185a004c9572bf82ccc3e96e7ef408fee95d452b05cba241
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Release files / orbit_gen-1.0.0-py3-none-any.whl

Download URL orbit_gen-1.0.0-py3-none-any.whl
Size 21.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39dad0d438255954eab7d0c8aae9bf2b02da85b002a85dd3b848eb1254b71a15
BLAKE2b-256 checksum
How to use checksums
46c937a1d0aa56fd28aaaecc589d1b3c593aed1377da52ee6a1c84c7eb885000
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Security for orbit-gen 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for orbit_gen-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page