Skip to content

Commit 2cc7802

Browse files
committed
prepared for merging with master
1 parent 0b0f64d commit 2cc7802

39 files changed

+925
-1044
lines changed

demos/ebeam/da_mpi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
cell = (D1, Q1, D2, Q2, D3, Q3, D4, B, D5, SD, D5, SF, D6, Q4, D6, SF, D5, SD,D5, B, D4, Q3, D3, Q2, D2, Q1, D1)
3636
ring = cell
37-
method = {"Sextupole": KickTM}
37+
method = {Sextupole: KickTM}
3838
lat = MagneticLattice(ring, method=method)
3939

4040

demos/ebeam/dba_match.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import matplotlib.pyplot as plt
2+
13
from ocelot.gui import *
24
from ocelot import *
35
from pylab import *
@@ -54,7 +56,7 @@
5456
#vars = [q1,q2,q3]
5557

5658

57-
match(lat, constr, vars, tw0)
59+
match(lat, constr, vars, tw0, max_iter=5000)
5860

5961

6062
tws=twiss(lat, tw0, nPoints = 1000)
@@ -64,7 +66,7 @@
6466
ax = f.add_subplot(211)
6567
ax.set_xlim(0, lat.totalLen)
6668

67-
f.canvas.set_window_title('Betas [m]')
69+
plt.title('Betas [m]')
6870
p1, = plt.plot(s, [p.beta_x for p in tws], lw=2.0)
6971
p2, = plt.plot(s, [p.beta_y for p in tws], lw=2.0)
7072
plt.grid(True)

demos/ebeam/dba_track_ellipse.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
__author__ = 'Sergey Tomin'
22

33

4-
from pylab import *
4+
import matplotlib.pyplot as plt
55
from ocelot import *
66
from ocelot.cpbd.optics import *
77
from ocelot.cpbd.transformations.second_order import SecondTM
@@ -30,30 +30,30 @@
3030
lat = MagneticLattice(cell, method=method)
3131

3232

33-
t = linspace(0, 2*pi, num = 100)
34-
x, xp = 0.1*cos(t), 0.1*sin(t)
33+
t = np.linspace(0, 2*pi, num = 100)
34+
x, xp = 0.1*np.cos(t), 0.1*np.sin(t)
3535
plist = []
3636
for xi, xpi in zip(x, xp):
3737
plist.append(Particle(x=xi, px=xpi))
3838

3939

40-
plot(x, xp)
40+
plt.plot(x, xp)
4141
navi = Navigator(lat)
4242
dz = 10.
4343
tracking_step(lat, plist, dz=dz, navi=navi)
4444

4545

4646
x2 = [f.x for f in plist] #map(lambda f: f.x, plist)
4747
xp2 = [f.px for f in plist] #map(lambda f: f.px, plist)
48-
suptitle("Tracking with sextupoles")
49-
subplot(121)
48+
plt.suptitle("Tracking with sextupoles")
49+
plt.subplot(121)
5050
plt.title("S = 0 m")
5151
plt.plot(x, xp, "r.-", label = "X")
5252
plt.xlabel("X, m")
5353
plt.ylabel("Xp, rad")
5454
plt.grid(True)
5555

56-
subplot(122)
56+
plt.subplot(122)
5757
plt.title("S = 10 m")
5858
plt.plot(x2, xp2, "r.-", label = "X")
5959
#plt.legend()
@@ -68,13 +68,13 @@
6868
element.k2 = 0.
6969
lat.update_transfer_maps()
7070

71-
t = linspace(0, 2*pi, num = 100)
72-
x, xp = 0.1*cos(t), 0.1*sin(t)
71+
t = np.linspace(0, 2*pi, num = 100)
72+
x, xp = 0.1*np.cos(t), 0.1*np.sin(t)
7373
plist = []
7474
for xi, xpi in zip(x,xp):
7575
plist.append(Particle(x = xi, px= xpi))
7676

77-
plot(x, xp)
77+
plt.plot(x, xp)
7878
navi = Navigator(lat)
7979
dz = 10.
8080
tracking_step(lat, plist, dz = dz, navi = navi)
@@ -85,15 +85,15 @@
8585
plt.plot(x, xp, "r.-", label = "X")
8686

8787

88-
suptitle("Tracking without sextupoles")
89-
subplot(121)
88+
plt.suptitle("Tracking without sextupoles")
89+
plt.subplot(121)
9090
plt.title("S = 0 m")
9191
plt.plot(x, xp, "r.-", label = "X")
9292
plt.xlabel("X, m")
9393
plt.ylabel("Xp, rad")
9494
plt.grid(True)
9595

96-
subplot(122)
96+
plt.subplot(122)
9797
plt.title("S = 10 m")
9898
plt.plot(x2, xp2, "r.-", label = "X")
9999
#plt.legend()

demos/ebeam/rf_twiss.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import matplotlib.pyplot as plt
2+
13
from ocelot import *
24
from ocelot.gui import *
35
import numpy as np
@@ -67,7 +69,7 @@
6769
ax = f.add_subplot(211)
6870
ax.set_xlim(0, lat.totalLen)
6971

70-
f.canvas.set_window_title('Betas [m]')
72+
plt.title('Betas [m]')
7173
s = [p.s for p in tws]
7274
p1, = plt.plot(s, [p.beta_x for p in tws], lw=2.0)
7375
p2, = plt.plot(s, [p.beta_y for p in tws], lw=2.0)

demos/ebeam/twiss_sase3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def delta_e(delta_length, total_length):
7979
ax = f.add_subplot(211)
8080
ax.set_xlim(0, lat.totalLen)
8181

82-
f.canvas.set_window_title('Betas [m]')
82+
plt.title('Betas [m]')
8383
s = [p.s for p in tws]
8484
p1, = plt.plot(s, [p.beta_x for p in tws], lw=2.0)
8585
p2, = plt.plot(s, [p.beta_y for p in tws], lw=2.0)

demos/ipython_tutorials/1_introduction.ipynb

Lines changed: 49 additions & 64 deletions
Large diffs are not rendered by default.

demos/ipython_tutorials/2_tracking.ipynb

Lines changed: 39 additions & 64 deletions
Large diffs are not rendered by default.

demos/ipython_tutorials/3_space_charge.ipynb

Lines changed: 23 additions & 42 deletions
Large diffs are not rendered by default.

demos/ipython_tutorials/4_wake.ipynb

Lines changed: 39 additions & 77 deletions
Large diffs are not rendered by default.

demos/ipython_tutorials/5_CSR.ipynb

Lines changed: 15 additions & 30 deletions
Large diffs are not rendered by default.

demos/ipython_tutorials/6_coupler_kick.ipynb

Lines changed: 18 additions & 28 deletions
Large diffs are not rendered by default.

demos/ipython_tutorials/7_lattice_design.ipynb

Lines changed: 22 additions & 34 deletions
Large diffs are not rendered by default.

demos/ipython_tutorials/8_laser_heater.ipynb

Lines changed: 13 additions & 19 deletions
Large diffs are not rendered by default.

demos/ipython_tutorials/9_thz_source.ipynb

Lines changed: 100 additions & 41 deletions
Large diffs are not rendered by default.

demos/ipython_tutorials/R_matrices.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2871,7 +2871,7 @@
28712871
],
28722872
"metadata": {
28732873
"kernelspec": {
2874-
"display_name": "Python 3",
2874+
"display_name": "Python 3 (ipykernel)",
28752875
"language": "python",
28762876
"name": "python3"
28772877
},
@@ -2885,7 +2885,7 @@
28852885
"name": "python",
28862886
"nbconvert_exporter": "python",
28872887
"pygments_lexer": "ipython3",
2888-
"version": "3.8.8"
2888+
"version": "3.9.15"
28892889
}
28902890
},
28912891
"nbformat": 4,

demos/ipython_tutorials/accelerator_optim.ipynb

Lines changed: 103 additions & 77 deletions
Large diffs are not rendered by default.

demos/ipython_tutorials/parameter-scanner.ipynb

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,25 @@
2222
},
2323
{
2424
"cell_type": "code",
25-
"execution_count": 73,
25+
"execution_count": 1,
2626
"id": "18e9cd9b",
2727
"metadata": {},
28-
"outputs": [],
28+
"outputs": [
29+
{
30+
"ename": "ModuleNotFoundError",
31+
"evalue": "No module named 'chicane'",
32+
"output_type": "error",
33+
"traceback": [
34+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
35+
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
36+
"\u001b[0;32m/var/folders/cc/dy7fm0252g93vyzv0sjtvkbw0000gn/T/ipykernel_9162/441098987.py\u001b[0m in \u001b[0;36m<cell line: 5>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mnumpy\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mmatplotlib\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpyplot\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mplt\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mchicane\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mzeuthen\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mzeuthen_beam\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mocelot\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
37+
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'chicane'"
38+
]
39+
}
40+
],
2941
"source": [
42+
"import sys\n",
43+
"sys.path.append(\"/Users/tomins/Nextcloud/DESY/repository/ocelot\")\n",
3044
"import numpy as np\n",
3145
"import matplotlib.pyplot as plt\n",
3246
"from chicane import zeuthen, zeuthen_beam\n",
@@ -676,7 +690,7 @@
676690
"name": "python",
677691
"nbconvert_exporter": "python",
678692
"pygments_lexer": "ipython3",
679-
"version": "3.10.4"
693+
"version": "3.9.15"
680694
}
681695
},
682696
"nbformat": 4,

0 commit comments

Comments
 (0)