How to use the sgp4.api.WGS72 function in sgp4

To help you get started, we’ve selected a few sgp4 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github consensys-space / trusat-orbit / tests / test_profile.py View on Github external
print("find_rms:                    {:.6f} {:.2f}x".format( *tac(baseline, Timer(lambda: find_rms(satnew, rd, ll, odata)).timeit(number = num)) ))
    print("find_rms_old:                {:.6f} {:.2f}x".format( *tac(baseline, Timer(lambda: tsp.find_rms_old(satold, rd, ll, odata)).timeit(number = num)) ))
    print("find_rmspy:                  {:.6f} {:.2f}x".format( *tac(baseline, Timer(lambda: tsp.find_rmspy(satold, rd, ll, odata)).timeit(number = num)) ))
else:
    print("find_rms:                    {:.6f}".format( Timer(lambda: find_rms(satnew, rd, ll, odata)).timeit(number = num)) )

print()
find_rms_inline_baseline = baseline

tsince = (60 + satnew.jdsatepoch) * 1440.0 # time since epoch in minutes
(jd, fr) = divmod(satnew.jdsatepoch,1)
satnew.sgp4(jd, fr)

satrec3 = Satrec()
satrec3_jdsatepoch  = 2451723.28495062
satrec3.sgp4init(WGS72, 'i', satnum, satrec3_jdsatepoch-2433281.5, bstar, 
                ndot, nddot, ecco, argpo, inclo, mo, no_kozai, nodeo)

print("Single element SGP4")
baseline = Timer(lambda: satrec3.sgp4(jd,fr)).timeit(number = num)
print("sgp4_cpp(1):                 {:.6f} {:.2f}x".format( *tac(baseline, Timer(lambda: satrec3.sgp4(jd,fr)).timeit(number = num)) ))
print("sgp4_py:                     {:.6f} {:.2f}x".format( *tac(baseline, Timer(lambda: sgp4(satold, tsince)).timeit(number = num)) ))
print()

print("Vector element SGP4 vs scalar loop of same #")
sats = []
sats.append(satnew)
a = SatrecArray(sats)

for j in range(len(odata)):
    r = np.ndarray((len(a), j+1, 3))
    v = np.ndarray((len(a), j+1, 3))
github brandon-rhodes / python-sgp4 / sgp4 / tests.py View on Github external
def test_satrec_initialized_with_sgp4init_in_afspc_mode():
    sat = Satrec()
    sat.sgp4init(
        WGS72,
        'a',
        VANGUARD_ATTRS['satnum'],
        VANGUARD_EPOCH,
        *sgp4init_args(VANGUARD_ATTRS)
    )
    assertEqual(sat.operationmode, 'a')
github consensys-space / trusat-orbit / tests / test_profile.py View on Github external
satnum   = 5
bstar    = 2.8098e-05
ndot     = 6.96919666594958e-13
nddot    = 0.0
ecco     = 0.1859667
argpo    = 5.790416027488515
inclo    = 0.5980929187319208
mo       = 0.3373093125574321
no_kozai = 0.04722944544077857
nodeo    = 6.08638547138321

sat2 = Satrec()
sat2_jdsatepoch  = 2451723.28495062

sat2.sgp4init(WGS72, 'i', satnum, sat2_jdsatepoch, bstar, ndot, nddot,
              ecco, argpo, inclo, mo, no_kozai, nodeo)


# Vectorized Python-SGP4 array initialization
jd = np.linspace(2451723, 2451723+900, 100)
fr = np.zeros((jd.shape[0],))
rv_template = np.zeros((1, len(jd), 3), dtype='double')

print()
np_zeros_template = np.zeros((1,10,3), dtype='double')
np_empty_template = np.empty((1,10,3), dtype='double')

def tac(baseline, time):
    comp = time / baseline
    return time, comp
github brandon-rhodes / python-sgp4 / sgp4 / tests.py View on Github external
def test_satrec_initialized_with_sgp4init():
    # epochyr and epochdays are not set by sgp4init
    sat = Satrec()
    sat.sgp4init(
        WGS72,
        'i',
        VANGUARD_ATTRS['satnum'],
        VANGUARD_EPOCH,
        *sgp4init_args(VANGUARD_ATTRS)
    )
    verify_vanguard_1(sat)