Skip to content

Instantly share code, notes, and snippets.

@ChrisAndre
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChrisAndre/1fcf1b8555af979a4a57 to your computer and use it in GitHub Desktop.
Save ChrisAndre/1fcf1b8555af979a4a57 to your computer and use it in GitHub Desktop.
NaN issue
import PyKEP
import random
import math
r_ang = random.uniform(0, math.pi * 2)
rx = math.cos(r_ang)
ry = math.sin(r_ang)
rz = 0
vx = -math.sin(r_ang)
vy = math.cos(r_ang)
vz = random.uniform(0, 1)
r = [rx, ry, rz] # mag = 1.0
v = [vx, vy, vz] # ~1.4 > mag > 1.0
mu = 1
s = PyKEP.planet.keplerian(PyKEP.epoch(0), r, v, mu, 0, 1, 2)
print 'Elements: %5.5f, %5.5f, %5.5f, %5.5f, %5.5f, %5.5f' % (s.orbital_elements)
print ' -> R(0): %3.3f, %3.3f, %3.3f' % (s.eph(PyKEP.epoch(0))[0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment