Skip to main content

Python bindings for astroz - high-performance astrodynamics library

Project description

astroz Python Bindings

High-performance SGP4 satellite propagation, powered by Zig with SIMD acceleration (AVX512/AVX2).

Platforms: macOS, Linux | Requires: Python 3.10+

Quick Start

from astroz import Constellation
import numpy as np

# Load and propagate - automatically optimized for 300M+ props/sec
constellation = Constellation("starlink")
positions = constellation.propagate(np.arange(1440))  # 1 day at 1-min intervals
# positions: (1440, num_satellites, 3) in km, ECEF coordinates

Loading Constellations

from astroz import Constellation

# CelesTrak groups
constellation = Constellation("starlink")
constellation = Constellation("iss")
constellation = Constellation("gps")
constellation = Constellation("all")  # ~13k active satellites

# By NORAD ID
constellation = Constellation(norad_id=25544)  # ISS
constellation = Constellation(norad_id=[25544, 48274])  # Multiple

# Local file or URL
constellation = Constellation("satellites.tle")
constellation = Constellation("https://example.com/tles.txt")

# With metadata (name, norad_id, inclination, period, etc.)
constellation = Constellation("starlink", with_metadata=True)
for sat in constellation.metadata:
    print(f"{sat['name']}: {sat['inclination']:.1f}° inc, {sat['period']:.1f} min period")

Groups: all, starlink, oneweb, planet, spire, gps, glonass, galileo, beidou, stations/iss, weather, geo

Propagation

from astroz import Constellation
from datetime import datetime, timezone
import numpy as np

constellation = Constellation("starlink")

# Simple (defaults: now UTC, ECEF output)
positions = constellation.propagate(np.arange(1440))

# With options
positions = constellation.propagate(
    np.arange(14 * 1440),  # 2 weeks
    start_time=datetime(2024, 6, 1, tzinfo=timezone.utc),
    output="geodetic",  # "ecef" (default), "teme", or "geodetic"
)

# With velocities
positions, velocities = constellation.propagate(np.arange(1440), velocities=True)

Single Satellite

from astroz import Tle, Sgp4
import numpy as np

tle = Tle("""1 25544U 98067A   24127.82853009  .00015698  00000+0  27310-3 0  9995
2 25544  51.6393 160.4574 0003580 140.6673 205.7250 15.50957674452123""")

sgp4 = Sgp4(tle)
pos, vel = sgp4.propagate(30.0)  # 30 min after epoch
positions, velocities = sgp4.propagate_batch(np.arange(1440))

Collision Screening

from astroz import Constellation, coarse_screen, min_distances
import numpy as np

constellation = Constellation("starlink")
positions = constellation.propagate(np.arange(1440), output="teme")

# Find pairs within 10km
pairs, t_indices = coarse_screen(positions, threshold=10.0)

# Get exact minimum distances
pairs_array = np.array(pairs, dtype=np.uint32)
min_dists, min_times = min_distances(positions, pairs_array)

Performance

Constellation (13,478 sats × 1,440 steps) Throughput
1 thread 37.7M props/sec
16 threads 303M props/sec

Benchmarked on AMD Ryzen 7 7840U with AVX512. The Constellation class automatically handles buffer reuse and warmup for optimal performance.

Set ASTROZ_THREADS to control thread count (defaults to all cores).

Advanced: Pre-allocated Buffers

For maximum performance with repeated propagations, pre-allocate output buffers:

from astroz import Constellation
import numpy as np

constellation = Constellation("starlink")
times = np.arange(1440, dtype=np.float64)

# Pre-allocate buffer
out = np.empty((len(times), constellation.num_satellites, 3), dtype=np.float64)
positions = constellation.propagate(times, out=out)

Note: The Constellation class automatically reuses buffers internally when the output shape matches previous calls.

Building

Requires Zig and Python 3.10+.

cd bindings/python
pip install -e .

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.5.0.tar.gz (7.3 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.5.0-cp312-cp312-manylinux_2_34_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

astroz-0.5.0-cp312-cp312-macosx_15_0_universal2.whl (429.2 kB view details)

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

astroz-0.5.0-cp311-cp311-manylinux_2_34_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

astroz-0.5.0-cp311-cp311-macosx_15_0_universal2.whl (429.3 kB view details)

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

astroz-0.5.0-cp310-cp310-manylinux_2_34_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

File details

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

File metadata

  • Download URL: astroz-0.5.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for astroz-0.5.0.tar.gz
Algorithm Hash digest
SHA256 91e05ab2d691c668d0f3017292857853335531b56e1df444ad3084c7ae13726a
MD5 f2a6b55909aaaa54d68ad7d9069b94da
BLAKE2b-256 ca128a057e3b6e7cba6473a2ffe8ccef0e8383010eeac9dcb8fa24566fb3ea73

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for astroz-0.5.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ea5a4eda5dce4e090d57cbd52f41fbc80154864ad565a2a0e5b55a6afe459760
MD5 0e7911e7cedb1651030c924d5a8a633a
BLAKE2b-256 3dea9c56151520281182a1fea9309816e305201dca1a6d93655cfea8554a8b6a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for astroz-0.5.0-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 dc4371f0ff0ae512b25d3a9070fba2ef89cb17930d2bb1754192f970f310c3d2
MD5 59c4d8c16ae411e46a1317fe5f18bcd3
BLAKE2b-256 fdfba2fcefea21d9a4b17e770698b4269f6c395580abb5140c663553474e13b2

See more details on using hashes here.

Provenance

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

File details

Details for the file astroz-0.5.0-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for astroz-0.5.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 f3c0011eb8e108ca1c1247bd4c834cf52881106260ce936ab00ca66168d4acec
MD5 35c52f0f69fbb89b4bcfc1b2be350016
BLAKE2b-256 072c2de24d6106ce8ceeca9990dab68cf1147bd583744e245e83617e29d82492

See more details on using hashes here.

Provenance

The following attestation bundles were made for astroz-0.5.0-cp311-cp311-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.5.0-cp311-cp311-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for astroz-0.5.0-cp311-cp311-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 3e626fb8272f40954b8b751cb96205523a6ce07e445ae32368ba7890f3cac05b
MD5 26b600c83d40d31d2d60df4abbc7b15c
BLAKE2b-256 e4d317a3d2dc92f3b21b59096214b4bc04bdede3a9a8a66dd5f9b6f28b469f14

See more details on using hashes here.

Provenance

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

File details

Details for the file astroz-0.5.0-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for astroz-0.5.0-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ee6c531957289db24b280c22d0d9c364bf6033c79fb8b4f78ec8203c5b1e2537
MD5 0005280431b181d12ab12db64fece1be
BLAKE2b-256 b92e208e956cf6f3c801a898484d7442b1f53803d674d538ce9dbd9b686c5c8e

See more details on using hashes here.

Provenance

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

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