atip 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of atip might be problematic. Click here for more details.
- atip/__init__.py +13 -0
- atip/__main__.py +24 -0
- atip/_version.py +21 -0
- atip/load_sim.py +79 -0
- atip/rings/DBA.mat +0 -0
- atip/rings/DIAD.mat +0 -0
- atip/rings/DIAD_WIG.mat +0 -0
- atip/rings/DIAMOND2SP.lat +230 -0
- atip/rings/HMBA.mat +0 -0
- atip/rings/I04.mat +0 -0
- atip/rings/VMX.mat +0 -0
- atip/rings/VMXSP.mat +0 -0
- atip/rings/VMXSP_WIG.mat +0 -0
- atip/rings/VMX_WIG.mat +0 -0
- atip/rings/create_lattice_matfile.m +70 -0
- atip/sim_data_sources.py +482 -0
- atip/simulator.py +593 -0
- atip/utils.py +190 -0
- atip-0.1.1.dist-info/METADATA +277 -0
- atip-0.1.1.dist-info/RECORD +40 -0
- atip-0.1.1.dist-info/WHEEL +5 -0
- atip-0.1.1.dist-info/entry_points.txt +3 -0
- atip-0.1.1.dist-info/licenses/LICENSE +201 -0
- atip-0.1.1.dist-info/top_level.txt +2 -0
- virtac/__init__.py +7 -0
- virtac/atip_ioc_entry.py +133 -0
- virtac/atip_server.py +574 -0
- virtac/create_csv.py +430 -0
- virtac/data/DIAD/bba.csv +1159 -0
- virtac/data/DIAD/feedback.csv +1005 -0
- virtac/data/DIAD/limits.csv +2393 -0
- virtac/data/DIAD/mirrored.csv +13 -0
- virtac/data/DIAD/tunefb.csv +139 -0
- virtac/data/I04/bba.csv +1159 -0
- virtac/data/I04/feedback.csv +1005 -0
- virtac/data/I04/limits.csv +2401 -0
- virtac/data/I04/mirrored.csv +13 -0
- virtac/data/I04/tunefb.csv +139 -0
- virtac/masks.py +86 -0
- virtac/mirror_objects.py +109 -0
atip/__init__.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""ATIP: Accelerator Toolbox Interface for Pytac.
|
|
2
|
+
See README.rst & INSTALL.rst for more information.
|
|
3
|
+
|
|
4
|
+
.. data:: __version__
|
|
5
|
+
:type: str
|
|
6
|
+
|
|
7
|
+
Version number as calculated by https://github.com/pypa/setuptools_scm
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from . import load_sim, sim_data_sources, simulator, utils
|
|
11
|
+
from ._version import __version__
|
|
12
|
+
|
|
13
|
+
__all__ = ["__version__", "load_sim", "sim_data_sources", "simulator", "utils"]
|
atip/__main__.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Interface for ``python -m atip``."""
|
|
2
|
+
|
|
3
|
+
from argparse import ArgumentParser
|
|
4
|
+
from collections.abc import Sequence
|
|
5
|
+
|
|
6
|
+
from . import __version__
|
|
7
|
+
|
|
8
|
+
__all__ = ["main"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def main(args: Sequence[str] | None = None) -> None:
|
|
12
|
+
"""Argument parser for the CLI."""
|
|
13
|
+
parser = ArgumentParser()
|
|
14
|
+
parser.add_argument(
|
|
15
|
+
"-v",
|
|
16
|
+
"--version",
|
|
17
|
+
action="version",
|
|
18
|
+
version=__version__,
|
|
19
|
+
)
|
|
20
|
+
parser.parse_args(args)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
if __name__ == "__main__":
|
|
24
|
+
main()
|
atip/_version.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# file generated by setuptools-scm
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
|
|
4
|
+
__all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
|
|
5
|
+
|
|
6
|
+
TYPE_CHECKING = False
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from typing import Tuple
|
|
9
|
+
from typing import Union
|
|
10
|
+
|
|
11
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
12
|
+
else:
|
|
13
|
+
VERSION_TUPLE = object
|
|
14
|
+
|
|
15
|
+
version: str
|
|
16
|
+
__version__: str
|
|
17
|
+
__version_tuple__: VERSION_TUPLE
|
|
18
|
+
version_tuple: VERSION_TUPLE
|
|
19
|
+
|
|
20
|
+
__version__ = version = '0.1.1'
|
|
21
|
+
__version_tuple__ = version_tuple = (0, 1, 1)
|
atip/load_sim.py
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"""Module responsible for handling the loading of simulator data sources."""
|
|
2
|
+
|
|
3
|
+
import at
|
|
4
|
+
import pytac
|
|
5
|
+
from pytac.exceptions import FieldException
|
|
6
|
+
from pytac.units import NullUnitConv
|
|
7
|
+
|
|
8
|
+
from atip.sim_data_sources import ATElementDataSource, ATLatticeDataSource
|
|
9
|
+
from atip.simulator import ATSimulator
|
|
10
|
+
|
|
11
|
+
# List of all the element fields that can be currently simulated.
|
|
12
|
+
SIMULATED_FIELDS = {"a1", "b0", "b1", "b2", "x", "y", "f", "x_kick", "y_kick"}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def load_from_filepath(
|
|
16
|
+
pytac_lattice, at_lattice_filepath, callback=None, disable_emittance=False
|
|
17
|
+
):
|
|
18
|
+
"""Load simulator data sources onto the lattice and its elements.
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
pytac_lattice (pytac.lattice.Lattice): An instance of a Pytac lattice.
|
|
22
|
+
at_lattice_filepath (str): The path to a .mat file from which the
|
|
23
|
+
Accelerator Toolbox lattice can be loaded.
|
|
24
|
+
callback (typing.Callable): To be called after completion of each round of
|
|
25
|
+
physics calculations.
|
|
26
|
+
disable_emittance (bool): Whether the emittance should be calculated.
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
pytac.lattice.Lattice: The same Pytac lattice object, but now with a
|
|
30
|
+
simulator data source fully loaded onto it.
|
|
31
|
+
"""
|
|
32
|
+
at_lattice = at.load.load_mat(
|
|
33
|
+
at_lattice_filepath,
|
|
34
|
+
name=pytac_lattice.name,
|
|
35
|
+
energy=pytac_lattice.get_value("energy"),
|
|
36
|
+
)
|
|
37
|
+
return load(pytac_lattice, at_lattice, callback, disable_emittance)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def load(pytac_lattice, at_lattice, callback=None, disable_emittance=False):
|
|
41
|
+
"""Load simulator data sources onto the lattice and its elements.
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
pytac_lattice (pytac.lattice.Lattice): An instance of a Pytac lattice.
|
|
45
|
+
at_lattice (at.lattice_object.Lattice): An instance of an Accelerator
|
|
46
|
+
Toolbox lattice object.
|
|
47
|
+
callback (typing.Callable): To be called after completion of each round of
|
|
48
|
+
physics calculations.
|
|
49
|
+
disable_emittance (bool): Whether the emittance should be calculated.
|
|
50
|
+
|
|
51
|
+
Returns:
|
|
52
|
+
pytac.lattice.Lattice: The same Pytac lattice object, but now with a
|
|
53
|
+
simulator data source fully loaded onto it.
|
|
54
|
+
"""
|
|
55
|
+
if len(at_lattice) != len(pytac_lattice):
|
|
56
|
+
raise ValueError(
|
|
57
|
+
"Incompatible AT and Pytac lattices, length mismatch "
|
|
58
|
+
f"(AT:{len(at_lattice)} Pytac:{len(pytac_lattice)})."
|
|
59
|
+
)
|
|
60
|
+
# Initialise an instance of the ATSimulator Object.
|
|
61
|
+
atsim = ATSimulator(at_lattice, callback, disable_emittance)
|
|
62
|
+
# Set the simulator data source on the Pytac lattice.
|
|
63
|
+
pytac_lattice.set_data_source(ATLatticeDataSource(atsim), pytac.SIM)
|
|
64
|
+
# Load the sim onto each element.
|
|
65
|
+
for e in pytac_lattice:
|
|
66
|
+
# Determine which fields each simulated element should have.
|
|
67
|
+
sim_fields = list(set(e.get_fields()[pytac.LIVE]) & SIMULATED_FIELDS)
|
|
68
|
+
# Set the simulator data source on each element.
|
|
69
|
+
e.set_data_source(
|
|
70
|
+
ATElementDataSource(at_lattice[e.index - 1], e.index, atsim, sim_fields),
|
|
71
|
+
pytac.SIM,
|
|
72
|
+
)
|
|
73
|
+
# Give any lattice fields not on the live machine a unit conversion object.
|
|
74
|
+
for field in pytac_lattice.get_fields()[pytac.SIM]:
|
|
75
|
+
try:
|
|
76
|
+
pytac_lattice.get_unitconv(field)
|
|
77
|
+
except FieldException:
|
|
78
|
+
pytac_lattice.set_unitconv(field, NullUnitConv())
|
|
79
|
+
return pytac_lattice
|
atip/rings/DBA.mat
ADDED
|
Binary file
|
atip/rings/DIAD.mat
ADDED
|
Binary file
|
atip/rings/DIAD_WIG.mat
ADDED
|
Binary file
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
{c:\users\bs36\desktop\jb-04-30-05\m-h6ba-17e-79pm-01-01-02_sym_oct.opa}
|
|
2
|
+
|
|
3
|
+
{opa to tracy-2 export}
|
|
4
|
+
|
|
5
|
+
define lattice;
|
|
6
|
+
energy = 3.500000;
|
|
7
|
+
dp = 1.0d-10; codeps = 1.0d-6; dk = 1.0d-6;
|
|
8
|
+
meth = 4; nbend = 10; nquad = 10;
|
|
9
|
+
f = 499501358.3498094;
|
|
10
|
+
sp_f = 2.997008150098844e9;
|
|
11
|
+
|
|
12
|
+
{----- variables ----------------------------------------------------}
|
|
13
|
+
|
|
14
|
+
nsext = 2;
|
|
15
|
+
aban1 = 0.24303148;
|
|
16
|
+
aban3 = -0*0.33772927;
|
|
17
|
+
aban4 = 0.31853103;
|
|
18
|
+
rk1 = 5.26028347;
|
|
19
|
+
rk2 = -3.62182625;
|
|
20
|
+
rk3 = 6.12183082;
|
|
21
|
+
rk4 = 6.22723242;
|
|
22
|
+
|
|
23
|
+
{----- table of elements ----------------------------------------------------}
|
|
24
|
+
|
|
25
|
+
cav: Cavity, L = 0.0, Frequency = 2.997008150098844e9, Voltage = 2.2e6,
|
|
26
|
+
harnum=934, phi = 0.0;
|
|
27
|
+
|
|
28
|
+
dmult : drift, l = 0.045000;
|
|
29
|
+
dmult1 : drift, l = 0.000000;
|
|
30
|
+
dcor : drift, l = 0.000000;
|
|
31
|
+
dcor1 : drift, l = 0.040000;
|
|
32
|
+
dr_01 : drift, l = 2.521350;
|
|
33
|
+
dr_02 : drift, l = 0.075000;
|
|
34
|
+
dr_03 : drift, l = 0.075000;
|
|
35
|
+
dr_04 : drift, l = 0.150000;
|
|
36
|
+
dr_05 : drift, l = 0.075000;
|
|
37
|
+
dr_06 : drift, l = 0.075000;
|
|
38
|
+
dr_07 : drift, l = 0.075000;
|
|
39
|
+
dr_08 : drift, l = 0.075000;
|
|
40
|
+
dr_09 : drift, l = 0.330500;
|
|
41
|
+
dr_091 : drift, l = 0.120000;
|
|
42
|
+
dr_092 : drift, l = 0.210500;
|
|
43
|
+
dr_10 : drift, l = 0.075000;
|
|
44
|
+
dr_11 : drift, l = 0.075000;
|
|
45
|
+
dr_12 : drift, l = 0.075000;
|
|
46
|
+
dr_13 : drift, l = 0.165500;
|
|
47
|
+
dr_14 : drift, l = 0.075000;
|
|
48
|
+
dr_15 : drift, l = 0.075000;
|
|
49
|
+
dr_16 : drift, l = 0.075000;
|
|
50
|
+
dr_17 : drift, l = 0.100000;
|
|
51
|
+
dr_18 : drift, l = 0.080000;
|
|
52
|
+
dr_19 : drift, l = 0.197000;
|
|
53
|
+
dr_20 : drift, l = 0.090000;
|
|
54
|
+
dr_21 : drift, l = 0.090000;
|
|
55
|
+
dr_22 : drift, l = 0.075000;
|
|
56
|
+
dr_23 : drift, l = 0.075000;
|
|
57
|
+
dr_24 : drift, l = 1.384200;
|
|
58
|
+
dl_27 : drift, l = 3.696350;
|
|
59
|
+
dl_26 : drift, l = 0.075000;
|
|
60
|
+
dl_25 : drift, l = 0.035000;
|
|
61
|
+
dl_24 : drift, l = 0.035000;
|
|
62
|
+
dl_23 : drift, l = 0.075000;
|
|
63
|
+
dl_22 : drift, l = 0.075000;
|
|
64
|
+
dl_21 : drift, l = 0.075000;
|
|
65
|
+
dl_20 : drift, l = 0.075000;
|
|
66
|
+
dl_19 : drift, l = 0.075000;
|
|
67
|
+
dl_18 : drift, l = 0.075000;
|
|
68
|
+
dl_17 : drift, l = 0.075000;
|
|
69
|
+
dl_161 : drift, l = 0.120000;
|
|
70
|
+
dl_162 : drift, l = 0.210500;
|
|
71
|
+
dl_15 : drift, l = 0.075000;
|
|
72
|
+
dl_14 : drift, l = 0.075000;
|
|
73
|
+
dl_13 : drift, l = 0.075000;
|
|
74
|
+
dl_12 : drift, l = 0.165500;
|
|
75
|
+
dl_11 : drift, l = 0.075000;
|
|
76
|
+
dl_10 : drift, l = 0.075000;
|
|
77
|
+
dl_09 : drift, l = 0.075000;
|
|
78
|
+
dl_08 : drift, l = 0.100000;
|
|
79
|
+
dl_07 : drift, l = 0.080000;
|
|
80
|
+
dl_06 : drift, l = 0.197000;
|
|
81
|
+
dl_05 : drift, l = 0.090000;
|
|
82
|
+
dl_04 : drift, l = 0.090000;
|
|
83
|
+
dl_03 : drift, l = 0.075000;
|
|
84
|
+
dl_02 : drift, l = 0.075000;
|
|
85
|
+
dl_01 : drift, l = 1.384200;
|
|
86
|
+
|
|
87
|
+
b_t : marker;
|
|
88
|
+
ms : marker;
|
|
89
|
+
ss : marker;
|
|
90
|
+
ls : marker;
|
|
91
|
+
|
|
92
|
+
dl1a_1: bending, l = 0.20000000,
|
|
93
|
+
t = 0.32969999, t1 = 0.00000000, t2 = 0.32969999, k = -0.12411107,
|
|
94
|
+
n = nbend, method = 4;
|
|
95
|
+
dl1a_2: bending, l = 0.20000000,
|
|
96
|
+
t = 0.37951415, t1 = -0.32969999, t2 = 0.70921414, k = -0.12411107,
|
|
97
|
+
n = nbend, method = 4;
|
|
98
|
+
dl1a_3: bending, l = 0.20000000,
|
|
99
|
+
t = 0.44430484, t1 = -0.37951415, t2 = 1.15351899, k = -0.12411107,
|
|
100
|
+
n = nbend, method = 4;
|
|
101
|
+
dl1a_4: bending, l = 0.20000000,
|
|
102
|
+
t = 0.54929318, t1 = -0.44430484, t2 = 1.70281217, k = -0.12411107,
|
|
103
|
+
n = nbend, method = 4;
|
|
104
|
+
dl1a_5: bending, l = 0.20000000,
|
|
105
|
+
t = 0.83989144, t1 = -0.54929318, t2 = 2.54270361, k = -0.12411107,
|
|
106
|
+
n = nbend, method = 4;
|
|
107
|
+
dl2a_1: bending, l = 0.16667000,
|
|
108
|
+
t = 0.37529392, t1 = 0.00000000, t2 = 0.37529392, k = -0.57541761,
|
|
109
|
+
n = nbend, method = 4;
|
|
110
|
+
dl2a_2: bending, l = 0.16667000,
|
|
111
|
+
t = 0.43199684, t1 = -0.37529392, t2 = 0.80729076, k = -0.57541761,
|
|
112
|
+
n = nbend, method = 4;
|
|
113
|
+
dl2a_3: bending, l = 0.33334000,
|
|
114
|
+
t = 0.50574738, t1 = -0.43199684, t2 = 1.31303814, k = -0.57541761,
|
|
115
|
+
n = nbend, method = 4;
|
|
116
|
+
dl2a_4: bending, l = 0.16667000,
|
|
117
|
+
t = 0.62525447, t1 = -0.50574738, t2 = 1.93829261, k = -0.57541761,
|
|
118
|
+
n = nbend, method = 4;
|
|
119
|
+
dl2a_5: bending, l = 0.16667000,
|
|
120
|
+
t = 0.95603931, t1 = -0.62525447, t2 = 2.89433192, k = -0.57541761,
|
|
121
|
+
n = nbend, method = 4;
|
|
122
|
+
|
|
123
|
+
qf4: bending, l = 0.15000000,
|
|
124
|
+
t = -0.28922341, t1 = -0.14461171, t2 = -0.14461171, k = 4.58473041,
|
|
125
|
+
n = nbend, method = 4;
|
|
126
|
+
qf8: bending, l = 0.25000000,
|
|
127
|
+
t = -0.20559380, t1 = -0.10279690, t2 = -0.10279690, k = 6.65707774,
|
|
128
|
+
n = nbend, method = 4;
|
|
129
|
+
dq1: bending, l = 0.87000000,
|
|
130
|
+
t = 2.84700510, t1 = 1.42350255, t2 = 1.42350255, k = -2.80820067,
|
|
131
|
+
n = nbend, method = 4;
|
|
132
|
+
|
|
133
|
+
qf1: quadrupole, l = 0.15000000, k = 10.24316352, n = nquad, method = 4;
|
|
134
|
+
qd2: quadrupole, l = 0.15000000, k = -6.81087771, n = nquad, method = 4;
|
|
135
|
+
qd3: quadrupole, l = 0.15000000, k = -2.33804938, n = nquad, method = 4;
|
|
136
|
+
qd5: quadrupole, l = 0.10500000, k = -3.17820036, n = nquad, method = 4;
|
|
137
|
+
qf6: quadrupole, l = 0.36000000, k = 7.44415301, n = nquad, method = 4;
|
|
138
|
+
qd3_c1: quadrupole, l = 0.15000000, k = -2.35079416, n = nquad, method = 4;
|
|
139
|
+
qf1_c1: quadrupole, l = 0.18500000, k = -4.54825797, n = nquad, method = 4;
|
|
140
|
+
qd2_c1: quadrupole, l = 0.10500000, k = -1.65796511, n = nquad, method = 4;
|
|
141
|
+
quad_add: quadrupole, l = 0.18500000, k = 7.03286724, n = nquad, method = 4;
|
|
142
|
+
|
|
143
|
+
{ [+,-,-,-] }
|
|
144
|
+
sf1 : sextupole, l = 0.14000, k = 1.74437e+02, n = nsext, Method = Meth;
|
|
145
|
+
sd1 : sextupole, l = 0.14000, k = -2.18565e+02, n = nsext, Method = Meth;
|
|
146
|
+
sd2 : sextupole, l = 0.14000, k = -1.42631e+02, n = nsext, Method = Meth;
|
|
147
|
+
s : sextupole, l = 0.10000, k = 0.000000, n = 1, method=meth;
|
|
148
|
+
sh2 : sextupole, l = 0.10000, k = 0.000000, n = 1, method=meth;
|
|
149
|
+
|
|
150
|
+
sh1a : sextupole, l = 0.10000, k = 0.000000, n = 1, method=meth;
|
|
151
|
+
sh1b : sextupole, l = 0.10000, k = 0.000000, n = 1, method=meth;
|
|
152
|
+
|
|
153
|
+
of1 : multipole, l = 0.0;{, hom = (4, 0.0, 0);}
|
|
154
|
+
|
|
155
|
+
bpm_01 : beam position monitor;
|
|
156
|
+
bpm_02 : beam position monitor;
|
|
157
|
+
bpm_03 : beam position monitor;
|
|
158
|
+
bpm_04 : beam position monitor;
|
|
159
|
+
bpm_05 : beam position monitor;
|
|
160
|
+
bpm_06 : beam position monitor;
|
|
161
|
+
bpm_07 : beam position monitor;
|
|
162
|
+
bpm_08 : beam position monitor;
|
|
163
|
+
bpm_09 : beam position monitor;
|
|
164
|
+
bpm_10 : beam position monitor;
|
|
165
|
+
bpm_11 : beam position monitor;
|
|
166
|
+
|
|
167
|
+
ch_01 : corrector, horizontal;
|
|
168
|
+
ch_02 : corrector, horizontal;
|
|
169
|
+
ch_03 : corrector, horizontal;
|
|
170
|
+
ch_04 : corrector, horizontal;
|
|
171
|
+
ch_05 : corrector, horizontal;
|
|
172
|
+
ch_06 : corrector, horizontal;
|
|
173
|
+
ch_07 : corrector, horizontal;
|
|
174
|
+
ch_08 : corrector, horizontal;
|
|
175
|
+
ch_09 : corrector, horizontal;
|
|
176
|
+
ch_10 : corrector, horizontal;
|
|
177
|
+
ch_11 : corrector, horizontal;
|
|
178
|
+
|
|
179
|
+
cv_01 : corrector, vertical;
|
|
180
|
+
cv_02 : corrector, vertical;
|
|
181
|
+
cv_03 : corrector, vertical;
|
|
182
|
+
cv_04 : corrector, vertical;
|
|
183
|
+
cv_05 : corrector, vertical;
|
|
184
|
+
cv_06 : corrector, vertical;
|
|
185
|
+
cv_07 : corrector, vertical;
|
|
186
|
+
cv_08 : corrector, vertical;
|
|
187
|
+
cv_09 : corrector, vertical;
|
|
188
|
+
cv_10 : corrector, vertical;
|
|
189
|
+
cv_11 : corrector, vertical;
|
|
190
|
+
|
|
191
|
+
{----- table of segments ----------------------------------------------------}
|
|
192
|
+
|
|
193
|
+
dl1a : dl1a_5, dl1a_4, dl1a_3, dl1a_2, dl1a_1;
|
|
194
|
+
dl2a : dl2a_5, dl2a_4, dl2a_3, dl2a_2, dl2a_1;
|
|
195
|
+
of1s : dmult, of1, dmult;
|
|
196
|
+
arca_c2r : dr_24, bpm_05, dr_23, ch_05, cv_05, sh2, dr_22, qf8,
|
|
197
|
+
dr_21, dq1, dr_20, qf6, dr_19, bpm_04, dr_18, dcor, s, ch_04, cv_04,
|
|
198
|
+
dcor, dr_17, dl2a, dr_16, qd5, dr_15, sd2, ch_03, cv_03, dr_14,
|
|
199
|
+
bpm_03, dr_13, of1s, dr_12, qf4, dr_11, sf1, dr_10, qf4, dr_091,
|
|
200
|
+
of1, dr_092, bpm_02, dr_08, ch_02, cv_02, sd1, dr_07, qd3, dr_06,
|
|
201
|
+
inv(dl1a), dr_05, qd2, dr_04, ch_01, cv_01, sh1b, dr_03, qf1, dr_02,
|
|
202
|
+
bpm_01, dr_01;
|
|
203
|
+
arca_c1r : dl_01, bpm_06, dl_02, ch_06, cv_06, sh2, dl_03, qf8,
|
|
204
|
+
dl_04, dq1, dl_05, qf6, dl_06, bpm_07, dl_07, dcor, s, ch_07, cv_07,
|
|
205
|
+
dcor, dl_08, dl2a, dl_09, qd5, dl_10, sd2, ch_08, cv_08, dl_11,
|
|
206
|
+
bpm_08, dl_12, of1s, dl_13, qf4, dl_14, sf1, dl_15, qf4, dl_161,
|
|
207
|
+
of1, dl_162, bpm_09, dl_17, ch_09, cv_09, sd1, dl_18, qd3_c1, dl_19,
|
|
208
|
+
inv(dl1a), dl_20, qd2_c1, dl_21, bpm_10, dl_22, ch_10, cv_10, sh1a,
|
|
209
|
+
dl_23, qf1_c1, dl_24, dcor1, ch_11, cv_11, dcor1, dl_25, quad_add,
|
|
210
|
+
dl_26, bpm_11, dl_27;
|
|
211
|
+
arca_c2 : ms, arca_c2r, ss, b_t, inv(arca_c2r);
|
|
212
|
+
arca_c1 : arca_c2r, ms, inv(arca_c1r);
|
|
213
|
+
sp_short : ls, inv(arca_c1r), 2*arca_c2, arca_c1r, ls;
|
|
214
|
+
sp : ls, b_t, inv(arca_c1r), 3*arca_c2, arca_c1r, b_t, ls;
|
|
215
|
+
|
|
216
|
+
{line: ss, inv(arca_c2r), ms, arca_c2r, ss;}
|
|
217
|
+
{line: ms, arca_c1r, ls;}
|
|
218
|
+
{line: ms, arca_c1r, ls, inv(arca_c1r), ms;}
|
|
219
|
+
{line: ss, inv(arca_c1), arca_c1, ss;}
|
|
220
|
+
{line: sp_short;}
|
|
221
|
+
line: sp;
|
|
222
|
+
{line: 6*sp;}
|
|
223
|
+
|
|
224
|
+
ring: 1*line, cav;
|
|
225
|
+
|
|
226
|
+
cell: ring, symmetry=1;
|
|
227
|
+
|
|
228
|
+
end;
|
|
229
|
+
|
|
230
|
+
{c:\users\bs36\desktop\jb-04-30-05\m-h6ba-17e-79pm-01-01-02_sym_oct.opa}
|
atip/rings/HMBA.mat
ADDED
|
Binary file
|
atip/rings/I04.mat
ADDED
|
Binary file
|
atip/rings/VMX.mat
ADDED
|
Binary file
|
atip/rings/VMXSP.mat
ADDED
|
Binary file
|
atip/rings/VMXSP_WIG.mat
ADDED
|
Binary file
|
atip/rings/VMX_WIG.mat
ADDED
|
Binary file
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
function create_lattice_matfile(filename)
|
|
2
|
+
% Creates a .mat file AT lattice compatible with ATIP.
|
|
3
|
+
% If a filename is given that file will be updated to ATIP standard. Otherwise
|
|
4
|
+
% the ring is taken from either of the 'RING' or 'THERING' global variables,
|
|
5
|
+
% with 'RING' taking priority. If a filename is not passed the updated lattice
|
|
6
|
+
% will be stored in 'lattice.mat'.
|
|
7
|
+
if ~(nargin == 0)
|
|
8
|
+
load(filename, 'RING');
|
|
9
|
+
end
|
|
10
|
+
if ~exist('RING', 'var')
|
|
11
|
+
global RING;
|
|
12
|
+
if isempty(RING)
|
|
13
|
+
global THERING;
|
|
14
|
+
RING = THERING;
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
if isempty(RING)
|
|
18
|
+
disp('Unable to load a ring from file or global variables.');
|
|
19
|
+
return;
|
|
20
|
+
end
|
|
21
|
+
% Correct dimension order if necessary.
|
|
22
|
+
if size(RING, 1) == 1
|
|
23
|
+
RING = permute(RING, [2 1]);
|
|
24
|
+
end
|
|
25
|
+
% Correct classes and pass methods.
|
|
26
|
+
for x = 1:length(RING)
|
|
27
|
+
if strcmp(RING{x, 1}.FamName, 'BPM10')
|
|
28
|
+
% Wouldn't be correctly classed by class guessing otherwise.
|
|
29
|
+
RING{x, 1}.Class = 'Monitor';
|
|
30
|
+
elseif (strcmp(RING{x, 1}.FamName, 'HSTR') || strcmp(RING{x, 1}.FamName, 'VSTR'))
|
|
31
|
+
RING{x, 1}.Class = 'Corrector';
|
|
32
|
+
elseif (strcmp(RING{x, 1}.FamName, 'HTRIM') || strcmp(RING{x, 1}.FamName, 'VTRIM'))
|
|
33
|
+
RING{x, 1}.Class = 'Corrector';
|
|
34
|
+
end
|
|
35
|
+
if isfield(RING{x, 1}, 'Class')
|
|
36
|
+
if strcmp(RING{x, 1}.Class, 'SEXT')
|
|
37
|
+
RING{x, 1}.Class = 'Sextupole';
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
if strcmp(RING{x, 1}.PassMethod, 'ThinCorrectorPass')
|
|
41
|
+
% ThinCorrectorPass no longer exists in AT.
|
|
42
|
+
RING{x, 1}.PassMethod = 'CorrectorPass';
|
|
43
|
+
elseif strcmp(RING{x, 1}.PassMethod, 'GWigSymplecticPass')
|
|
44
|
+
RING{x, 1}.Class = 'Wiggler';
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
% Remove elements. Done this way because the size of RING changes during
|
|
49
|
+
% the loop.
|
|
50
|
+
y = 1;
|
|
51
|
+
while y < length(RING)
|
|
52
|
+
% I should probably transfer the attributes of the deleted corrector
|
|
53
|
+
% elements to the sextupole but cba.
|
|
54
|
+
if (strcmp(RING{y, 1}.FamName, 'HSTR') && strcmp(RING{y-1, 1}.Class, 'Sextupole'))
|
|
55
|
+
RING(y, :) = []; % Delete hstrs that are preceded by a sextupole.
|
|
56
|
+
elseif (strcmp(RING{y, 1}.FamName, 'VSTR') && strcmp(RING{y-1, 1}.Class, 'Sextupole'))
|
|
57
|
+
RING(y, :) = []; % Delete vstrs that are preceded by a sextupole.
|
|
58
|
+
else
|
|
59
|
+
y = y + 1;
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
if isfield(RING{1, 1}, 'TwissData')
|
|
63
|
+
RING{1, 1} = rmfield(RING{1, 1}, 'TwissData');
|
|
64
|
+
end
|
|
65
|
+
if nargin == 0
|
|
66
|
+
save('lattice.mat', 'RING');
|
|
67
|
+
else
|
|
68
|
+
save(filename, 'RING');
|
|
69
|
+
end
|
|
70
|
+
end
|