orbit
Class for orbital data.
This module provides:
OrbitAttrDict
A TypedDict providing type annotations for the Orbit class.
Attributes: name: satcat_id: gen_type: timespan: TLE_epochs: pos: pos_ecef: vel_ecef: vel: lat: lon: sun_pos: moon_pos: alt: eclipse: central_body: period: period_steps: semi_major: ecc: inc: raan: argp:
Orbit
Timestamped orbital data for a satellite, coordinate system depending on the central body.
Attributes:
timespan
: Timespan over which orbit is to be simulatedname
: Name of the satellitesatcat_id
: NORAD satellite catelogue ID (if generated from a TLE)gen_type
: How the orbit was generatedTLE_epochs
: Nx1 numpy array of TLE epoch used for propagation at each timestamp
pos
: Nx3 numpy array of cartesian coordinates of the position of the satellite at each timestamp
vel
: Nx3 numpy array of cartesian velocities of the satellite at each timestamp
pos_ecef
: Nx3 numpy array of cartesian coordinates of the position of the satellite at each timestamp
vel_ecef
: Nx3 numpy array of cartesian velocities of the satellite at each timestamp
lat
: Nx1 numpy array of central body latitudes of the satellite at each timestamp
lon
: Nx1 numpy array of central body longitudes of the satellite at each timestamp
sun_pos
: Nx3 numpy array of cartesian coordinates of the position of the Sun at each timestamp
moon_pos
: Nx3 numpy array of cartesian coordinates of the position of the Moon at each timestamp
alt
: Nx1 numpy array of altitudes above central body at each timestamp
eclipse
: Nx1 numpy array of flag indicating if satellite is eclipsed at each timestampcentral_body
: body the satellite is orbitingperiod
: orbital period in secsperiod_steps
: number of TimeSpan timestamps required to complete an orbitsemi_major
: Nx1 numpy array of orbit semi-major axis calculated at that timestep
ecc
: Nx1 numpy array of orbit eccentricity calculated at that timestep
inc
: Nx1 numpy array of orbit inclination calculated at that timestep
raan
: Nx1 numpy array of orbit RAAN calculated at that timestep
argp
: Nx1 numpy array of orbit Arg Perigee calculated at that timestep
__init__
__init__(data: OrbitAttrDict, calc_astrobodies: bool = False)
The constructor should never be called directly.
Use one of:
fromAnalyticalOrbitalParam
fromAnalyticalOrbitalParam(
timespan: TimeSpan,
body: str = 'Earth',
a: float = 6978,
ecc: float = 0,
inc: float = 0,
raan: float = 0,
argp: float = 0,
mean_nu: float = 0,
name: str = 'Analytical',
astrobodies: bool = True,
unsafe: bool = False
) → Orbit
Create an analytical orbit defined by orbital parameters.
Orbits created using this class method will NOT respect gravity corrections such as J4, and as such sun-synchronous orbit are not possible.
Args:
timespan
: Timespan over which orbit is to be simulatedbody
: [Optional] string indicating around what body the satellite orbits, Default is ‘Earth’ Options are [‘Earth’,’Sun’,’Mars’,’Moon’]a
: [Optional] semi-major axis of the orbit in km Default is 6978 ~ 600km above the earth.ecc
: [Optional] eccentricty, dimensionless number 0 < ecc < 1 Default is 0, which is a circular orbitinc
: [Optional] inclination of orbit in degrees Default is 0, which represents an orbit around the Earth’s equatorraan
: [Optional] right-ascension of the ascending node Default is 0argp
: [Optional] argument of the perigee in degrees Default is 0, which represents an orbit with its semimajor axis in the plane of the Earth’s equatormean_nu
: [Optional] mean anomaly in degrees Default is 0, which represents an orbit that is beginning at periapsisname
: [Optional] string giving the name of the orbit Default is ‘Analytical’astrobodies
: [Optional] Flag to calculate Sun and Moon positions at timestamps Default is Falseunsafe
: [Optional] Flag to ignore semi-major axis inside Earth’s radius Default is FalseReturns: satplot.Orbit
fromDummyConstantPosition
fromDummyConstantPosition(
timespan: TimeSpan,
pos: tuple[float, float, float] | ndarray[tuple[int], dtype[float64]],
sun_pos: tuple[float, float, float] | ndarray[tuple[int], dtype[float64]] | None = None,
moon_pos: tuple[float, float, float] | ndarray[tuple[int], dtype[float64]] | None = None
) → Orbit
Creates a static orbit for testing.
Satellite position is defined by pos, while sun and moon positions are optional, but can also be specified.
Args:
timespan
: Timespan over which orbit is to be simulatedpos
: Nx3 numpy array of cartesian coordinates of the position of the satellite at each timestamp
sun_pos
: [Optional] Nx3 numpy array of cartesian coordinates of the position of the Sun at each timestamp
moon_pos
: [Optional] Nx3 numpy array of cartesian coordinates of the position of the Moon at each timestamp
Returns: satplot.Orbit
fromListOfPositions
fromListOfPositions(
timespan: TimeSpan,
positions: ndarray[tuple[int, int], dtype[float64]],
astrobodies: bool = False
) → Orbit
Create an orbit from a list of positions.
Creat an obit by explicitly specifying the position of the satellite at each point in time. Useful for simplified test cases; but may lead to unphysical orbits.
Args:
timespan
: Timespan over which orbit is to be simulatedpositions
: Nx3 numpy array of cartesian coordinates of the position of the satellite at each timestamp
astrobodies
: [Optional] Flag to calculate Sun and Moon positions at timestamps Default is FalseReturns: satplot.Orbit
fromPropagatedOrbitalParam
fromPropagatedOrbitalParam(
timespan: TimeSpan,
a: float = 6978,
ecc: float = 0,
inc: float = 0,
raan: float = 0,
argp: float = 0,
mean_nu: float = 0,
name: str = 'Fake TLE',
astrobodies: bool = True,
unsafe: bool = False
) → Orbit
Create an orbit from orbital parameters, propagated using sgp4.
Orbits created using this class method will respect gravity corrections such as J4, allowing for semi-analytical sun-synchronous orbits.
Args:
timespan
: Timespan over which orbit is to be simulateda
: [Optional] semi-major axis of the orbit in km Default is 6978 ~ 600km above the earth.ecc
: [Optional] eccentricty, dimensionless number 0 < ecc < 1 Default is 0, which is a circular orbitinc
: [Optional] inclination of orbit in degrees Default is 0, which represents an orbit around the Earth’s equatorraan
: [Optional] right-ascension of the ascending node Default is 0argp
: [Optional] argument of the perigee in degrees Default is 0, which represents an orbit with its semimajor axis in the plane of the Earth’s equatormean_nu
: [Optional] mean anomaly in degrees Default is 0, which represents an orbit that is beginning at periapsisname
: [Optional] string giving the name of the orbit Default is ‘Fake TLE’astrobodies
: [Optional] Flag to calculate Sun and Moon positions at timestamps Default is Falseunsafe
: [Optional] Flag to ignore semi-major axis inside Earth’s radius Default is FalseReturns: satplot.Orbit
fromTLE
fromTLE(
timespan: TimeSpan,
tle_path: Path,
astrobodies: bool = True,
unsafe: bool = False
) → Orbit
Create an orbit from an existing TLE or a list of historical TLEs.
Args:
timespan
: TimeSpan over which orbit is to be simulatedtle_path
: path to file containing TLEs for a satelliteastrobodies
: [Optional] Flag to calculate Sun and Moon positions at timestamps Default is Falseunsafe
: [Optional] Flag to ignore TLE usage more than 14 days either side of timestamps Optional Default is FalseReturns: satplot.Orbit
getPosition
getPosition(search_time: datetime | Time) → ndarray[tuple[int], dtype[float64]]
Return the position at the specified or closest time.
Args:
search_time
: the timestamp to search forReturns: position
Raises:
ValueError
: orbit has no pos datagetVelocity
getVelocity(search_time: datetime | Time) → ndarray[tuple[int], dtype[float64]]
Return the velocity at the specified or closest time.
Args:
search_time
: the timestamp to search forReturns: velocity
Raises:
ValueError
: orbit has no vel data