本文整理匯總了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