spherapy

module orbit

Class for orbital data.

This module provides:

Global Variables


class 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:


class Orbit

Timestamped orbital data for a satellite, coordinate system depending on the central body.

Attributes:

method __init__

__init__(data: OrbitAttrDict, calc_astrobodies: bool = False)

The constructor should never be called directly.

Use one of:


classmethod 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:

Returns: satplot.Orbit


classmethod 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:

Returns: satplot.Orbit


classmethod 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:

Returns: satplot.Orbit


classmethod 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:

Returns: satplot.Orbit


classmethod 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:

Returns: satplot.Orbit


method getPosition

getPosition(search_time: datetime | Time)  ndarray[tuple[int], dtype[float64]]

Return the position at the specified or closest time.

Args:

Returns: position

Raises:


method getVelocity

getVelocity(search_time: datetime | Time)  ndarray[tuple[int], dtype[float64]]

Return the velocity at the specified or closest time.

Args:

Returns: velocity

Raises: