本文整理汇总了Python中detector.Detector.voxel方法的典型用法代码示例。如果您正苦于以下问题:Python Detector.voxel方法的具体用法?Python Detector.voxel怎么用?Python Detector.voxel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类detector.Detector
的用法示例。
在下文中一共展示了Detector.voxel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Detector
# 需要导入模块: from detector import Detector [as 别名]
# 或者: from detector.Detector import voxel [as 别名]
),
# Energy has a Gaussian distribution with a mean of 25 MeV and a
# standard deviation of 5 MeV
energy=Energy(
mean=25*MEV,
width=5*MEV,
shape=const.GAUSSIAN
),
# Initial direction is in a cone between 0 and 30 degrees
divergence=30
)
# Define the detector
detector = Detector(
voxels=5,
size=100*MM
)
for _ in range(N):
# Generate a new particle from the beam
particle = Particle(beam)
# We keep tracking as long as we have energy left and the particle
# is within the detector.
while particle.energy > 0 and detector.voxel(particle.position):
particle.propagate(detector)
result = detector.dump()
with open('energy-deposit.json', 'w') as outfile:
outfile.write(json.dumps(result))