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


Python Orbit.ll方法代碼示例

本文整理匯總了Python中galpy.orbit.Orbit.ll方法的典型用法代碼示例。如果您正苦於以下問題:Python Orbit.ll方法的具體用法?Python Orbit.ll怎麽用?Python Orbit.ll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在galpy.orbit.Orbit的用法示例。


在下文中一共展示了Orbit.ll方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: sample_los

# 需要導入模塊: from galpy.orbit import Orbit [as 別名]
# 或者: from galpy.orbit.Orbit import ll [as 別名]
def sample_los(options,args,dfc):
    print "Sampling the LOS ..."
    n= 0
    out= []
    while n < options.nobjects:
        thisos= dfc.sampleLOS(los=options.los,n=options.nobjects-n)
        #add distance uncertainty
        thisout= []
        for o in thisos:
            basico= Orbit([o.R(),o.vR(),o.vT(),0.,0.,o.phi()])#HACK bc ll does not work in 2D currently
            thisd= basico.dist(obs=[1.,0.,0.],ro=1.)
            #Add uncertainty logarithmically, like photometric distance uncertainty TO DO
            thisd+= nu.random.normal()*thisd*options.distuncertainty
            thisout.append(Orbit([basico.ll(obs=[1.,0.,0.],ro=1.)[0],
                                  thisd[0],
                                  basico.pmll(obs=[1.,0.,0.,0.,1.,0.],
                                              ro=1.,vo=1.)[0],
                                  basico.vlos(obs=[1.,0.,0.,0.,1.,0.],
                                              ro=1.,vo=1.)[0]],
                                 lb=True,
                                 solarmotion=[0.,0.,0.],ro=1.,vo=1.))
        ds= nu.array([o.dist(obs=[1.,0.,0.],ro=1.) for o in thisout]).flatten()
        thisos= [thisout[ii] for ii in range(len(thisout)) \
                     if (ds[ii] < options.dmax)]
        out.extend(thisos)
        n+= len(thisos)
    if len(out) > options.nobjects:
        out= out[0:options.nobjects-1]
    #Save
    picklefile= open(args[0],'wb')
    pickle.dump(out,picklefile)
    picklefile.close()
    return None                   
開發者ID:jobovy,項目名稱:apogee-vcirc-2012,代碼行數:35,代碼來源:create_fake_los.py


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