Skip to main content

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 propagator
  • propagate(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 ECEF
  • coords.ecef_to_geodetic(ecef) - ECEF to lat/lon/alt
  • coords.eci_to_geodetic(eci, gmst) - ECI to lat/lon/alt
  • coords.julian_to_gmst(jd) - Julian date to GMST

Orbital Mechanics

  • orbital.hohmann(mu, r1, r2) - Hohmann transfer calculation
  • orbital.velocity(mu, radius, sma=0) - Orbital velocity
  • orbital.period(mu, sma) - Orbital period
  • orbital.escape_velocity(mu, radius) - Escape velocity

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

astroz-0.4.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distributions

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

astroz-0.4.1-cp312-cp312-manylinux_2_38_x86_64.whl (114.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.38+ x86-64

astroz-0.4.1-cp312-cp312-macosx_15_0_universal2.whl (47.1 kB view details)

Uploaded CPython 3.12macOS 15.0+ universal2 (ARM64, x86-64)

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

Hashes for astroz-0.4.1.tar.gz
Algorithm Hash digest
SHA256 f1a997a9742bd32829a2911bb4cc28f6668271cb03913b76ac72667ffcc94216
MD5 24c69a46f434ea23e5c3c006089a15bc
BLAKE2b-256 4c14bf3fe986d2a9e71c82e688610ce7e88d0ccad48b4854fd6b95b3ce5314ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for astroz-0.4.1.tar.gz:

Publisher: python.yaml on ATTron/astroz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file astroz-0.4.1-cp312-cp312-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for astroz-0.4.1-cp312-cp312-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 e115a17587af8a97a9fcbe2801fc35edf93a12f48b9c46229562e35caf71d958
MD5 8695bd77f789657c35c707d6c99072ca
BLAKE2b-256 c0930bd74d54e76bc634669292b5a65b633f6e17aa18c2f929e65bbd8e8ee283

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file astroz-0.4.1-cp312-cp312-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for astroz-0.4.1-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 678d2bcb187ab85e6a64ac65b0e1ae8a5f8e0ab396eed483aaaaa59ba8a1bff7
MD5 393ec35e618747eab2210e2337a63230
BLAKE2b-256 4fc956b42cde5383b42bb18fea85d5892fca21ac3045159b0809066d63d82669

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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