本文整理汇总了Python中tornado.util.ObjectDict.lattice_element_id方法的典型用法代码示例。如果您正苦于以下问题:Python ObjectDict.lattice_element_id方法的具体用法?Python ObjectDict.lattice_element_id怎么用?Python ObjectDict.lattice_element_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tornado.util.ObjectDict
的用法示例。
在下文中一共展示了ObjectDict.lattice_element_id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _form_upload_post
# 需要导入模块: from tornado.util import ObjectDict [as 别名]
# 或者: from tornado.util.ObjectDict import lattice_element_id [as 别名]
#.........这里部分代码省略.........
if p.name == "STEPS":
elem_steps = p.value
break
else:
ctx.errors._global = ("Lattice Element ({}) missing STEPS property"
.format(lattice_element.order))
send_status(400, ctx)
return
if outputMode in [1, 2]:
loop = elem_steps
if elem_itype in [ -2, 4 ]:
# no output for these elements
loop = 0
elif elem_itype < 0:
loop = elem_steps + 1
elif outputMode in [3, 4]:
loop = 0
if elem_itype == -28:
# only output from monitor
loop = 1
elif outputMode in [5, 6]:
loop = 1
for _ in range(loop):
idx += 1
try:
model_element = ObjectDict()
model_element._id = ObjectId()
model_element.order = idx+1
model_element.model_id = ctx.model._id
model_element.lattice_element_id = lattice_element._id
model_element.position = model.getSPosition(idx)
model_element.properties = []
model_element.properties.append(dict(
name="BeamCenterX",
value=model.getOrbit("X", idx),
unit="mm"
))
model_element.properties.append(dict(
name="BeamCenterY",
value=model.getOrbit("Y", idx),
unit="mm"
))
model_element.properties.append(dict(
name="BeamEnergy",
value=model.getEnergy(idx),
unit="eV"
))
model_element.properties.append(dict(
name="BeamMomentumCenterX",
value=model.getBeamMomentumCentroid("X", idx),
unit="rad"
))
model_element.properties.append(dict(
name="BeamMomentumCenterY",
value=model.getBeamMomentumCentroid("Y", idx),
unit="rad"
))
model_element.properties.append(dict(
name="BeamMomentumCenterZ",
value=model.getBeamMomentumCentroid("Z", idx),
unit="MeV"
))