Python bindings for astroz - high-performance astrodynamics library
Project description
astroz Python Bindings
High-performance SGP4/SDP4 satellite propagation, powered by Zig with SIMD acceleration (AVX512/AVX2). Automatically handles both near-earth and deep-space satellites.
Platforms: macOS, Linux | Requires: Python 3.10+
Quick Start
python-sgp4 Compatible API (Recommended)
Drop-in replacement for python-sgp4:
from astroz.api import Satrec, SatrecArray, jday, WGS72
import numpy as np
# Single satellite (same syntax as python-sgp4)
sat = Satrec.twoline2rv(line1, line2, WGS72)
jd, fr = jday(2024, 5, 6, 12, 0, 0.0)
error, position, velocity = sat.sgp4(jd, fr)
# Batch propagation (270-330M props/sec with SIMD)
sat_array = SatrecArray(satrecs)
e, r, v = sat_array.sgp4(jd, fr) # Scalars or arrays
# Skip velocities for 30% faster propagation
e, r, _ = sat_array.sgp4(jd_array, fr_array, velocities=False)
High-Level API
from astroz import propagate
import numpy as np
# Load and propagate - automatically optimized for 300M+ props/sec
positions = propagate("starlink", np.arange(1440)) # 1 day at 1-min intervals
# positions: (1440, num_satellites, 3) in km, ECEF coordinates
Loading Sources
from astroz import propagate, Constellation
# CelesTrak groups
positions = propagate("starlink", times)
positions = propagate("iss", times)
positions = propagate("gps", times)
positions = propagate("all", times) # ~13k active satellites
# By NORAD ID
positions = propagate(None, times, norad_id=25544) # ISS
positions = propagate(None, times, norad_id=[25544, 48274]) # Multiple
# Local file or URL
positions = propagate("satellites.tle", times)
positions = propagate("https://example.com/tles.txt", times)
# For repeated propagation, pre-parse to avoid overhead
c = Constellation("starlink")
positions1 = propagate(c, times1)
positions2 = propagate(c, times2)
Groups: all, starlink, oneweb, planet, spire, gps, glonass, galileo, beidou, stations/iss, weather, geo
Propagation
from astroz import propagate, Constellation
from datetime import datetime, timezone
import numpy as np
times = np.arange(1440) # 1 day at 1-min intervals
# Simple (defaults: now UTC, ECEF output)
positions = propagate("starlink", times)
# With options
positions = propagate(
"starlink",
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 = propagate("starlink", times, velocities=True)
Conjunction Screening
from astroz import screen
import numpy as np
times = np.arange(1440)
# Single target (fastest - uses fused propagate+screen, no full position array)
min_dists, min_t_indices = screen("starlink", times, threshold=50.0, target=0)
# Returns per-satellite minimum distance to target and time index
# All-vs-all screening
pairs, t_indices = screen("starlink", times, threshold=10.0)
# Returns all conjunction events within threshold
Migrating from python-sgp4
Step 1: Change the Import (2x faster)
# Before
from sgp4.api import Satrec, SatrecArray, jday
# After
from astroz.api import Satrec, SatrecArray, jday
That's it. Your existing code works unchanged and runs 2x faster.
Step 2: Use Batch Methods (5-12x faster)
If you have loops, switch to batch methods:
# Before: loop (1.3M props/sec)
results = []
for jd, fr in zip(jd_list, fr_list):
e, r, v = sat.sgp4(jd, fr)
results.append(r)
# After: batch (15M props/sec) - 12x faster
jd_array = np.array(jd_list)
fr_array = np.array(fr_list)
e, r, v = sat.sgp4_array(jd_array, fr_array)
Step 3: Use SatrecArray for Multiple Satellites (100x faster)
# Before: loop over satellites (1.3M props/sec)
for sat in satellites:
e, r, v = sat.sgp4_array(jd, fr)
# After: batch all satellites (290M props/sec) - 100x faster
sat_array = SatrecArray(satellites)
e, r, v = sat_array.sgp4(jd, fr)
Step 4: Skip Velocities If Not Needed (30% faster)
# If you only need positions
e, r, _ = sat_array.sgp4(jd, fr, velocities=False)
Performance Summary
| Pattern | python-sgp4 | astroz | Speedup |
|---|---|---|---|
sat.sgp4() loop |
1.3M/s | 2.5M/s | 2x |
sat.sgp4_array() |
2.7M/s | 15M/s | 5x |
SatrecArray.sgp4() |
3M/s | 290M/s | 100x |
Compatibility Notes
astroz supports the core python-sgp4 API for satellite propagation. Some rarely-used attributes are not implemented:
- TLE metadata:
classification,intldesg,elnum,revnum,ephtype - Intermediate elements:
Om,am,em,im,mm,nm,om(osculating elements after propagation) - Element rates:
argpdot,mdot,nodedot - Gravity constants:
j2,j3,j4,mu, etc. (available viaastroz.constants)
For typical satellite tracking and visualization, astroz is a full drop-in replacement.
Performance
| Constellation (13,478 sats x 1,440 steps) | Throughput |
|---|---|
| 1 thread | 37.7M props/sec |
| 16 threads | 303M props/sec |
Benchmarked on AMD Ryzen 7 7840U with AVX512.
Set ASTROZ_THREADS to control thread count (defaults to all cores).
Building
Requires Zig and Python 3.10+.
cd bindings/python
pip install -e .
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 Distributions
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.10.0-cp312-cp312-manylinux_2_36_x86_64.whl.
File metadata
- Download URL: astroz-0.10.0-cp312-cp312-manylinux_2_36_x86_64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.12, manylinux: glibc 2.36+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e662301059a2321d4ac807073a276081b349857592b1799dc057ea23d07e16d0
|
|
| MD5 |
bde93ac3c64e75c898e21bd55fb5e191
|
|
| BLAKE2b-256 |
09718c2660856bf0cc066c0020ec509efc20dae5087ea001ac1648de1adb08fb
|
Provenance
The following attestation bundles were made for astroz-0.10.0-cp312-cp312-manylinux_2_36_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.10.0-cp312-cp312-manylinux_2_36_x86_64.whl -
Subject digest:
e662301059a2321d4ac807073a276081b349857592b1799dc057ea23d07e16d0 - Sigstore transparency entry: 995151230
- Sigstore integration time:
-
Permalink:
ATTron/astroz@8b5c5b2f4dce407208ea6a00575fb79cd6455fc2 -
Branch / Tag:
refs/tags/v0.10.0 - Owner: https://github.com/ATTron
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yaml@8b5c5b2f4dce407208ea6a00575fb79cd6455fc2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file astroz-0.10.0-cp312-cp312-macosx_15_0_universal2.whl.
File metadata
- Download URL: astroz-0.10.0-cp312-cp312-macosx_15_0_universal2.whl
- Upload date:
- Size: 1.0 MB
- 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 |
15ea1211a3d9bae8cb8ba9eeb9854c12d251a28cf72b405d1189455729a4528f
|
|
| MD5 |
bcb95ac75d9fc20be26fdb4f0c7a031a
|
|
| BLAKE2b-256 |
936fb55f9a537711feaa2e6ac807c6bc6214a7175791117e9836a24050026f06
|
Provenance
The following attestation bundles were made for astroz-0.10.0-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.10.0-cp312-cp312-macosx_15_0_universal2.whl -
Subject digest:
15ea1211a3d9bae8cb8ba9eeb9854c12d251a28cf72b405d1189455729a4528f - Sigstore transparency entry: 995151225
- Sigstore integration time:
-
Permalink:
ATTron/astroz@8b5c5b2f4dce407208ea6a00575fb79cd6455fc2 -
Branch / Tag:
refs/tags/v0.10.0 - Owner: https://github.com/ATTron
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yaml@8b5c5b2f4dce407208ea6a00575fb79cd6455fc2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file astroz-0.10.0-cp311-cp311-manylinux_2_36_x86_64.whl.
File metadata
- Download URL: astroz-0.10.0-cp311-cp311-manylinux_2_36_x86_64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.11, manylinux: glibc 2.36+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cbed216b58f9ede3513e982f7c8707a4a0611945b7c0c1c9b5f4d1a2e43edf4
|
|
| MD5 |
7aacbd255d88fe98d5561b5115218e2f
|
|
| BLAKE2b-256 |
021f8dba10d7161c98e9dfea93c1175e4f570bf9e9dc61263ef76486c5137fbe
|
Provenance
The following attestation bundles were made for astroz-0.10.0-cp311-cp311-manylinux_2_36_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.10.0-cp311-cp311-manylinux_2_36_x86_64.whl -
Subject digest:
2cbed216b58f9ede3513e982f7c8707a4a0611945b7c0c1c9b5f4d1a2e43edf4 - Sigstore transparency entry: 995151232
- Sigstore integration time:
-
Permalink:
ATTron/astroz@8b5c5b2f4dce407208ea6a00575fb79cd6455fc2 -
Branch / Tag:
refs/tags/v0.10.0 - Owner: https://github.com/ATTron
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yaml@8b5c5b2f4dce407208ea6a00575fb79cd6455fc2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file astroz-0.10.0-cp311-cp311-macosx_15_0_universal2.whl.
File metadata
- Download URL: astroz-0.10.0-cp311-cp311-macosx_15_0_universal2.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.11, 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 |
364224dd20980dad35a06320c9eb7445eea9e9932d1065d7afe6650fe075d860
|
|
| MD5 |
39df8064ebb8d8db8bb5563fed2e3cc8
|
|
| BLAKE2b-256 |
7a6b20baf0c33dcff94b7aec7c20f0964a5c44a99a90d1ceb803d757b43912eb
|
Provenance
The following attestation bundles were made for astroz-0.10.0-cp311-cp311-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.10.0-cp311-cp311-macosx_15_0_universal2.whl -
Subject digest:
364224dd20980dad35a06320c9eb7445eea9e9932d1065d7afe6650fe075d860 - Sigstore transparency entry: 995151222
- Sigstore integration time:
-
Permalink:
ATTron/astroz@8b5c5b2f4dce407208ea6a00575fb79cd6455fc2 -
Branch / Tag:
refs/tags/v0.10.0 - Owner: https://github.com/ATTron
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yaml@8b5c5b2f4dce407208ea6a00575fb79cd6455fc2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file astroz-0.10.0-cp310-cp310-manylinux_2_36_x86_64.whl.
File metadata
- Download URL: astroz-0.10.0-cp310-cp310-manylinux_2_36_x86_64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.10, manylinux: glibc 2.36+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bbccad82e2e9dc083fc96a9715c65ad85f92a76abe499263997dacb4eb02b24
|
|
| MD5 |
fc5f49a9708ae1147325fd7c74f2ce51
|
|
| BLAKE2b-256 |
195cf497814a50b409a1e1ca84be201f4d12eba0ec6567e8a44d447936341233
|
Provenance
The following attestation bundles were made for astroz-0.10.0-cp310-cp310-manylinux_2_36_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.10.0-cp310-cp310-manylinux_2_36_x86_64.whl -
Subject digest:
1bbccad82e2e9dc083fc96a9715c65ad85f92a76abe499263997dacb4eb02b24 - Sigstore transparency entry: 995151224
- Sigstore integration time:
-
Permalink:
ATTron/astroz@8b5c5b2f4dce407208ea6a00575fb79cd6455fc2 -
Branch / Tag:
refs/tags/v0.10.0 - Owner: https://github.com/ATTron
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yaml@8b5c5b2f4dce407208ea6a00575fb79cd6455fc2 -
Trigger Event:
push
-
Statement type: