Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
print("sgp4_py: {:.6f} {:.2f}x".format( *tac(baseline, Timer(lambda: sgp4(satold, tsince)).timeit(number = num)) ))
print()
def run_legacy_sgp4(satrec, tsince):
r, v = sgp4(satrec, tsince)
return (satrec.error, satrec.error_message), r, v
line1 = next(lines)
line2 = next(lines)
sat = twoline2rv(line1, line2, wgs72)
sats.append(sat)
sats = sats[:20] # first 20 sats
print(len(sats), 'pure Python sats')
print(len(jd_array), 'and', len(fr_array), 'times')
zipped_times = list(zip(jd_array, fr_array))
for sat in sats:
for jd, fr in zipped_times:
t = (jd - sat.jdsatepoch + fr) * 1440.0
r, v = sgp4(sat, t)
# print(r)
def from_tle(cls, line1, line2, body):
"""Create object by parsing TLE using SGP4."""
# Get state vector at TLE epoch
sat = sgp4.io.twoline2rv(line1, line2, wgs72)
r, v = sgp4.propagation.sgp4(sat, 0)
ref_epoch = time.Time(sat.epoch, scale='utc')
# Convert km to m
r, v = np.array(r) * kilo, np.array(v) * kilo
return cls.from_state_vector(r, v, body=body, ref_epoch=ref_epoch)