Skip to content

Commit

Permalink
Merge branch 'development' into dashboard/terminal_view
Browse files Browse the repository at this point in the history
  • Loading branch information
proy30 committed Sep 27, 2024
2 parents fc31fd4 + 2751795 commit 58adf4f
Show file tree
Hide file tree
Showing 98 changed files with 1,608 additions and 957 deletions.
75 changes: 50 additions & 25 deletions docs/source/usage/python.rst

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions examples/achromatic_spectrometer/run_spectrometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@

# drifts appearing the drift-kick sequence
ds_half = ds / 2.0
dr = elements.Drift(ds=ds_half, nslice=ns)
dr = elements.Drift(name="dr", ds=ds_half, nslice=ns)

# define the lens segments
thick_lens = []
for _ in range(0, num_lenses):
pl = elements.TaperedPL(k=dk, taper=dtaper, unit=0)
pl = elements.TaperedPL(name="pl", k=dk, taper=dtaper, unit=0)
segment = [dr, pl, dr]
thick_lens.extend(segment)

bend = elements.ExactSbend(ds=1.0, phi=10.0, B=0.0, nslice=ns)
drift = elements.Drift(ds=1.0, nslice=ns)
bend = elements.ExactSbend(name="bend", ds=1.0, phi=10.0, B=0.0, nslice=ns)
drift = elements.Drift(name="drift", ds=1.0, nslice=ns)

# specify the lattice sequence
sim.lattice.append(monitor)
Expand Down
6 changes: 4 additions & 2 deletions examples/aperture/run_aperture.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@
sim.lattice.extend(
[
monitor,
elements.Drift(0.123),
elements.Aperture(xmax=1.0e-3, ymax=1.5e-3, shape="rectangular"),
elements.Drift(name="drift", ds=0.123),
elements.Aperture(
name="collimator", xmax=1.0e-3, ymax=1.5e-3, shape="rectangular"
),
monitor,
]
)
Expand Down
20 changes: 10 additions & 10 deletions examples/apochromatic/run_apochromatic.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@
ns = 25 # number of slices per ds in the element

# Drift elements
dr1 = elements.ChrDrift(ds=1.0, nslice=ns)
dr2 = elements.ChrDrift(ds=10.0, nslice=ns)
dr1 = elements.ChrDrift(name="dr1", ds=1.0, nslice=ns)
dr2 = elements.ChrDrift(name="dr2", ds=10.0, nslice=ns)

# Quad elements
q1 = elements.ChrQuad(ds=1.2258333333, k=0.5884, nslice=ns)
q2 = elements.ChrQuad(ds=1.5677083333, k=-0.7525, nslice=ns)
q3 = elements.ChrQuad(ds=1.205625, k=0.5787, nslice=ns)
q4 = elements.ChrQuad(ds=1.2502083333, k=-0.6001, nslice=ns)
q5 = elements.ChrQuad(ds=1.2502083333, k=0.6001, nslice=ns)
q6 = elements.ChrQuad(ds=1.205625, k=-0.5787, nslice=ns)
q7 = elements.ChrQuad(ds=1.5677083333, k=0.7525, nslice=ns)
q8 = elements.ChrQuad(ds=1.2258333333, k=-0.5884, nslice=ns)
q1 = elements.ChrQuad(name="q1", ds=1.2258333333, k=0.5884, nslice=ns)
q2 = elements.ChrQuad(name="q2", ds=1.5677083333, k=-0.7525, nslice=ns)
q3 = elements.ChrQuad(name="q3", ds=1.205625, k=0.5787, nslice=ns)
q4 = elements.ChrQuad(name="q4", ds=1.2502083333, k=-0.6001, nslice=ns)
q5 = elements.ChrQuad(name="q5", ds=1.2502083333, k=0.6001, nslice=ns)
q6 = elements.ChrQuad(name="q6", ds=1.205625, k=-0.5787, nslice=ns)
q7 = elements.ChrQuad(name="q7", ds=1.5677083333, k=0.7525, nslice=ns)
q8 = elements.ChrQuad(name="q8", ds=1.2258333333, k=-0.5884, nslice=ns)

lattice_line = [monitor, dr1, q1, q2, q3, dr2, q4, q5, dr2, q6, q7, q8, dr1, monitor]

Expand Down
32 changes: 16 additions & 16 deletions examples/apochromatic/run_apochromatic_pl.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,39 +50,39 @@
ns = 25 # number of slices per ds in the element

# Drift elements
dr1 = elements.ChrDrift(ds=1.0, nslice=ns)
dr2 = elements.ChrDrift(ds=2.0, nslice=ns)
dr1 = elements.ChrDrift(name="dr1", ds=1.0, nslice=ns)
dr2 = elements.ChrDrift(name="dr2", ds=2.0, nslice=ns)

# Plasma lens elements
q1 = elements.ChrPlasmaLens(
ds=0.331817852986604588, k=996.147787384348956, unit=1, nslice=ns
name="q1", ds=0.331817852986604588, k=996.147787384348956, unit=1, nslice=ns
)
q2 = elements.ChrPlasmaLens(
ds=0.176038957633108457, k=528.485181135649785, unit=1, nslice=ns
name="q2", ds=0.176038957633108457, k=528.485181135649785, unit=1, nslice=ns
)
q3 = elements.ChrPlasmaLens(
ds=1.041842576046930486, k=3127.707468391874166, unit=1, nslice=ns
name="q3", ds=1.041842576046930486, k=3127.707468391874166, unit=1, nslice=ns
)
q4 = elements.ChrPlasmaLens(
ds=0.334367090894399520, k=501.900417308233112, unit=1, nslice=ns
name="q4", ds=0.334367090894399520, k=501.900417308233112, unit=1, nslice=ns
)
q5 = elements.ChrPlasmaLens(
ds=1.041842576046930486, k=3127.707468391874166, unit=1, nslice=ns
name="q5", ds=1.041842576046930486, k=3127.707468391874166, unit=1, nslice=ns
)
q6 = elements.ChrPlasmaLens(
ds=0.176038957633108457, k=528.485181135649785, unit=1, nslice=ns
name="q6", ds=0.176038957633108457, k=528.485181135649785, unit=1, nslice=ns
)
q7 = elements.ChrPlasmaLens(
ds=0.331817852986604588, k=996.147787384348956, unit=1, nslice=ns
name="q7", ds=0.331817852986604588, k=996.147787384348956, unit=1, nslice=ns
)

# q1 = elements.ChrPlasmaLens(ds=0.331817852986604588, k=2.98636067687944129, unit=0, nslice=ns)
# q2 = elements.ChrPlasmaLens(ds=0.176038957633108457, k=1.584350618697976110, unit=0, nslice=ns)
# q3 = elements.ChrPlasmaLens(ds=1.041842576046930486, k=9.37658318442237437, unit=0, nslice=ns)
# q4 = elements.ChrPlasmaLens(ds=0.334367090894399520, k=1.50465190902479784, unit=0, nslice=ns)
# q5 = elements.ChrPlasmaLens(ds=1.041842576046930486, k=9.37658318442237437, unit=0, nslice=ns)
# q6 = elements.ChrPlasmaLens(ds=0.176038957633108457, k=1.584350618697976110, unit=0, nslice=ns)
# q7 = elements.ChrPlasmaLens(ds=0.331817852986604588, k=2.98636067687944129, unit=0, nslice=ns)
# q1 = elements.ChrPlasmaLens(name="q1", ds=0.331817852986604588, k=2.98636067687944129, unit=0, nslice=ns)
# q2 = elements.ChrPlasmaLens(name="q2", ds=0.176038957633108457, k=1.584350618697976110, unit=0, nslice=ns)
# q3 = elements.ChrPlasmaLens(name="q3", ds=1.041842576046930486, k=9.37658318442237437, unit=0, nslice=ns)
# q4 = elements.ChrPlasmaLens(name="q4", ds=0.334367090894399520, k=1.50465190902479784, unit=0, nslice=ns)
# q5 = elements.ChrPlasmaLens(name="q5", ds=1.041842576046930486, k=9.37658318442237437, unit=0, nslice=ns)
# q6 = elements.ChrPlasmaLens(name="q6", ds=0.176038957633108457, k=1.584350618697976110, unit=0, nslice=ns)
# q7 = elements.ChrPlasmaLens(name="q7", ds=0.331817852986604588, k=2.98636067687944129, unit=0, nslice=ns)

lattice_line = [
monitor,
Expand Down
2 changes: 1 addition & 1 deletion examples/cfchannel/run_cfchannel.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
sim.lattice.extend(
[
monitor,
elements.ConstF(ds=2.0, kx=1.0, ky=1.0, kt=1.0),
elements.ConstF(name="constf1", ds=2.0, kx=1.0, ky=1.0, kt=1.0),
monitor,
]
)
Expand Down
2 changes: 1 addition & 1 deletion examples/cfchannel/run_cfchannel_10nC_fft.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
sim.lattice.extend(
[
monitor,
elements.ConstF(ds=2.0, kx=1.0, ky=1.0, kt=1.0, nslice=nslice),
elements.ConstF(name="constf1", ds=2.0, kx=1.0, ky=1.0, kt=1.0, nslice=nslice),
monitor,
]
)
Expand Down
2 changes: 1 addition & 1 deletion examples/cfchannel/run_cfchannel_10nC_mlmg.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
sim.lattice.extend(
[
monitor,
elements.ConstF(ds=2.0, kx=1.0, ky=1.0, kt=1.0, nslice=nslice),
elements.ConstF(name="constf1", ds=2.0, kx=1.0, ky=1.0, kt=1.0, nslice=nslice),
monitor,
]
)
Expand Down
14 changes: 7 additions & 7 deletions examples/chicane/run_chicane.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@
lb = 0.500194828041958 # bend arc length (meters)

# Drift elements
dr1 = elements.Drift(ds=5.0058489435, nslice=ns)
dr2 = elements.Drift(ds=1.0, nslice=ns)
dr3 = elements.Drift(ds=2.0, nslice=ns)
dr1 = elements.Drift(name="dr1", ds=5.0058489435, nslice=ns)
dr2 = elements.Drift(name="dr2", ds=1.0, nslice=ns)
dr3 = elements.Drift(name="dr3", ds=2.0, nslice=ns)

# Bend elements
sbend1 = elements.Sbend(ds=lb, rc=-rc, nslice=ns)
sbend2 = elements.Sbend(ds=lb, rc=rc, nslice=ns)
sbend1 = elements.Sbend(name="sbend1", ds=lb, rc=-rc, nslice=ns)
sbend2 = elements.Sbend(name="sbend2", ds=lb, rc=rc, nslice=ns)

# Dipole Edge Focusing elements
dipedge1 = elements.DipEdge(psi=-psi, rc=-rc, g=0.0, K2=0.0)
dipedge2 = elements.DipEdge(psi=psi, rc=rc, g=0.0, K2=0.0)
dipedge1 = elements.DipEdge(name="dipedge1", psi=-psi, rc=-rc, g=0.0, K2=0.0)
dipedge2 = elements.DipEdge(name="dipedge2", psi=psi, rc=rc, g=0.0, K2=0.0)

lattice_half = [sbend1, dipedge1, dr1, dipedge2, sbend2]
# assign a segment with the first half of the lattice
Expand Down
14 changes: 7 additions & 7 deletions examples/chicane/run_chicane_csr.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@
lb = 0.500194828041958 # bend arc length (meters)

# Drift elements
dr1 = elements.Drift(ds=5.0058489435, nslice=ns)
dr2 = elements.Drift(ds=1.0, nslice=ns)
dr3 = elements.Drift(ds=2.0, nslice=ns)
dr1 = elements.Drift(name="dr1", ds=5.0058489435, nslice=ns)
dr2 = elements.Drift(name="dr2", ds=1.0, nslice=ns)
dr3 = elements.Drift(name="dr3", ds=2.0, nslice=ns)

# Bend elements
sbend1 = elements.Sbend(ds=lb, rc=-rc, nslice=ns)
sbend2 = elements.Sbend(ds=lb, rc=rc, nslice=ns)
sbend1 = elements.Sbend(name="sbend1", ds=lb, rc=-rc, nslice=ns)
sbend2 = elements.Sbend(name="sbend2", ds=lb, rc=rc, nslice=ns)

# Dipole Edge Focusing elements
dipedge1 = elements.DipEdge(psi=-psi, rc=-rc, g=0.0, K2=0.0)
dipedge2 = elements.DipEdge(psi=psi, rc=rc, g=0.0, K2=0.0)
dipedge1 = elements.DipEdge(name="dipedge1", psi=-psi, rc=-rc, g=0.0, K2=0.0)
dipedge2 = elements.DipEdge(name="dipedge2", psi=psi, rc=rc, g=0.0, K2=0.0)

lattice_half = [sbend1, dipedge1, dr1, dipedge2, sbend2]
# assign a segment with the first half of the lattice
Expand Down
4 changes: 2 additions & 2 deletions examples/compression/run_compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
# design the accelerator lattice
sim.lattice.append(monitor)
# Short RF cavity element
shortrf1 = elements.ShortRF(V=1000.0, freq=1.3e9, phase=-89.5)
shortrf1 = elements.ShortRF(name="shortrf1", V=1000.0, freq=1.3e9, phase=-89.5)
# Drift element
drift1 = elements.Drift(ds=1.7)
drift1 = elements.Drift(name="drift1", ds=1.7)

sim.lattice.extend([shortrf1, drift1])

Expand Down
8 changes: 4 additions & 4 deletions examples/cyclotron/run_cyclotron.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
ns = 1 # number of slices per ds in the element
period = [
monitor,
elements.ChrAcc(ds=0.038, ez=1.12188308693e-4, bz=1.0e-14, nslice=ns),
elements.ExactSbend(ds=0.25, phi=180.0, B=1),
elements.ChrAcc(ds=0.038, ez=1.12188308693e-4, bz=1.0e-14, nslice=ns),
elements.ExactSbend(ds=0.25, phi=180.0, B=1),
elements.ChrAcc(name="acc1", ds=0.038, ez=1.12188308693e-4, bz=1.0e-14, nslice=ns),
elements.ExactSbend(name="sbend1", ds=0.25, phi=180.0, B=1),
elements.ChrAcc(name="acc2", ds=0.038, ez=1.12188308693e-4, bz=1.0e-14, nslice=ns),
elements.ExactSbend(name="sbend2", ds=0.25, phi=180.0, B=1),
monitor,
]

Expand Down
10 changes: 5 additions & 5 deletions examples/distgen/run_gaussian_twiss.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@
ns = 25 # number of slices per ds in the element
fodo = [
monitor,
elements.Drift(ds=0.25, nslice=ns),
elements.Drift(name="d1", ds=0.25, nslice=ns),
monitor,
elements.Quad(ds=1.0, k=1.0, nslice=ns),
elements.Quad(name="q1", ds=1.0, k=1.0, nslice=ns),
monitor,
elements.Drift(ds=0.5, nslice=ns),
elements.Drift(name="d2", ds=0.5, nslice=ns),
monitor,
elements.Quad(ds=1.0, k=-1.0, nslice=ns),
elements.Quad(name="q2", ds=1.0, k=-1.0, nslice=ns),
monitor,
elements.Drift(ds=0.25, nslice=ns),
elements.Drift(name="d3", ds=0.25, nslice=ns),
monitor,
]
# assign a fodo segment
Expand Down
2 changes: 1 addition & 1 deletion examples/distgen/run_kurth4d.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
# design the accelerator lattice)
constf = [
monitor,
elements.ConstF(ds=2.0, kx=1.0, ky=1.0, kt=1.0e-4),
elements.ConstF(name="constf1", ds=2.0, kx=1.0, ky=1.0, kt=1.0e-4),
monitor,
]

Expand Down
10 changes: 5 additions & 5 deletions examples/distgen/run_kvdist_twiss.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@
ns = 25 # number of slices per ds in the element
fodo = [
monitor,
elements.Drift(ds=0.25, nslice=ns),
elements.Drift(name="d1", ds=0.25, nslice=ns),
monitor,
elements.Quad(ds=1.0, k=1.0, nslice=ns),
elements.Quad(name="q1", ds=1.0, k=1.0, nslice=ns),
monitor,
elements.Drift(ds=0.5, nslice=ns),
elements.Drift(name="d2", ds=0.5, nslice=ns),
monitor,
elements.Quad(ds=1.0, k=-1.0, nslice=ns),
elements.Quad(name="q2", ds=1.0, k=-1.0, nslice=ns),
monitor,
elements.Drift(ds=0.25, nslice=ns),
elements.Drift(name="d3", ds=0.25, nslice=ns),
monitor,
]
# assign a fodo segment
Expand Down
10 changes: 5 additions & 5 deletions examples/distgen/run_semigaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@
ns = 25 # number of slices per ds in the element
fodo = [
monitor,
elements.Drift(ds=0.25, nslice=ns),
elements.Drift(name="d1", ds=0.25, nslice=ns),
monitor,
elements.Quad(ds=1.0, k=1.0, nslice=ns),
elements.Quad(name="q1", ds=1.0, k=1.0, nslice=ns),
monitor,
elements.Drift(ds=0.5, nslice=ns),
elements.Drift(name="d2", ds=0.5, nslice=ns),
monitor,
elements.Quad(ds=1.0, k=-1.0, nslice=ns),
elements.Quad(name="q2", ds=1.0, k=-1.0, nslice=ns),
monitor,
elements.Drift(ds=0.25, nslice=ns),
elements.Drift(name="d3", ds=0.25, nslice=ns),
monitor,
]
# assign a fodo segment
Expand Down
12 changes: 6 additions & 6 deletions examples/dogleg/run_dogleg.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@
lb = 0.500194828041958 # bend arc length (meters)

# Drift elements
dr1 = elements.Drift(ds=5.0058489435, nslice=ns)
dr2 = elements.Drift(ds=0.5, nslice=ns)
dr1 = elements.Drift(name="dr1", ds=5.0058489435, nslice=ns)
dr2 = elements.Drift(name="dr2", ds=0.5, nslice=ns)

# Bend elements
sbend1 = elements.Sbend(ds=lb, rc=-rc, nslice=ns)
sbend2 = elements.Sbend(ds=lb, rc=rc, nslice=ns)
sbend1 = elements.Sbend(name="sbend1", ds=lb, rc=-rc, nslice=ns)
sbend2 = elements.Sbend(name="sbend2", ds=lb, rc=rc, nslice=ns)

# Dipole Edge Focusing elements
dipedge1 = elements.DipEdge(psi=-psi, rc=-rc, g=0.0, K2=0.0)
dipedge2 = elements.DipEdge(psi=psi, rc=rc, g=0.0, K2=0.0)
dipedge1 = elements.DipEdge(name="dipedge1", psi=-psi, rc=-rc, g=0.0, K2=0.0)
dipedge2 = elements.DipEdge(name="dipedge2", psi=psi, rc=rc, g=0.0, K2=0.0)

lattice_dogleg = [sbend1, dipedge1, dr1, dipedge2, sbend2, dr2]

Expand Down
1 change: 1 addition & 0 deletions examples/epac2004_benchmarks/run_bithermal.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
sim.lattice.append(monitor)

constf = elements.ConstF(
name="constf",
ds=10.0,
kx=6.283185307179586,
ky=6.283185307179586,
Expand Down
8 changes: 5 additions & 3 deletions examples/epac2004_benchmarks/run_fodo_rf_SC.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@
sim.lattice.append(monitor)

# Quad elements
fquad = elements.Quad(ds=0.15, k=2.4669749766168163, nslice=6)
dquad = elements.Quad(ds=0.3, k=-2.4669749766168163, nslice=12)
fquad = elements.Quad(name="fquad", ds=0.15, k=2.4669749766168163, nslice=6)
dquad = elements.Quad(name="dquad", ds=0.3, k=-2.4669749766168163, nslice=12)

# Drift element
dr = elements.Drift(ds=0.1, nslice=4)
dr = elements.Drift(name="dr", ds=0.1, nslice=4)

# RF cavity elements
gapa1 = elements.RFCavity(
name="gapa1",
ds=1.0,
escale=0.042631556991578,
freq=7.0e8,
Expand Down Expand Up @@ -121,6 +122,7 @@
)

gapb1 = elements.RFCavity(
name="gapb1",
ds=1.0,
escale=0.042631556991578,
freq=7.0e8,
Expand Down
2 changes: 1 addition & 1 deletion examples/expanding_beam/run_expanding_fft.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
monitor = elements.BeamMonitor("monitor", backend="h5")

# design the accelerator lattice
sim.lattice.extend([monitor, elements.Drift(ds=6.0, nslice=40), monitor])
sim.lattice.extend([monitor, elements.Drift(name="d1", ds=6.0, nslice=40), monitor])

# run simulation
sim.evolve()
Expand Down
2 changes: 1 addition & 1 deletion examples/expanding_beam/run_expanding_mlmg.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
monitor = elements.BeamMonitor("monitor", backend="h5")

# design the accelerator lattice
sim.lattice.extend([monitor, elements.Drift(ds=6.0, nslice=40), monitor])
sim.lattice.extend([monitor, elements.Drift(name="d1", ds=6.0, nslice=40), monitor])

# run simulation
sim.evolve()
Expand Down
10 changes: 5 additions & 5 deletions examples/fodo/run_fodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@
ns = 25 # number of slices per ds in the element
fodo = [
monitor,
elements.Drift(ds=0.25, nslice=ns),
elements.Drift(name="drift1", ds=0.25, nslice=ns),
monitor,
elements.Quad(ds=1.0, k=1.0, nslice=ns),
elements.Quad(name="quad1", ds=1.0, k=1.0, nslice=ns),
monitor,
elements.Drift(ds=0.5, nslice=ns),
elements.Drift(name="drift2", ds=0.5, nslice=ns),
monitor,
elements.Quad(ds=1.0, k=-1.0, nslice=ns),
elements.Quad(name="quad2", ds=1.0, k=-1.0, nslice=ns),
monitor,
elements.Drift(ds=0.25, nslice=ns),
elements.Drift(name="drift3", ds=0.25, nslice=ns),
monitor,
]
# assign a fodo segment
Expand Down
Loading

0 comments on commit 58adf4f

Please sign in to comment.