API Reference¶
Core Functions¶
- sgp4jax.tle_to_satrec(line1, line2, gravity=None)¶
Parse TLE and initialize a SatRec ready for propagation.
- Parameters:
line1 – First TLE line
line2 – Second TLE line
gravity – Gravity constants (default WGS72)
- Returns:
SatRec NamedTuple
- sgp4jax.tles_to_satrec(tles, gravity=None)¶
Parse an array of TLEs and return a batched SatRec.
- Parameters:
tles – TLE lines with shape
(n_sat, 2). Each row contains[line1, line2]as strings.gravity – Gravity constants (default WGS72).
- Returns:
A single
SatRecwhose fields are stacked arrays with a leading dimension ofn_sat, ready for use withjax.vmap.
- sgp4jax.propagate(satrec, tsince)¶
Propagate satellite to time tsince (minutes from epoch).
- sgp4jax.propagate_jd(satrec, jd, fr)¶
Propagate satellite to Julian Date (jd + fr).
Returns TEME position (km), velocity (km/s), and error code.
Frame Transformations¶
- sgp4jax.teme_to_gcrf(r_teme, v_teme, jd, fr)¶
Transform position/velocity from TEME to GCRF (≈ICRS).
Replicates Skyfield’s
EarthSatellite._at()transformation chain:M = N @ P @ B, thenR = rot_z(theta_GMST1982 - GAST) @ Mwith the final GCRF vectors obtained viaR^T @ r_TEME.The input Julian date
jd + fris treated as UT1 time (≈UTC). TT and TDB are derived internally using an approximate delta_T model.- Parameters:
r_teme – Position in TEME frame (3,) in km.
v_teme – Velocity in TEME frame (3,) in km/s.
jd – Julian date, integer/whole part (scalar).
fr – Julian date, fractional part (scalar).
- Returns:
Position in GCRF frame (3,) in km. v_gcrf: Velocity in GCRF frame (3,) in km/s.
- Return type:
r_gcrf
- sgp4jax.propagate_gcrf(satrec, tsince)¶
Propagate satellite and return GCRF position/velocity.
- Parameters:
satrec (
SatRec) – Initialized SatRec fromtle_to_satrec().tsince (
Array) – Time since epoch in minutes (scalar jnp.ndarray).
- Returns:
Position in GCRF frame (3,) in km. v_gcrf: Velocity in GCRF frame (3,) in km/s. error: Error code (0 = success).
- Return type:
r_gcrf
- sgp4jax.propagate_jd_gcrf(satrec, jd, fr)¶
Propagate satellite to Julian Date (jd + fr) and return GCRF.
The input time
jd + fris interpreted as UTC, matching the time scale of TLE epochs and Measurement Set timestamps. The same UTC value is used for SGP4 propagation and, as an approximation to UT1, for the TEME → GCRF frame transformation (the UT1 − UTC difference is at most 0.9 s, introducing < 1 m frame error).- Parameters:
satrec (
SatRec) – Initialized SatRec fromtle_to_satrec().jd (
Array) – Julian date (UTC), integer/whole part (scalar jnp.ndarray).fr (
Array) – Julian date (UTC), fractional part (scalar jnp.ndarray).
- Returns:
Position in GCRF frame (3,) in km. v_gcrf: Velocity in GCRF frame (3,) in km/s. error: Error code (0 = success).
- Return type:
r_gcrf
Batch Convenience Functions¶
- sgp4jax.gcrf_positions(satrec, times_jd)¶
Propagate a single satellite to multiple UTC Julian dates.
- Parameters:
satrec (
SatRec) – Scalar SatRec fromtle_to_satrec().times_jd (
Array) – 1-D array of UTC Julian dates, shape(n_times,).
- Returns:
Positions in GCRF frame, shape
(n_times, 3)in km. v_gcrf: Velocities in GCRF frame, shape(n_times, 3)in km/s.- Return type:
r_gcrf
- sgp4jax.gcrf_positions_multi(satrec, times_jd)¶
Propagate multiple satellites to multiple UTC Julian dates.
- Parameters:
satrec (
SatRec) – Batched SatRec fromtles_to_satrec()with leading dimensionn_sat.times_jd (
Array) – 1-D array of UTC Julian dates, shape(n_times,).
- Returns:
Positions in GCRF, shape
(n_sat, n_times, 3)in km. v_gcrf: Velocities in GCRF, shape(n_sat, n_times, 3)in km/s.- Return type:
r_gcrf
Data Structures¶
- class sgp4jax.SatRec(bstar: Array, ecco: Array, argpo: Array, inclo: Array, mo: Array, no_kozai: Array, nodeo: Array, ndot: Array, nddot: Array, j2: Array, j3: Array, j4: Array, j3oj2: Array, xke: Array, mu: Array, radiusearthkm: Array, tumin: Array, jdsatepoch: Array, jdsatepochF: Array, no_unkozai: Array, a: Array, alta: Array, altp: Array, con41: Array, cc1: Array, cc4: Array, cc5: Array, d2: Array, d3: Array, d4: Array, delmo: Array, eta: Array, argpdot: Array, omgcof: Array, sinmao: Array, t2cof: Array, t3cof: Array, t4cof: Array, t5cof: Array, x1mth2: Array, x7thm1: Array, mdot: Array, nodedot: Array, xlcof: Array, xmcof: Array, nodecf: Array, aycof: Array, gsto: Array, d2201: Array, d2211: Array, d3210: Array, d3222: Array, d4410: Array, d4422: Array, d5220: Array, d5232: Array, d5421: Array, d5433: Array, dedt: Array, del1: Array, del2: Array, del3: Array, didt: Array, dmdt: Array, dnodt: Array, domdt: Array, e3: Array, ee2: Array, peo: Array, pgho: Array, pho: Array, pinco: Array, plo: Array, se2: Array, se3: Array, sgh2: Array, sgh3: Array, sgh4: Array, sh2: Array, sh3: Array, si2: Array, si3: Array, sl2: Array, sl3: Array, sl4: Array, xfact: Array, xgh2: Array, xgh3: Array, xgh4: Array, xh2: Array, xh3: Array, xi2: Array, xi3: Array, xl2: Array, xl3: Array, xl4: Array, xlamo: Array, xli: Array, xni: Array, zmol: Array, zmos: Array, atime: Array, method: Array, isimp: Array, irez: Array)¶
JAX-compatible satellite record.
All fields are jnp.ndarray scalars (float64). String flags are encoded as floats:
method: 0.0 = near-earth, 1.0 = deep-space
isimp: 0.0 = full perturbations, 1.0 = simplified
irez: 0.0 = no resonance, 1.0 = synchronous, 2.0 = half-day
Gravity Constants¶
- sgp4jax.WGS84 = (13.446851082044981, 398600.5, 6378.137, 0.07436685316871385, 0.00108262998905, -2.53215306e-06, -1.61098761e-06, -0.0023388905587420003)¶
GravityConstants(tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2)
- sgp4jax.WGS72 = (13.446839696959309, 398600.8, 6378.135, 0.07436691613317342, 0.001082616, -2.53881e-06, -1.65597e-06, -0.002345069720011528)¶
GravityConstants(tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2)
- sgp4jax.WGS72OLD = (13.446839702957643, 398600.79964, 6378.135, 0.0743669161, 0.001082616, -2.53881e-06, -1.65597e-06, -0.002345069720011528)¶
GravityConstants(tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2)