本文整理汇总了Python中PyKEP.ic2par方法的典型用法代码示例。如果您正苦于以下问题:Python PyKEP.ic2par方法的具体用法?Python PyKEP.ic2par怎么用?Python PyKEP.ic2par使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyKEP
的用法示例。
在下文中一共展示了PyKEP.ic2par方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_tles
# 需要导入模块: import PyKEP [as 别名]
# 或者: from PyKEP import ic2par [as 别名]
def _create_tles(ep, source, fragments):
res = []
ep_date = (datetime.datetime(2000, 1, 1) + datetime.timedelta(ep)).timetuple()
ep_day = ep_date.tm_yday + ep_date.tm_hour/24. + ep_date.tm_min/24./60. + ep_date.tm_sec/24./60./60.
ep_str = (str(ep_date.tm_year)[2:] + '{:12.8f}'.format(ep_day))[:14]
# TODO change satellite ID and posibly alter international identifier?
line1 = source.line1[:18] + ep_str + source.line1[32:-1]
line1 += str(_checksum(line1))
for fragment in fragments:
r, v = source.eph(ep)
v = np.array(v) + fragment[-3:] # add dV
el = kep.ic2par(r, v, source.mu_central_body)
try:
n = math.sqrt(source.mu_central_body/(4.*math.pi**2*el[0]**3)) * kep.DAY2SEC # mean motion in days
except:
continue
# continue to next fragment
M = el[5] - el[1] * math.sin(el[5])
if M < 0:
M += 2 * math.pi
line2 = source.line2[:8]
line2 += '{:8.4f} '.format(el[2] * kep.RAD2DEG) # inclination (i)
line2 += '{:8.4f} '.format(el[3] * kep.RAD2DEG) # RA (W)
line2 += '{:.7f} '.format(el[1])[2:] # eccentrictiy (e)
line2 += '{:8.4f} '.format(el[4] * kep.RAD2DEG) # argument of perigee (w)
line2 += '{:8.4f} '.format(M * kep.RAD2DEG) # mean anomaly (M)
line2 += '{:11.8f}'.format(n) # mean motion
# line2 += source.line2[63:68] #'{:5d}'.format(1) # revolutions
line2 += '{:5d}'.format(0) # revolutions
line2 += str(_checksum(line2))
# sometimes there is an error 'Eccentricity out of range'
try:
res.append(kep.planet.tle(line1, line2))
except:
pass
return res
示例2: computeSpatialDensities
# 需要导入模块: import PyKEP [as 别名]
# 或者: from PyKEP import ic2par [as 别名]
def computeSpatialDensities(planets):
altStart = 200 # altitude from [km]
step = 20 # size of bins [km]
spaceDens = []
for alt in range(altStart, 2000, step):
noOfPlanInAlt = 0
for i in range(1,len(debris)):
try:
r, v = debris[i].eph(16*365)
except:
continue
el = kep.ic2par(r, v, debris[i].mu_central_body)
altitude = (el[0]-6378000)/1000
if altitude >= alt and altitude < (alt+step):
noOfPlanInAlt += 1
vol1 = (alt+6378)**3 * math.pi * 4 / 3
vol2 = (alt+step+6378)**3 * math.pi * 4 / 3
totVol = vol2-vol1
spaceDens.append(noOfPlanInAlt/totVol)
return spaceDens