API Reference¶
Core Functions¶
- sgp4jax.tle_to_satrec(line1, line2, gravity=None)¶
Parse TLE and initialize a SatRec ready for propagation.
- sgp4jax.tles_to_satrec(tles, gravity=None)¶
Parse an array of TLEs and return a batched SatRec.
- Parameters:
- Return type:
- 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).
- Parameters:
- Returns:
position vector (3,) in km (TEME frame) v: velocity vector (3,) in km/s (TEME frame) error: error code (0 = success)
- Return type:
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 (
Union[Array,ndarray,bool,number,bool,int,float,complex,TypedNdArray]) – Position in TEME frame (3,) in km.v_teme (
Union[Array,ndarray,bool,number,bool,int,float,complex,TypedNdArray]) – Velocity in TEME frame (3,) in km/s.jd (
Union[Array,ndarray,bool,number,bool,int,float,complex,TypedNdArray]) – Julian date, integer/whole part (scalar).fr (
Union[Array,ndarray,bool,number,bool,int,float,complex,TypedNdArray]) – 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:
- sgp4jax.propagate_gcrf(satrec, tsince)¶
Propagate satellite and return GCRF position/velocity.
- Parameters:
- 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:
- 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 (
Union[Array,ndarray,bool,number,bool,int,float,complex,TypedNdArray]) – Julian date (UTC), integer/whole part (scalar jnp.ndarray).fr (
Union[Array,ndarray,bool,number,bool,int,float,complex,TypedNdArray]) – 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:
Batch Convenience Functions¶
- sgp4jax.gcrf_positions(satrec, times_jd)¶
Propagate a single satellite to multiple UTC Julian dates.
- Parameters:
- 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:
- sgp4jax.gcrf_positions_multi(satrec, times_jd)¶
Propagate multiple satellites to multiple UTC Julian dates.
- Parameters:
- 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:
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)