66from orbit .core .bunch import BunchTwissAnalysis
77from orbit .lattice import AccLattice
88from orbit .lattice import AccNode
9- from orbit .teapot import TEAPOT_Lattice
9+ from orbit .teapot import teapot
1010from orbit .utils .consts import mass_proton
1111
1212
13- def test_continuous_focusing_linear ():
13+ def test_continuous_linear_focusing ():
14+ coords = []
15+ for i in range (100 ):
16+ x = random .gauss (mu = 0.0 , sigma = 0.010 )
17+ y = random .gauss (mu = 0.0 , sigma = 0.010 )
18+ z = random .gauss (mu = 0.0 , sigma = 1.0 )
19+ xp = random .gauss (mu = 0.0 , sigma = 0.010 )
20+ yp = random .gauss (mu = 0.0 , sigma = 0.010 )
21+ dE = random .gauss (mu = 0.0 , sigma = 0.001 )
22+ coords .append ([x , xp , y , yp , z , dE ])
23+
24+ bunch_init = Bunch ()
25+ bunch_init .mass (mass_proton )
26+ bunch_init .getSyncParticle ().kinEnergy (1.000 )
27+
28+ bunch1 = Bunch ()
29+ bunch2 = Bunch ()
30+ bunch_init .copyBunchTo (bunch1 )
31+ bunch_init .copyBunchTo (bunch2 )
32+
33+ for i in range (100 ):
34+ bunch1 .addParticle (* coords [i ])
35+ bunch2 .addParticle (* coords [i ])
36+
1437 length = 1.0
1538 kq = 0.5
1639
40+ teapot_base .continuousLinear (bunch1 , length , kq )
41+ teapot_base .quad1 (bunch2 , length , kq )
42+
43+ for i in range (bunch_init .getSize ()):
44+ assert bunch1 .x (i ) == bunch2 .x (i )
45+ assert bunch1 .y (i ) == bunch2 .x (i )
46+ assert bunch1 .z (i ) == bunch2 .z (i )
47+ assert bunch1 .xp (i ) == bunch2 .xp (i )
48+ assert bunch1 .yp (i ) == bunch2 .xp (i )
49+ assert bunch1 .dE (i ) == bunch2 .dE (i )
50+
51+
52+ def test_continuous_linear_focusing_node ():
1753 coords = []
1854 for i in range (100 ):
1955 x = random .gauss (mu = 0.0 , sigma = 0.010 )
@@ -37,8 +73,22 @@ def test_continuous_focusing_linear():
3773 bunch1 .addParticle (* coords [i ])
3874 bunch2 .addParticle (* coords [i ])
3975
40- teapot_base .continuousLinear (bunch1 , length , kq )
41- teapot_base .quad1 (bunch2 , length , kq )
76+ length = 1.0
77+ kq = 0.5
78+ nparts = 10
79+
80+ node1 = teapot .ContinuousFocusingTEAPOT ()
81+ node1 .setLength (length )
82+ node1 .setnParts (nparts )
83+ node1 .setParam ("kq" , kq )
84+
85+ node2 = teapot .QuadTEAPOT ()
86+ node2 .setLength (length )
87+ node2 .setnParts (nparts )
88+ node2 .setParam ("kq" , kq )
89+
90+ node1 .trackBunch (bunch1 )
91+ node2 .trackBunch (bunch2 )
4292
4393 for i in range (bunch_init .getSize ()):
4494 assert bunch1 .x (i ) == bunch2 .x (i )
0 commit comments