Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_legacy_initialized_with_sgp4init():
sat = model.Satellite()
sgp4init(
wgs72, 'i', VANGUARD_ATTRS['satnum'], VANGUARD_EPOCH,
*sgp4init_args(VANGUARD_ATTRS) + (sat,)
)
verify_vanguard_1(sat, legacy=True)
import os
import sys
from distutils.core import setup, Extension
from textwrap import dedent
import sgp4, sgp4.model
description, long_description = sgp4.__doc__.split('\n', 1)
satdoc = dedent(sgp4.model.Satellite.__doc__.split('\n', 1)[1])
long_description = long_description.replace('entry.', 'entry.' + satdoc)
# Force compilation on Travis CI + Python 3 to make sure it keeps working.
optional = True
if sys.version_info[0] != 2 and os.environ.get('TRAVIS') == 'true':
optional = False
# It is hard to write C extensions that support both Python 2 and 3, so
# we opt here to support the acceleration only for Python 3.
ext_modules = []
if sys.version_info[0] == 3:
ext_modules.append(Extension(
'sgp4.vallado_cpp',
optional=optional,
sources=[
'extension/SGP4.cpp',
kep(1x6 numpy array): the osculating keplerian elements at epoch
epoch(float): the epoch
bstar(float): bstar drag coefficient
whichconst(float): gravity model. refer pypi sgp4 documentation
afspc_mode(boolean): refer pypi sgp4 documentation
Returns:
Satellite object: an sgp4 satellite object encapsulating the arguments
"""
deg2rad = np.pi / 180.0; # 0.0174532925199433
xpdotp = 1440.0 / (2.0 * np.pi); # 229.1831180523293
tumin = whichconst.tumin
satrec = Satellite()
satrec.error = 0;
satrec.whichconst = whichconst # Python extension: remembers its consts
satrec.satnum = 0
dt_obj = datetime.utcfromtimestamp(epoch)
t_obj = dt_obj.timetuple()
satrec.epochdays = (t_obj.tm_yday +
t_obj.tm_hour/24 +
t_obj.tm_min/1440 +
t_obj.tm_sec/86400)
satrec.ndot = 0
satrec.nddot = 0
satrec.bstar = bstar
satrec.inclo = kep[2]
satrec.nodeo = kep[4]
kep(1x6 numpy array): the osculating keplerian elements at epoch
epoch(float): the epoch
bstar(float): bstar drag coefficient
whichconst(float): gravity model. refer pypi sgp4 documentation
afspc_mode(boolean): refer pypi sgp4 documentation
Returns:
Satellite object: an sgp4 satellite object encapsulating the arguments
"""
deg2rad = np.pi / 180.0; # 0.0174532925199433
xpdotp = 1440.0 / (2.0 * np.pi); # 229.1831180523293
tumin = whichconst.tumin
satrec = Satellite()
satrec.error = 0;
satrec.whichconst = whichconst # Python extension: remembers its consts
satrec.satnum = 0
dt_obj = datetime.utcfromtimestamp(epoch)
t_obj = dt_obj.timetuple()
satrec.epochdays = (t_obj.tm_yday +
t_obj.tm_hour/24 +
t_obj.tm_min/1440 +
t_obj.tm_sec/86400)
satrec.ndot = 0
satrec.nddot = 0
satrec.bstar = bstar
satrec.inclo = kep[2]
satrec.nodeo = kep[4]