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: SE_L2_Northern_Halo

max_iter: 1000                  # Maximum Newton iterations for a single differential correct attempt
eps: 1.0e-6                     # Differential-correction convergence tolerance on residual norm
step: 0.01                      # Pseudo-arclength step size
max_solutions: 20               # Maximum number of orbits to generate
max_period_days: 1000.0         # Maximum full orbit period in days

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.

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["SE_L2_Northern_Halo"])
fam = Family(cfg)
fam.save()

Available preset keys (see orbit_gen.setup.presets.PRESETS): EM_L2_Northern_Halo, EM_DRO_1, EM_DRO_2, EM_L1, EM_Butterfly, EM_Unnamed_1, SE_L2_Northern_Halo, SE_L1_Vertical, SE_L2_Lyapunov, SE_L2_Small_Lyapunov, SE_L2_Large_Lyapunov, SE_L2_Southern_Halo, SE_Butterfly, SE_Dragonfly.

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.

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. Run the test suite with:

uv run pytest

Optionally if plotting capabilities are desired, run

uv sync --extra plotting

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 0.2.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 0.2.0
File Size Uploaded Provenance Actions
orbit_gen-0.2.0.tar.gz 14.8 kB With provenance Details for orbit_gen-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 32.9 kB

Release files / orbit_gen-0.2.0.tar.gz

Download URL orbit_gen-0.2.0.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
26ace23492146d39f081155f7d7ae715e6cb56669453dd3474643a60af0f7653
BLAKE2b-256 checksum
How to use checksums
6774be79ad15a732a21ba1759c76f14387d4d95068403cba63f3cc5a434b6a32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","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 Oct 14, 2026.

Transparency log

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

Download URL orbit_gen-0.2.0-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
29e7f9c16250cd9e58f7cf2011c1f1474a84a6cd770e1c99082900398bfe3fbb
BLAKE2b-256 checksum
How to use checksums
bf1ea3323925a6a498dbea565d924493d5b6df3077686b90e258cdd3ab6f7d52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","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 Oct 14, 2026.

Transparency log

Security for orbit-gen 0.2.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-0.2.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 Oct 14, 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