Two-Line Element Sets and SGP-4

class satkit.TLE

Bases: object

Two-Line Element Set (TLE) representing a satellite ephemeris

Structure representing a Two-Line Element Set (TLE), a satellite ephemeris format from the 1970s that is still somehow in use today and can be used to calculate satellite position and velocity in the “TEME” frame (not-quite GCRF) using the “Simplified General Perturbations-4” (SGP-4) mathematical model that is also included in this package.

For details, see: https://en.wikipedia.org/wiki/Two-line_element_set

The TLE format is still commonly used to represent satellite ephemerides, and satellite ephemerides catalogs in this format are publicly available at www.space-track.org (registration required)

TLEs sometimes have a “line 0” that includes the name of the satellite

arg_of_perigee

Set the argument of perigee, degrees

bstar

Set the drag of the satellite

eccen

Set the satellite eccentricity

epoch

Set the TLE epoch

static fit_from_states(states, times, epoch)

Perform non-linear least squares fit of TLE parameters to a list of GCRF states

Args:

  • states (list[np.ndarray])

    List of GCRF states to fit to. Each state is a 6-element vector. The first 3 values are positions in meters. The last 3 values are velocities in meters / second

  • times (list[time] | list[datetime.datetime])

    List of times corresponding to the states

  • epoch (time|datetime.datetime)

    Epoch time for the TLE. Must be within range of times

Returns:

  • tuple[TLE, dict]

    Fitted TLE and fitting results in a dictionary

Notes

  • SGP4 propagator is used to match TLE to the states

  • Input GCRF states are rotated into TEME frame used by SGP4

  • First and second derivatives of mean motion are ignored, as they are not

    used by SGP4

  • Non-linear Levenberg-Marquardt optimization is performed to fit the TLE parameters to the provided states.

TLE parameters used in fit include:

  • Inclination

  • Eccentricity

  • Right Ascension of Ascending Node

  • Argument of Perigee

  • Mean Anomaly

  • Mean motion

  • Drag (bstar)

  • Rust crate “rmpfit” is used to perform the optimization

    (https://crates.io/crates/rmpfit)

  • Results dictionary includes the following keys:

    • success : “mpsuccess” value describing result of minimization

    • best_norm: Final chi-squared value

    • orig_norm: Initial chi-squared value

    • n_iter: Number of iterations performed

    • n_fev: Number of function evaluations performed

    • n_par: Total number of parameters being optimized

    • n_free: Number of free parameters

    • n_pegged: Number of pegged parameters

    • n_func: Number of residuals

    • resid: Final residuals

    • xerror: Final parameter uncertainties (1-sigma)

    • covar: Final parameter covariance matrix

static from_file(filename)

Load TLEs from input text file Return a list of TLES loaded from input text file.

If the file contains lines only represent a single TLE, the TLE will be output, rather than a list with a single TLE element

Args:

  • filename (str)

    name of text file lines for TLE(s) to load

Returns:

  • list[TLE] | TLE

    a list of TLE objects or a single TLE of lines for only 1 are passed in

static from_lines(lines)

Return a list of TLES loaded from input list of lines

If the file contains lines only represent a single TLE, the TLE will be output, rather than a list with a single TLE element

Args:

  • lines (list[str])

    list of strings with lines for TLE(s) to load

Returns:

  • list[TLE] | TLE

    a list of TLE objects or a single TLE of lines for only 1 are passed in

inclination

Set the satellite inclination, degrees

mean_anomaly

Set the satellite mean anomaly

mean_motion

Set the satellite mean motion

mean_motion_dot

1/2 of first derivative of mean motion, in revs/day^2

Note

the “1/2” is because that is how number is stored in the TLE

mean_motion_dot_dot

1/6 of 2nd derivative of mean motion, in revs/day^3

Note

The “1/6” is because that is how number is stored in the TLE

name

The name of the satellite

raan

Set the Right Ascension of Ascending Node, in degrees

satnum

Set the satellite number (NORAD ID)

to_2line()

Output as 2 canonical TLE Lines

Returns:

  • list[str]

    2 canonical TLE Lines

to_3line()

Output as 2 canonical TLE lines preceded by a name line (3-line element set)

Returns:

  • list[str]

    3-line element set, name line then 2 canonical TLE lines

static TLE.from_file(filename)

Load TLEs from input text file Return a list of TLES loaded from input text file.

If the file contains lines only represent a single TLE, the TLE will be output, rather than a list with a single TLE element

Args:

  • filename (str)

    name of text file lines for TLE(s) to load

Returns:

  • list[TLE] | TLE

    a list of TLE objects or a single TLE of lines for only 1 are passed in

static TLE.from_lines(lines)

Return a list of TLES loaded from input list of lines

If the file contains lines only represent a single TLE, the TLE will be output, rather than a list with a single TLE element

Args:

  • lines (list[str])

    list of strings with lines for TLE(s) to load

Returns:

  • list[TLE] | TLE

    a list of TLE objects or a single TLE of lines for only 1 are passed in

static TLE.fit_from_states(states, times, epoch)

Perform non-linear least squares fit of TLE parameters to a list of GCRF states

Args:

  • states (list[np.ndarray])

    List of GCRF states to fit to. Each state is a 6-element vector. The first 3 values are positions in meters. The last 3 values are velocities in meters / second

  • times (list[time] | list[datetime.datetime])

    List of times corresponding to the states

  • epoch (time|datetime.datetime)

    Epoch time for the TLE. Must be within range of times

Returns:

  • tuple[TLE, dict]

    Fitted TLE and fitting results in a dictionary

Notes

  • SGP4 propagator is used to match TLE to the states

  • Input GCRF states are rotated into TEME frame used by SGP4

  • First and second derivatives of mean motion are ignored, as they are not

    used by SGP4

  • Non-linear Levenberg-Marquardt optimization is performed to fit the TLE parameters to the provided states.

TLE parameters used in fit include:

  • Inclination

  • Eccentricity

  • Right Ascension of Ascending Node

  • Argument of Perigee

  • Mean Anomaly

  • Mean motion

  • Drag (bstar)

  • Rust crate “rmpfit” is used to perform the optimization

    (https://crates.io/crates/rmpfit)

  • Results dictionary includes the following keys:

    • success : “mpsuccess” value describing result of minimization

    • best_norm: Final chi-squared value

    • orig_norm: Initial chi-squared value

    • n_iter: Number of iterations performed

    • n_fev: Number of function evaluations performed

    • n_par: Total number of parameters being optimized

    • n_free: Number of free parameters

    • n_pegged: Number of pegged parameters

    • n_func: Number of residuals

    • resid: Final residuals

    • xerror: Final parameter uncertainties (1-sigma)

    • covar: Final parameter covariance matrix

TLE.to_2line()

Output as 2 canonical TLE Lines

Returns:

  • list[str]

    2 canonical TLE Lines

TLE.to_3line()

Output as 2 canonical TLE lines preceded by a name line (3-line element set)

Returns:

  • list[str]

    3-line element set, name line then 2 canonical TLE lines

class satkit.sgp4_opsmode

Bases: object

Ops Mode for SGP4 Propagation

afspc = sgp4_opsmode.afspc
improved = sgp4_opsmode.improved
class satkit.sgp4_gravconst

Bases: object

Gravity constant to use for SGP4 propagation

wgs72 = sgp4_gravconst.wgs72
wgs72old = sgp4_gravconst.wgs72old
wgs84 = sgp4_gravconst.wgs84
satkit.sgp4(tle, time, **kwds)

Runs SGP4 propagation for one or more TLE/OMM inputs at one or more times.