22
33import sixtracktools
44import xline
5+ import xtrack as xt
6+ import xobjects as xo
7+
8+ context = xo .ContextCpu ()
59
610six = sixtracktools .SixInput ("." )
711line = xline .Line .from_sixinput (six )
12+ tracker = xt .Tracker (_context = context , sequence = line )
813iconv = line .other_info ["iconv" ]
914
1015sixdump = sixtracktools .SixDump101 ("res/dump3.dat" )[1 ::2 ]
1318def compare (prun , pbench ):
1419 out = []
1520 for att in "x px y py zeta delta" .split ():
16- vrun = getattr (prun , att )
21+ vrun = getattr (prun , att )[ 0 ]
1722 vbench = getattr (pbench , att )
1823 diff = vrun - vbench
1924 out .append (abs (diff ))
@@ -28,12 +33,16 @@ def compare(prun, pbench):
2833for ii in range (1 , len (iconv )):
2934 jja = iconv [ii - 1 ]
3035 jjb = iconv [ii ]
31- prun = xline .Particles (** sixdump [ii - 1 ].get_minimal_beam ())
36+ prun = xt .Particles (_context = context ,
37+ ** xline .Particles (** sixdump [ii - 1 ].get_minimal_beam ()).to_dict ())
38+ prun .state [0 ]= 1
39+ prun .reorganize ()
3240 print (f"\n -----sixtrack={ ii } xline={ jja } --------------" )
3341 # print(f"pysixtr {jja}, x={prun.x}, px={prun.px}")
3442 for jj in range (jja + 1 , jjb + 1 ):
3543 label , elem = line .element_names [jj ], line .elements [jj ]
36- elem .track (prun )
44+ #elem.track(prun)
45+ tracker .track (particles = prun , ele_start = jj , num_elements = 1 )
3746 print (f"{ jj } { label } ,{ str (elem )[:50 ]} " )
3847 pbench = xline .Particles (** sixdump [ii ].get_minimal_beam ())
3948 s_coord .append (pbench .s )
0 commit comments