You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A hypothetical SGP4 propagator that conforms to a Propagator interface.
fromcopyimportcopyfromsgp4.ioimporttwoline2rvfromsgp4.propagationimportsgp4from .baseimportPropagatorfrom ..bodiesimportearth, wgs72from ..somewhereimportStateclassSGP4(Propagator):
"""Adapter class for sgp4 module, which uses the C++ API"""def__init__(self, tle, gravity_model=wgs72):
ifgravity_model._sgp4_constantsisNone:
raiseTypeError(
'gravity_model._sgp4_constants must be an sgp4.earth_gravity.''EarthGravity instance for use with the sgp4 module.')
self.tle=tleself.gravity_model=gravity_modelself._satellite=twoline2rv(
tle.line1, tle.line2, gravity_model._sgp4_constants)
defpropagate_to(self, time):
minutes= (time.jd-self._satellite.jdsatepoch) *1440r, v=sgp4(self._satellite, minutes)
body=earth# If we're using a different ellipsoid than `earth`, create a# new CelestialBody with our ellipsoid.ifbody.ellipsoidisnotearth.ellipsoid:
body=copy(earth)
body._ellipsoid=self.gravity_modelreturnState(r, v, body=body)