TleObserverLocation#

class m4opt.observer.TleObserverLocation(line1, line2)[source] [edit on github]#

Bases: ObserverLocation

An Earth satellite whose orbit is specified by its two-line element (TLE).

Notes

The orbit propagation is based on the example code at Working with Earth Satellites Using Astropy Coordinates.

Examples

Here is an example TLE for BurstCube (NORAD ID 59562):

>>> from astropy.time import Time
>>> from astropy import units as u
>>> import numpy as np
>>> from m4opt.observer import TleObserverLocation
>>> line1 = '1 59562U 98067WM  24220.55604657  .00200610  00000+0  13802-2 0  9999'
>>> line2 = '2 59562  51.6321  52.1851 0005233 205.4266 154.6476 15.73479335 17375'
>>> orbit = TleObserverLocation(line1, line2)

Evaluate the position and velocity of the satellite at one specific time:

>>> time = Time('2024-08-08 01:10:41')
>>> orbit(time)
<EarthLocation (4172.83539674, -514.29983197, -5254.79814474) km>

Or evaluate at an array of times:

>>> times = time + np.linspace(0 * u.min, 2 * u.min, 50)
>>> orbit(times).shape
(50,)

If any orbit propagation errors occur, then a RuntimeError is raised:

>>> time = Time('2025-01-01 00:00:00')
>>> orbit(time)
Traceback (most recent call last):
  ...
RuntimeError: mrt is less than 1.0 which indicates the satellite has decayed

Create a TLE from the text of its two lines.

Methods Summary

__call__(time)

Get the position and velocity of the satellite.

from_id(norad_id)

Get the latest TLE for a satellite from Celestrak.

Methods Documentation

Parameters:
__call__(time)[source] [edit on github]#

Get the position and velocity of the satellite.

Parameters:

time – The time of the observation.

Returns:

The Earth-relative coordinates of the satellite.

classmethod from_id(norad_id)[source] [edit on github]#

Get the latest TLE for a satellite from Celestrak.

Examples

Look up the latest TLE for the Fermi Gamma-Ray Space Telescope.

>>> from m4opt.observer import TleObserverLocation
>>> tle = TleObserverLocation.from_id(33053)
Parameters:

norad_id (int)

Return type:

TleObserverLocation