Getting Started
Lox is an MPLv2-licensed open-source astrodynamics toolbox that can be used in Rust and Python. This guide will help you get started with a new project.
Prerequisites
Section titled “Prerequisites”Lox is currently supported on the following operating systems:
- macOS (ARM/Intel)
- Linux (x64)
- Windows (x86/x64)
Lox does not have any external dependencies except a working Rust or Python environment. We recommend installing Rust via rustup and Python via uv if they are not already installed. If you already have Rust or Python installed, make sure that the installed versions meet or exceed the versions below.
- Rust 1.90+
- Python 3.9+
Required Data
Section titled “Required Data”Some functionality of Lox requires external data such as Earth orientation data or an ephemeris.
- finals.all.csv
- Earth orientation data for the IAU1980 theory of nutation.
- finals2000A.all.csv
- Earth orientation data for the IAU2000A theory of nutation.
- de440s.bsp
- Planetary ephemerides (or any other planetary SPK kernel).
Quickstart
Section titled “Quickstart”Create a new project
Section titled “Create a new project”Create a new project called learn-lox by running the following commands in your terminal.
cargo new --bin learn-loxuv init learn-loxmkdir learn-loxpython -m venv learn-lox/.venvInstall Lox
Section titled “Install Lox”Change into the newly created learn-lox directory and install the Lox library by running the
following commands.
cd learn-loxcargo add lox-spacecd learn-loxuv add lox-spacecd learn-loxsource .venv/activatepip install lox-spaceHello, Lox!
Section titled “Hello, Lox!”Open main.{py,rs} in your favourite code editor (or create it if it does not exist)
and replace its contents with the following code.
use lox_space::bodies::{Earth, PointMass};
fn main() { let mu = Earth.gravitational_parameter();
println!("Hello, Earthling!"); println!( "The gravitational parameter of your planet is {} km^3/s^2.", mu );}import lox_space as lox
def main(): mu = lox.Origin("Earth").gravitational_parameter()
print( "Hello, Earthling!\n", f"The gravitational parameter of your planet is {mu} km^3/s^2.", )
if __name__ == "__main__": main()Run the program to make sure that everything works.
cargo runuv run main.pypython main.py