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.0.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.0-cp312-cp312-manylinux_2_34_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

astroz-0.4.0-cp312-cp312-macosx_15_0_universal2.whl (634.2 kB view details)

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

File details

Details for the file astroz-0.4.0.tar.gz.

File metadata

  • Download URL: astroz-0.4.0.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.0.tar.gz
Algorithm Hash digest
SHA256 685ff058ad1a9836ef11fbc00d111a62950994d2652f065887d67a59ae2c43d0
MD5 6633f07ed3e5eb393ea2389c26b3936e
BLAKE2b-256 faee3c4eb4a37015d0c7197940ec00a19a612fd8a6961d442ae0a3c4540adcdf

See more details on using hashes here.

Provenance

The following attestation bundles were made for astroz-0.4.0.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.0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for astroz-0.4.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 c404b9972bb14df1239637daf9c6bfe4db3c464a1f4d49def25c65aefc0cdb9e
MD5 c2e6fe7a78468856bbfe005410474509
BLAKE2b-256 e33a22755877df9bef9f2eb8424e4d9d39b649910db104924739b0953ff7e910

See more details on using hashes here.

Provenance

The following attestation bundles were made for astroz-0.4.0-cp312-cp312-manylinux_2_34_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.0-cp312-cp312-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for astroz-0.4.0-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 47b57ea4178013fe4d826d6a372b2e154e1b96e36ea2a73c54fc0330ac371df5
MD5 2d3571d5a5c7e4ff501487463fde3931
BLAKE2b-256 182f673520e7368fca1eeecec2c0c93e2a117d9bd764d1f07dcd3b54e36b1c60

See more details on using hashes here.

Provenance

The following attestation bundles were made for astroz-0.4.0-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