Skip to main content

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

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 (TLE or OMM JSON auto-detected)
positions = propagate("satellites.tle", times)
positions = propagate("https://example.com/tles.txt", times)

# OMM JSON (CCSDS 502.0-B-3) — supports 6+ digit NORAD IDs
positions = propagate('{"NORAD_CAT_ID":25544,"EPOCH":"2026-04-15T12:00:00.000000","MEAN_MOTION":15.489,...}', 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 via astroz.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).

Orbital Mechanics

from astroz import (
    hohmann_transfer, bi_elliptic_transfer, lambert,
    orbital_velocity, orbital_period, escape_velocity,
    EARTH_MU,
)

# Hohmann transfer: LEO (400 km) to GEO
result = hohmann_transfer(EARTH_MU, 6778, 42164)
print(f"Total ΔV: {result['total_dv']:.3f} km/s")
print(f"Transfer time: {result['transfer_time_days']:.2f} days")

# Bi-elliptic transfer (more efficient for large radius ratios)
result = bi_elliptic_transfer(EARTH_MU, 6778, 42164, 100000)
print(f"Total ΔV: {result['total_dv']:.3f} km/s")

# Lambert solver: find transfer orbit between two positions
r1 = (7000.0, 0.0, 0.0)
r2 = (0.0, 7000.0, 0.0)
tof = 3600.0  # 1 hour
result = lambert(EARTH_MU, r1, r2, tof)
print(f"Departure velocity: {result['departure_velocity']}")

# Orbital velocity, period, escape velocity
v = orbital_velocity(EARTH_MU, 6778)          # Circular orbit at 400 km
T = orbital_period(EARTH_MU, 6778)            # Period in seconds
v_esc = escape_velocity(EARTH_MU, 6778)       # Escape velocity

Numerical Propagation

Propagate orbits with perturbation models (J2, atmospheric drag) using RK4 or Dormand-Prince 8(7) adaptive integrators. r_eq is required when using J2 or drag perturbations. Drag uses an exponential Earth atmosphere model (sea-level density 1.225 kg/m^3, scale height 7.249 km, cutoff altitude 1500 km). drag_area is in m^2 and drag_mass in kg.

from astroz import propagate_numerical, EARTH_MU, EARTH_J2, EARTH_R_EQ

# Initial state: LEO circular orbit [x, y, z, vx, vy, vz] (km, km/s)
state = (6778.0, 0.0, 0.0, 0.0, 7.668, 0.0)

# Two-body propagation (1 orbit, 60s steps)
times, states = propagate_numerical(state, 0.0, 5554.0, 60.0, EARTH_MU)

# With J2 perturbation
times, states = propagate_numerical(
    state, 0.0, 5554.0, 60.0, EARTH_MU,
    j2=EARTH_J2, r_eq=EARTH_R_EQ,
)

# With J2 + atmospheric drag
times, states = propagate_numerical(
    state, 0.0, 86400.0, 60.0, EARTH_MU,
    j2=EARTH_J2, r_eq=EARTH_R_EQ,
    drag_cd=2.2, drag_area=10.0, drag_mass=500.0,
    integrator="dp87",  # or "rk4"
)

Constants

from astroz import EARTH_MU, EARTH_R_EQ, EARTH_J2, SUN_MU, MOON_MU

print(f"Earth μ: {EARTH_MU} km³/s²")
print(f"Earth radius: {EARTH_R_EQ} km")
print(f"Earth J2: {EARTH_J2}")
print(f"Sun μ: {SUN_MU} km³/s²")
print(f"Moon μ: {MOON_MU} km³/s²")

Building

Requires Zig and Python 3.10+.

cd bindings/python
pip install -e .

Metadata

Release files for astroz 0.14.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for astroz 0.14.0
File
astroz-0.14.0-cp314-cp314-manylinux_2_36_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.36+ x86-64 Details
astroz-0.14.0-cp314-cp314-macosx_26_0_universal2.whl CPython 3.14 CPython 3.14 macOS 26.0+ universal2 (ARM64, x86-64) Details
astroz-0.14.0-cp313-cp313-manylinux_2_36_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.36+ x86-64 Details
astroz-0.14.0-cp313-cp313-macosx_26_0_universal2.whl CPython 3.13 CPython 3.13 macOS 26.0+ universal2 (ARM64, x86-64) Details
astroz-0.14.0-cp312-cp312-manylinux_2_36_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.36+ x86-64 Details
astroz-0.14.0-cp312-cp312-macosx_26_0_universal2.whl CPython 3.12 CPython 3.12 macOS 26.0+ universal2 (ARM64, x86-64) Details
astroz-0.14.0-cp311-cp311-manylinux_2_36_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.36+ x86-64 Details
astroz-0.14.0-cp311-cp311-macosx_26_0_universal2.whl CPython 3.11 CPython 3.11 macOS 26.0+ universal2 (ARM64, x86-64) Details
astroz-0.14.0-cp310-cp310-manylinux_2_36_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.36+ x86-64 Details

Total release size: 22.5 MB

Release files / astroz-0.14.0-cp314-cp314-manylinux_2_36_x86_64.whl

Download URL astroz-0.14.0-cp314-cp314-manylinux_2_36_x86_64.whl
Size 3.8 MB
Tags CPython 3.14 Linux glibc 2.36+ x86-64
SHA-256 checksum
How to use checksums
9f60a03550d1852f86e7472728b78835427f6748f9620450cca44e3edc8657d8
BLAKE2b-256 checksum
How to use checksums
61b4ebd9df22dc27e5c3e7c9e9f7a7a175ce6c5dd86857f8d2ca73e1f80e4a8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release files / astroz-0.14.0-cp314-cp314-macosx_26_0_universal2.whl

Download URL astroz-0.14.0-cp314-cp314-macosx_26_0_universal2.whl
Size 813.9 kB
Tags CPython 3.14 macOS 26.0+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
7898abbbeb24ed7936ad2b2bf18c5805d3afa29429dd5e60dcaf178bd019fa97
BLAKE2b-256 checksum
How to use checksums
9cbd3e6e279247da619abcb23a8b666ccc00b1edab678e0b7d72ba3709c7c789
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release files / astroz-0.14.0-cp313-cp313-manylinux_2_36_x86_64.whl

Download URL astroz-0.14.0-cp313-cp313-manylinux_2_36_x86_64.whl
Size 3.9 MB
Tags CPython 3.13 Linux glibc 2.36+ x86-64
SHA-256 checksum
How to use checksums
700d7bbaec97937577c554da3748a7acd71ec1ad5411e3b507ea281da83b475c
BLAKE2b-256 checksum
How to use checksums
cbd8bca5dac6cd7cbf0540773ced782a45ace3aa33b05ea911dfd3591f36b06e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release files / astroz-0.14.0-cp313-cp313-macosx_26_0_universal2.whl

Download URL astroz-0.14.0-cp313-cp313-macosx_26_0_universal2.whl
Size 814.3 kB
Tags CPython 3.13 macOS 26.0+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
e28957edf83318e4a805beb841960dd803d784a47443e7b03fc2b2b375384bea
BLAKE2b-256 checksum
How to use checksums
9ebb388dec741adf2e18f2f9140a7508ec6ae9bb28c98e19044f1005792399d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release files / astroz-0.14.0-cp312-cp312-manylinux_2_36_x86_64.whl

Download URL astroz-0.14.0-cp312-cp312-manylinux_2_36_x86_64.whl
Size 3.9 MB
Tags CPython 3.12 Linux glibc 2.36+ x86-64
SHA-256 checksum
How to use checksums
e9b0a3c598247d639516995cf194340eee4f7a703dc2a91634ccb9b25c79e9b5
BLAKE2b-256 checksum
How to use checksums
da8f6ba94f3dba0ee7358fc957da2d55a04189a4b8d8503ec910a1166c8ac883
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release files / astroz-0.14.0-cp312-cp312-macosx_26_0_universal2.whl

Download URL astroz-0.14.0-cp312-cp312-macosx_26_0_universal2.whl
Size 814.2 kB
Tags CPython 3.12 macOS 26.0+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
4b1cc8b3294f7e6b6170ada4abe881ea5fcc73b5dffbb6331c5b19f55c415c60
BLAKE2b-256 checksum
How to use checksums
49ffc7393180b4c616b82e4322b0bcf3fa60f2fb46be1a0262bbd21d98c133d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release files / astroz-0.14.0-cp311-cp311-manylinux_2_36_x86_64.whl

Download URL astroz-0.14.0-cp311-cp311-manylinux_2_36_x86_64.whl
Size 3.9 MB
Tags CPython 3.11 Linux glibc 2.36+ x86-64
SHA-256 checksum
How to use checksums
87dd30764e1eddf656c05fb5afb70c377b5e1b7842887c3677e29fe2e3273708
BLAKE2b-256 checksum
How to use checksums
789751d48536bb8b554fb14e7614a5ac7b17ee1d9ead900f01c355c0e080774f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release files / astroz-0.14.0-cp311-cp311-macosx_26_0_universal2.whl

Download URL astroz-0.14.0-cp311-cp311-macosx_26_0_universal2.whl
Size 813.2 kB
Tags CPython 3.11 macOS 26.0+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
8573886073b7cc981e52b8302d3f6bafc5a6869267a425cc6f5df20da64d21c2
BLAKE2b-256 checksum
How to use checksums
9b63fddac83a7c74d2dc5b5756abab9bf284290234b95d6ece51acaaf69cd24e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release files / astroz-0.14.0-cp310-cp310-manylinux_2_36_x86_64.whl

Download URL astroz-0.14.0-cp310-cp310-manylinux_2_36_x86_64.whl
Size 3.9 MB
Tags CPython 3.10 Linux glibc 2.36+ x86-64
SHA-256 checksum
How to use checksums
bd2e9eec9bbe3e09160c99c970b33a0d90a99eeb93f211b081f46c60702d67d1
BLAKE2b-256 checksum
How to use checksums
797d8caa9640732374e5cfd6e1c3c093288f31652fc25ae2ff8068178c6b1be6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release history Release notifications | RSS feed

0.14.1

9 release files

This release

0.14.0 This release

9 release files

0.13.0

9 release files

0.12.0

9 release files

0.10.1

9 release files

0.10.0

5 release files

0.9.0

5 release files

0.8.1

5 release files

0.8.0

5 release files

0.7.1

6 release files

0.6.1

6 release files

0.6.0

6 release files

0.5.0

6 release files

0.4.4

6 release files

0.4.3

6 release files

0.4.2

6 release files

0.4.1

3 release files

0.4.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page