コード例 #1
0
ymax = ycenterpos + 0.100

#=================Add the injection node and foil node==  ==============

nparts = macrosperturn
injectparams = (xmin, xmax, ymin, ymax)
injectnode = TeapotInjectionNode(nparts, b, lostbunch, injectparams, xFunc,
                                 yFunc, lFunc, nmaxmacroparticles,
                                 injectturninterval)
addTeapotInjectionNode(teapot_latt, 0., injectnode)

thick = 400.0
foil = TeapotFoilNode(xmin, xmax, ymin, ymax, thick, "Foil 1")
scatterchoice = 0
foil.setScatterChoice(scatterchoice)
addTeapotFoilNode(teapot_latt, 0.000001, foil)

#----------------------------------------------
# Add one black absorber collimator to act like
# an aperture
#----------------------------------------------
colllength = 0.00001
ma = 9
density_fac = 1.0
shape = 1
radius = 0.110

collimator = TeapotCollimatorNode(colllength, ma, density_fac, shape, radius,
                                  0., 0., 0., 0., "Collimator 1")
addTeapotCollimatorNode(teapot_latt, 0.5, collimator)
コード例 #2
0
for node in teapot_latt.getNodes():
	(node_pos_start,node_pos_stop) = teapot_latt.getNodePositionsDict()[node]
	if(node_pos_start > pos_start and node_pos_stop < pos_stop):
		print "node=",node.getName()," type=",node.getType(),"  pos=",node_pos_start," L=",node.getLength()


xmin = -0.100
xmax = 0.100
ymin = -0.100
ymax = 0.100
# Below is 1000 times the width of normal foil but will do only one turn.
thick = 400000

foil = TeapotFoilNode(xmin, xmax, ymin, ymax, thick, "Foil 1")

addTeapotFoilNode(teapot_latt, 18.5,foil) 
print "===========Lattice modified ======================================="
print "New Lattice=",teapot_latt.getName()," length [m] =",teapot_latt.getLength()," nodes=",len(teapot_latt.getNodes())

n_drifts = 0
drift_length = 0.
for node in teapot_latt.getNodes():
	if(isinstance(node,DriftTEAPOT)):
		n_drifts += 1
		drift_length += node.getLength()
		
print "number of drifts =",n_drifts
print "total drift length =",drift_length

print "============= nodes inside the region ==========="
# print all nodes around the specified position
コード例 #3
0
ファイル: snsring.py プロジェクト: luxiaohan/py-orbit-code
xmax = xcenterpos + 0.0085
ymin = ycenterpos - 0.0080
ymax = ycenterpos + 0.100

#=================Add the injection node and foil node==  ==============

nparts = macrosperturn
injectparams = (xmin, xmax, ymin, ymax)
injectnode = TeapotInjectionNode(nparts, b, lostbunch, injectparams, xFunc, yFunc, lFunc)
addTeapotInjectionNode(teapot_latt, 0., injectnode) 

thick = 400.0
foil = TeapotFoilNode(xmin, xmax, ymin, ymax, thick, "Foil 1")
scatterchoice = 0
foil.setScatterChoice(scatterchoice)
addTeapotFoilNode(teapot_latt,0.000001,foil)

#----------------------------------------------
# Add one black absorber collimator to act like
# an aperture
#----------------------------------------------
colllength = 0.00001
ma = 9
density_fac = 1.0
shape = 1
radius = 0.110

collimator = TeapotCollimatorNode(colllength, ma, density_fac, shape, radius, 0., 0., 0., 0., "Collimator 1")
addTeapotColimatorNode(teapot_latt, 0.5, collimator)

#-----------------------------
コード例 #4
0
for node in teapot_latt.getNodes():
    (node_pos_start, node_pos_stop) = teapot_latt.getNodePositionsDict()[node]
    if (node_pos_start > pos_start and node_pos_stop < pos_stop):
        print "node=", node.getName(), " type=", node.getType(
        ), "  pos=", node_pos_start, " L=", node.getLength()

xmin = -0.100
xmax = 0.100
ymin = -0.100
ymax = 0.100
# Below is 1000 times the width of normal foil but will do only one turn.
thick = 400000

foil = TeapotFoilNode(xmin, xmax, ymin, ymax, thick, "Foil 1")

addTeapotFoilNode(teapot_latt, 18.5, foil)
print "===========Lattice modified ======================================="
print "New Lattice=", teapot_latt.getName(
), " length [m] =", teapot_latt.getLength(), " nodes=", len(
    teapot_latt.getNodes())

n_drifts = 0
drift_length = 0.
for node in teapot_latt.getNodes():
    if (isinstance(node, DriftTEAPOT)):
        n_drifts += 1
        drift_length += node.getLength()

print "number of drifts =", n_drifts
print "total drift length =", drift_length