本文整理汇总了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