Python bindings for astroz - high-performance astrodynamics library
Project description
astroz Python bindings
Python bindings for astroz, a high-performance astrodynamics library written in Zig.
Performance
Using the batch numpy API, astroz significantly outperforms other Python SGP4 libraries:
| Scenario | astroz | python-sgp4 | skyfield | vs sgp4 |
|---|---|---|---|---|
| 1 day (minute res) | 0.37 ms | 0.54 ms | 8 ms | 1.5x faster |
| 1 week (minute res) | 2.6 ms | 3.7 ms | 50 ms | 1.4x faster |
| 2 weeks (minute res) | 4.8 ms | 7.4 ms | 92 ms | 1.5x faster |
| 2 weeks (second res) | 280 ms | 460 ms | - | 1.6x faster |
| 1 month (minute res) | 9.8 ms | 17 ms | 187 ms | 1.7x faster |
The raw Zig implementation achieves ~5 million propagations/second, outperforming the Rust sgp4 crate by 1.3-2.2x.
Installation
# Build the shared library first
cd /path/to/astroz
zig build c-api
# Install Python package
cd python
pip install -e .
Usage
import astroz
from astroz import Tle, Sgp4, orbital, coords
# Parse TLE and propagate with SGP4
tle = Tle("""1 25544U 98067A 24001.50000000 .00016717 00000-0 10270-3 0 9025
2 25544 51.6400 208.9163 0006703 40.6542 114.5435 15.49910020999999""")
sgp4 = Sgp4(tle)
pos, vel = sgp4.propagate(30.0) # 30 minutes after epoch
print(f"Position: {pos} km")
print(f"Velocity: {vel} km/s")
# Convert to ground coordinates
gmst = coords.julian_to_gmst(2460310.5)
lat, lon, alt = coords.eci_to_geodetic(pos, gmst)
print(f"Lat: {lat:.2f}, Lon: {lon:.2f}, Alt: {alt:.1f} km")
# Orbital mechanics
transfer = orbital.hohmann(398600.5, 6778, 42164) # LEO to GEO
print(f"Delta-V: {transfer['total_delta_v']:.2f} km/s")
API
TLE Parsing
Tle(tle_string)- Parse two-line element set- Properties:
satellite_number,epoch,inclination,eccentricity,mean_motion
SGP4 Propagation
Sgp4(tle, gravity_model=WGS84)- Initialize propagatorpropagate(tsince)- Single propagation (returns tuple)propagate_batch(times)- Batch propagation (returns list)propagate_batch_np(times)- Batch with numpy (fastest, returns arrays)
Coordinates
coords.eci_to_ecef(eci, gmst)- ECI to ECEFcoords.ecef_to_geodetic(ecef)- ECEF to lat/lon/altcoords.eci_to_geodetic(eci, gmst)- ECI to lat/lon/altcoords.julian_to_gmst(jd)- Julian date to GMST
Orbital Mechanics
orbital.hohmann(mu, r1, r2)- Hohmann transfer calculationorbital.velocity(mu, radius, sma=0)- Orbital velocityorbital.period(mu, sma)- Orbital periodorbital.escape_velocity(mu, radius)- Escape velocity
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file astroz-0.4.1.tar.gz.
File metadata
- Download URL: astroz-0.4.1.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1a997a9742bd32829a2911bb4cc28f6668271cb03913b76ac72667ffcc94216
|
|
| MD5 |
24c69a46f434ea23e5c3c006089a15bc
|
|
| BLAKE2b-256 |
4c14bf3fe986d2a9e71c82e688610ce7e88d0ccad48b4854fd6b95b3ce5314ed
|
Provenance
The following attestation bundles were made for astroz-0.4.1.tar.gz:
Publisher:
python.yaml on ATTron/astroz
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
astroz-0.4.1.tar.gz -
Subject digest:
f1a997a9742bd32829a2911bb4cc28f6668271cb03913b76ac72667ffcc94216 - Sigstore transparency entry: 830643880
- Sigstore integration time:
-
Permalink:
ATTron/astroz@a08387e21b208360b51f2e01aec54a208a2faf6e -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/ATTron
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yaml@a08387e21b208360b51f2e01aec54a208a2faf6e -
Trigger Event:
push
-
Statement type:
File details
Details for the file astroz-0.4.1-cp312-cp312-manylinux_2_38_x86_64.whl.
File metadata
- Download URL: astroz-0.4.1-cp312-cp312-manylinux_2_38_x86_64.whl
- Upload date:
- Size: 114.4 kB
- Tags: CPython 3.12, manylinux: glibc 2.38+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e115a17587af8a97a9fcbe2801fc35edf93a12f48b9c46229562e35caf71d958
|
|
| MD5 |
8695bd77f789657c35c707d6c99072ca
|
|
| BLAKE2b-256 |
c0930bd74d54e76bc634669292b5a65b633f6e17aa18c2f929e65bbd8e8ee283
|
Provenance
The following attestation bundles were made for astroz-0.4.1-cp312-cp312-manylinux_2_38_x86_64.whl:
Publisher:
python.yaml on ATTron/astroz
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
astroz-0.4.1-cp312-cp312-manylinux_2_38_x86_64.whl -
Subject digest:
e115a17587af8a97a9fcbe2801fc35edf93a12f48b9c46229562e35caf71d958 - Sigstore transparency entry: 830643885
- Sigstore integration time:
-
Permalink:
ATTron/astroz@a08387e21b208360b51f2e01aec54a208a2faf6e -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/ATTron
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yaml@a08387e21b208360b51f2e01aec54a208a2faf6e -
Trigger Event:
push
-
Statement type:
File details
Details for the file astroz-0.4.1-cp312-cp312-macosx_15_0_universal2.whl.
File metadata
- Download URL: astroz-0.4.1-cp312-cp312-macosx_15_0_universal2.whl
- Upload date:
- Size: 47.1 kB
- Tags: CPython 3.12, macOS 15.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
678d2bcb187ab85e6a64ac65b0e1ae8a5f8e0ab396eed483aaaaa59ba8a1bff7
|
|
| MD5 |
393ec35e618747eab2210e2337a63230
|
|
| BLAKE2b-256 |
4fc956b42cde5383b42bb18fea85d5892fca21ac3045159b0809066d63d82669
|
Provenance
The following attestation bundles were made for astroz-0.4.1-cp312-cp312-macosx_15_0_universal2.whl:
Publisher:
python.yaml on ATTron/astroz
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
astroz-0.4.1-cp312-cp312-macosx_15_0_universal2.whl -
Subject digest:
678d2bcb187ab85e6a64ac65b0e1ae8a5f8e0ab396eed483aaaaa59ba8a1bff7 - Sigstore transparency entry: 830643884
- Sigstore integration time:
-
Permalink:
ATTron/astroz@a08387e21b208360b51f2e01aec54a208a2faf6e -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/ATTron
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yaml@a08387e21b208360b51f2e01aec54a208a2faf6e -
Trigger Event:
push
-
Statement type: