Exemplo n.º 1
0
kick_leastsq = find.find_kicks(method="LeastSq")

kick = kick_leastsq
nodes = lattice.getNodes()
for node in nodes:
	if node.getName() == "S11MB1":
		node.setParam("kx",kick[0])
	if node.getName() == "S12MB2":
		node.setParam("kx",kick[1])
	if node.getName() == "S01MB3":
		node.setParam("kx",kick[2])
	if node.getName() == "S03MB4":
		node.setParam("kx",kick[3])


OrbitX, OrbitY = orbit(lattice,bunch).get_orbit()
x = []
y = []
s = []
for i in xrange(len(OrbitX)):
	s.append(OrbitX[i][0])
	x.append(OrbitX[i][1]*1e3)
	y.append(OrbitX[i][2]*1e3)
	
	
# matplotlib parameter
rc('text', usetex=False) 
rc('font', family='serif')
rc('font', size=18)
rc('axes', linewidth=2)
rc('lines', linewidth=3)
Exemplo n.º 2
0
	if node.getName() == "S11MB1":
		node.setParam("kx",kick[0])
	if node.getName() == "S12MB2":
		node.setParam("kx",kick[1])
	if node.getName() == "S01MB3":
		node.setParam("kx",kick[2])
	if node.getName() == "S03MB4":
		node.setParam("kx",kick[3])

if case == "inj":
	pos = [xc0,xcs0,0.0,0.0]  # for SIS18 lattice
if case =="mid":
	pos = [0.0,0.0,0.0,0.0]  # for SIS18_MID lattice
from orbit.orbit_correction import orbit, correction   

OrbitX, OrbitY = orbit(lattice,bunch).get_orbit()
x = []
y = []
s = []
for i in xrange(len(OrbitX)):
	s.append(OrbitX[i][0])
	x.append(OrbitX[i][1]*1e3)
	y.append(OrbitX[i][2]*1e3)
	

from matplotlib.font_manager import FontProperties

rc('font', **{'family': 'serif', 'serif': ['Times']})
rc('text', usetex=True)
rc('axes', linewidth=3)
rc('figure', figsize=(12,10))
Exemplo n.º 3
0
# get lattice function from transfer matrices
matrix_lattice = TEAPOT_MATRIX_Lattice(teapot_latt, b)
(muX, arrPosAlphaX, arrPosBetaX) = matrix_lattice.getRingTwissDataX()
(muY, arrPosAlphaY, arrPosBetaY) = matrix_lattice.getRingTwissDataY()
#----------------------------------Bunch-Distribusion------------------------------------------------
# machted beam

emittance_x, emittance_y = 35 * 10**(-6), 15 * 10**(-6)
twissX = TwissContainer(arrPosAlphaX[0][1], arrPosBetaX[0][1], emittance_x)
twissY = TwissContainer(arrPosAlphaY[0][1], arrPosBetaY[0][1], emittance_y)

#twissZ = TwissContainer(alpha = 0., beta = 1., emittance = 10**(-6)) # not matched

#---------------------------------------------CALCULATE ORBIT------------------------------
OrbitX, OrbitY = orbit(teapot_latt, b).get_orbit()

x0, px0 = OrbitX[0][1], OrbitX[0][2]
y0, py0 = OrbitY[0][1], OrbitY[0][2]
print('Closed x-orbit at s_0 ({},{})'.format(x0, px0))
#---------------------------------------------------------------------------------------------------
#x0 = 0.001

n = 10**(2)  # num of particles
#dist = KVDist3D(twissX,twissY,twissZ)
dist = KVDist2D(twissX, twissY)
for i in range(n):
    xi, pxi, yi, pyi = dist.getCoordinates()
    b.addParticle(x0 + xi, px0 + pxi, y0 + yi, py0 + pyi, 0, 0)
#    xi,pxi,yi,pyi,z,zp = dist.getCoordinates()
#    b.addParticle(x0+xi,px0+pxi,y0+yi,py0+pyi,z,zp)
Exemplo n.º 4
0
paramsDict["maximum"]        = 0.5
paramsDict["minimum"]       = 0.0
paramsDict["dx"]       = 0.005
paramsDict["dy"]       = 0.007

setDict["elementtype"] = "quad"
setDict["ringline"] = "ring"

ESet  = AddErrorSet(lattice, positioni, positionf, setDict, paramsDict, seed_value=50)
# ESet  = AddErrorSet(lattice, positioni, positionf, setDict, paramsDict) # Random
#---------------------------------------------ORBIT ERRORS-------------------------------------------


print "CALCULATE DISTORTED ORBIT AND PLOT"
#---------------------------------------------CALCULATE DISTORTED ORBIT------------------------------
OrbitX, OrbitY = orbit(lattice,b).get_orbit()
#---------------------------------------------CALCULATE DISTORTED ORBIT------------------------------

#---------------------------------------------PLOT DISTORTED ORBIT-----------------------------------
x = []
y = []
s = []
for i in xrange(len(OrbitX)):
	s.append(OrbitX[i][0])
	x.append(OrbitX[i][1])
	y.append(OrbitY[i][1])

plot(s,x,'r-', label="x")
plot(s,y,'b-', label="y")
#---------------------------------------------PLOT DISTORTED ORBIT-----------------------------------