{"id":15145372,"url":"https://github.com/attron/astroz","last_synced_at":"2026-02-26T10:56:36.862Z","repository":{"id":246616108,"uuid":"819657891","full_name":"ATTron/astroz","owner":"ATTron","description":"Astrodynamics and Spacecraft Toolkit Written in Zig! Features orbit prop, celestial precession, CCSDS parsing, RF parsing, fits image parsing, and more!","archived":false,"fork":false,"pushed_at":"2024-11-13T19:28:32.000Z","size":107241,"stargazers_count":16,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T21:35:24.490Z","etag":null,"topics":["astro","astronomy","astrophysics","ccsds","celestial-bodies","fits-files","fits-image","orbital-simulation","radio-frequency","rf","space","spacecraft","tle","toolkit","vita","zig","zig-library","zig-package"],"latest_commit_sha":null,"homepage":"https://attron.github.io/astroz/","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ATTron.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-25T00:35:54.000Z","updated_at":"2024-11-13T19:28:35.000Z","dependencies_parsed_at":"2024-07-24T04:52:49.623Z","dependency_job_id":"30b111fb-bf8d-410a-97b6-89a63f929080","html_url":"https://github.com/ATTron/astroz","commit_stats":{"total_commits":98,"total_committers":4,"mean_commits":24.5,"dds":0.5816326530612245,"last_synced_commit":"fb8c8ee43b2b11eb84910ae85d684d8249b3434c"},"previous_names":["attron/astroz"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ATTron%2Fastroz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ATTron%2Fastroz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ATTron%2Fastroz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ATTron%2Fastroz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ATTron","download_url":"https://codeload.github.com/ATTron/astroz/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237893685,"owners_count":19383095,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["astro","astronomy","astrophysics","ccsds","celestial-bodies","fits-files","fits-image","orbital-simulation","radio-frequency","rf","space","spacecraft","tle","toolkit","vita","zig","zig-library","zig-package"],"created_at":"2024-09-26T11:24:01.529Z","updated_at":"2026-02-26T10:56:36.828Z","avatar_url":"https://github.com/ATTron.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cimg src=\"https://repository-images.githubusercontent.com/819657891/7fdb22c8-7171-4b75-9f33-88a62ea67259\" width=\"900\" height=\"600\" /\u003e\n\u003c/h1\u003e\n\n[![CI][ci-shd]][ci-url]\n[![CD][cd-shd]][cd-url]\n[![DC][dc-shd]][dc-url]\n\n## Astronomical and Spacecraft Toolkit Written in Zig\n\n**Featuring the fastest CPU based open source SGP4/SDP4 propagator**\n\n| Orbital Mechanics | Spacecraft Ops | Astronomy |\n|-------------------|----------------|-----------|\n| SGP4/SDP4 propagation | CCSDS packets | FITS parsing |\n| TLE parsing | VITA49 packets | WCS coordinates |\n| Orbital maneuvers | Attitude determination | Star precession |\n| Force models (J2-J4, drag, SRP, third-body) | CSPICE ephemeris | Celestial bodies |\n| Dormand-Prince 8(7) integrator | Monte Carlo sims | |\n\n### Performance\n\nSub-meter accuracy validated against reference implementations. Automatically dispatches between SGP4 (near-earth) and SDP4 (deep-space) based on orbital period. Uses SIMD (AVX512/AVX2) to process 8 satellites simultaneously, with multithreaded constellation propagation across all available cores.\n\n#### Single-Threaded (1.2M propagations, single satellite)\n\n| Implementation | Props/sec | Speedup vs python-sgp4 |\n|----------------|-----------|------------------------|\n| **astroz** | **30.8M** | **11x** |\n| Rust sgp4 | 5.1M | 1.8x |\n| heyoka | 3.8M | 1.3x |\n| satkit | 3.5M | 1.2x |\n| python-sgp4 | 2.8M | 1x |\n\n#### Multi-Threaded Constellation (13,478 satellites × 1,440 times)\n\n| Implementation | 1 Thread | 16 Threads |\n|----------------|----------|------------|\n| **astroz** | 37.7M/s | **303M/s** |\n| heyoka | 15.7M/s | 155.6M/s |\n| Rust sgp4 (rayon) | 4.4M/s | 47.9M/s |\n| satkit | 3.5M/s | 3.5M/s |\n| python-sgp4 | 2.7M/s | 2.7M/s |\n\n*Benchmarked on AMD Ryzen 7 7840U (16 threads). All implementations using their optimal configurations (SIMD, pre-allocated outputs, batch mode).*\n\nUses SIMD (AVX512 for 8-wide, AVX2/SSE for 4-wide) with multithreaded time-major iteration. Validated against Vallado AIAA 2006-6753 reference vectors (\u003c 10m position error, \u003c 1µm/s velocity error). Set `ASTROZ_THREADS` environment variable to control thread count (defaults to all available cores).\n\nThe [Cesium visualization example](examples/README.md) propagates the entire active satellite catalog (~13,000 satellites) at interactive rates. **[Try the live demo →](https://attron.github.io/astroz-demo/)**\n\n### Validated Accuracy\n\nForce models and propagators are validated against reference implementations:\n\n| Component | Reference | Tolerance |\n|-----------|-----------|-----------|\n| SGP4/SDP4 propagation | python-sgp4 | \u003c 100m position |\n| J2 RAAN drift | Vallado analytical | \u003c 1% |\n| Hohmann transfer ΔV | poliastro | \u003c 0.1% |\n| Orbital periods | Analytical | 1e-10 relative |\n| Two-body energy | Conservation law | 1e-10 over 100 orbits |\n\nRun validation tests: `zig build test`\n\nWith CSPICE enabled (for high-precision ephemeris): `zig build test -Denable-cspice=true`\n\n### Python\n\nOnly supports **Linux x86_64** and **macOS ARM64** (Python 3.10–3.12):\n\n```bash\npip install astroz\n```\n\n#### python-sgp4 Compatible API (Recommended)\n\nDrop-in replacement for [python-sgp4](https://github.com/brandon-rhodes/python-sgp4) with transparent deep-space (SDP4) support. Just change the import for instant speedup:\n\n```python\n# Before                                    # After\nfrom sgp4.api import Satrec, jday      →    from astroz.api import Satrec, jday\n```\n\n| Your Code | python-sgp4 | astroz | Speedup |\n|-----------|-------------|--------|---------|\n| `sat.sgp4()` loop | 1.3M/s | 2.5M/s | **2x** |\n| `sat.sgp4_array()` | 2.7M/s | 15M/s | **5x** |\n| `SatrecArray.sgp4()` | 3M/s | 290M/s | **100x** |\n\nSee [migration guide](bindings/python/README.md#migrating-from-python-sgp4) for optimization tips.\n\n```python\nfrom astroz.api import Satrec, SatrecArray, jday, WGS72\nimport numpy as np\n\n# Single satellite (same syntax as python-sgp4)\nline1 = \"1 25544U 98067A   24127.82853009  .00015698  00000+0  27310-3 0  9995\"\nline2 = \"2 25544  51.6393 160.4574 0003580 140.6673 205.7250 15.50957674452123\"\nsat = Satrec.twoline2rv(line1, line2, WGS72)\n\njd, fr = jday(2024, 5, 6, 12, 0, 0.0)\nerror, position, velocity = sat.sgp4(jd, fr)\n\n# Batch propagation (270-330M props/sec with SIMD)\nsat_array = SatrecArray([sat1, sat2, ...])  # List of Satrec objects\n\n# Single time point (scalars)\ne, r, v = sat_array.sgp4(2460000.5, 0.5)\n\n# Multiple time points (arrays)\njd = np.full(1440, 2460000.5)\nfr = np.linspace(0, 1, 1440)\ne, r, v = sat_array.sgp4(jd, fr)  # (n_sats, n_times, 3)\n\n# Skip velocities for 30% faster propagation\ne, r, _ = sat_array.sgp4(jd, fr, velocities=False)\n```\n\n#### High-Level API\n\nConvenience functions for common workflows:\n\n```python\nfrom astroz import propagate, Constellation\nimport numpy as np\n\n# Load and propagate - automatically optimized for maximum performance\npositions = propagate(\"starlink\", np.arange(1440))  # 1 day at 1-min intervals\n# shape: (1440, num_satellites, 3) in km, ECEF coordinates\n\n# With options\nfrom datetime import datetime, timezone\npositions = propagate(\n    \"starlink\",\n    np.arange(1440),\n    start_time=datetime(2024, 6, 15, tzinfo=timezone.utc),\n    output=\"geodetic\",  # \"ecef\" (default), \"teme\", or \"geodetic\"\n)\n\n# With velocities\npositions, velocities = propagate(\"starlink\", np.arange(1440), velocities=True)\n\n# For repeated propagation, pre-parse to avoid overhead\nc = Constellation(\"starlink\")\npositions = propagate(c, np.arange(1440))\n```\n\n### Usage\n\n- Add `astroz` as a dependency in your `build.zig.zon`.\n\n```sh\nzig fetch --save https://github.com/ATTron/astroz/archive/\u003cgit_tag_or_commit_hash\u003e.tar.gz\n#or\nzig fetch --save git+https://github.com/ATTron/astroz/#HEAD\n```\n\n- Use `astroz` as a module in your `build.zig`.\n\n```zig\nconst astroz_dep = b.dependency(\"astroz\", .{\n    .target = target,\n    .optimize = optimize,\n});\nconst astroz_mod = astroz_dep.module(\"astroz\");\nexe.root_module.addImport(\"astroz\", astroz_mod);\n```\n\n- Propagate any satellite — the `Satellite` type auto-selects SGP4 or SDP4:\n\n```zig\nconst astroz = @import(\"astroz\");\n\nvar tle = try astroz.Tle.parse(tle_string, allocator);\ndefer tle.deinit();\n\nconst sat = try astroz.Satellite.init(tle, astroz.constants.wgs84);\nconst result = try sat.propagate(60.0); // minutes from epoch\nconst pos = result[0]; // [x, y, z] km\nconst vel = result[1]; // [vx, vy, vz] km/s\n```\n\n### Examples\n\n#### Spacecraft Operations\n\n- #### [Force Model Propagation](examples/maneuver_planning.zig)\n  Composable force models (TwoBody, J2) with the Dormand-Prince 8(7) adaptive integrator. Shows `ForceModel.wrap()` and `Composite` for combining perturbations.\n\n- #### [Constellation Phasing](examples/constellation_phasing.zig)\n  Sun-synchronous orbit design and constellation plane separation using J2-induced RAAN drift.\n\n- #### [Orbit Orientation Determination](examples/simple_spacecraft_orientation.zig)\n  Calculate spacecraft attitude and orientation.\n\n#### Orbital Mechanics\n\n- #### [Planet Transfer \u0026 Mission Planning](examples/transfer_propagation.zig)\n  Demonstrates interplanetary transfers with mission planning (Hohmann vs Bi-Elliptic comparison) and trajectory propagation.\n\n- #### [Orbit Maneuvers](examples/orbit_maneuvers.zig)\n  Comprehensive example showing TLE-based orbit propagation with various maneuver types: impulse, plane change, and phase change.\n\n- #### [Monte Carlo Simulation](examples/simple_monte_carlo.zig)\n  Statistical analysis for mission planning with uncertainty.\n\n- #### [Propagation](examples/propagation.zig)\n  Analytical orbit propagation using SGP4/SDP4 with TLE input. Demonstrates direct SGP4 usage, the modular propagator interface, and the unified Satellite type that auto-dispatches between SGP4 and SDP4.\n\n- #### [SPICE Propagation](examples/spice_propagation.zig)\n  High-fidelity LEO propagation with SPICE-updated Sun/Moon ephemeris. Combines TwoBody + J2 + SRP + third-body perturbations with real-time position updates.\n\n- #### [Cesium Satellite Visualization](examples/README.md) — **[Live Demo](https://attron.github.io/astroz-demo/)**\n\n  Interactive 3D visualization of the entire near-earth satellite catalog (~13,000 satellites) using Cesium. Features multithreaded SGP4/SDP4 propagation at ~300M props/sec, constellation filtering, search, and satellite tracking.\n\n#### Telemetry \u0026 Data Handling\n\n- #### [Parse Vita49](examples/parse_vita49.zig) / [with Callback](examples/parse_vita49_callback.zig)\n  VITA Radio Transport (VRT) packet stream parsing.\n\n- #### [Parse CCSDS](examples/parse_ccsds.zig) / [with File Sync](examples/parse_ccsds_file_sync.zig)\n  Parse CCSDS space packet protocol from files.\n\n- #### [Create CCSDS Packet](examples/create_ccsds_packet.zig) / [with Config](examples/create_ccsds_packet_config.zig)\n  Generate CCSDS packets for telemetry.\n\n#### Astronomy \u0026 Astrometry\n\n- #### [Generate Image from FITS File](examples/parse_fits_file.zig)\n  Parse and render FITS astronomical image data.\n\n\u003cimg src=\"test/test.png\" width=\"450\" height=\"400\" alt=\"sample fits image as png\"/\u003e\n\n- #### [Precess Star Coordinates](examples/precess_star.zig)\n  Calculate stellar precession to a target epoch.\n\n- #### [Calculate WCS from TLE](examples/wcs.zig)\n  Compute World Coordinate System values from orbital elements.\n\n\u003c!-- MARKDOWN LINKS --\u003e\n\n[ci-shd]: https://img.shields.io/github/actions/workflow/status/ATTron/astroz/ci.yaml?branch=main\u0026logo=github\u0026label=CI\u0026labelColor=black\n[ci-url]: https://github.com/ATTron/astroz/blob/main/.github/workflows/ci.yaml\n[cd-shd]: https://img.shields.io/github/actions/workflow/status/ATTron/astroz/cd.yaml?branch=main\u0026logo=github\u0026label=CD\u0026labelColor=black\n[cd-url]: https://github.com/ATTron/astroz/blob/main/.github/workflows/cd.yaml\n[dc-shd]: https://img.shields.io/badge/click-F6A516?logo=zig\u0026logoColor=F6A516\u0026label=doc\u0026labelColor=black\n[dc-url]: https://attron.github.io/astroz\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fattron%2Fastroz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fattron%2Fastroz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fattron%2Fastroz/lists"}