當前位置: 首頁>>代碼示例>>Python>>正文


Python PyKEP.ic2par方法代碼示例

本文整理匯總了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
開發者ID:esa,項目名稱:Space_debris_removal_model,代碼行數:48,代碼來源:breakup.py

示例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
開發者ID:esa,項目名稱:Space_debris_removal_model,代碼行數:22,代碼來源:cube_2agents.py


注:本文中的PyKEP.ic2par方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。