File tree 1 file changed +12
-4
lines changed
1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 13
13
14
14
15
15
def tfs_to_cell_and_optics (tfs_path ):
16
- converter = MADXLatticeConverter (tfs_path )
17
- cell = converter .convert ()
18
- optics = optics_from_tfs (converter .tfs )
16
+ tfs_table = tfs .read (tfs_path )
17
+
18
+ cell = convert_tfs_lattice (tfs_table )
19
+ optics = optics_from_tfs (tfs_table )
19
20
return cell , optics
20
21
21
22
def optics_from_tfs (tfs_table ):
@@ -53,9 +54,16 @@ def optics_from_tfs(tfs_table):
53
54
54
55
class UnsupportedMADXElementType (RuntimeError ): pass
55
56
57
+ def convert_tfs_lattice (tfs_table , converter = None ):
58
+ if converter is None :
59
+ converter = MADXLatticeConverter ()
60
+
61
+ for row in tfs_table .itertuples ():
62
+ yield converter .dispatch (row )
63
+
56
64
57
65
class MADXLatticeConverter :
58
- def _dispatch (self , row ):
66
+ def dispatch (self , row ):
59
67
etype = row .KEYWORD
60
68
etypelow = etype .lower ()
61
69
try :
You can’t perform that action at this time.
0 commit comments