@@ -142,43 +142,47 @@ def prepare_line(path, input_type):
142142z_slices = s_rel * 2.0
143143partco = xp .build_particles (particle_on_co = partco , mode = 'shift' , zeta = z_slices )
144144
145+ tracker = xt .Tracker (line = ltest )
146+ tracker .track (partco , turn_by_turn_monitor = 'ONE_TURN_EBE' )
147+ first_turn = tracker .record_last_track
145148
146- list_co = ltest . slow_track_elem_by_elem (partco )
147- list_co2 = ltest . slow_track_elem_by_elem ( partco )
149+ tracker . track (partco , turn_by_turn_monitor = 'ONE_TURN_EBE' )
150+ second_turn = tracker . record_last_track
148151
149152plt .figure (2 )
150153axcox = plt .subplot (2 ,1 ,1 )
151154axcoy = plt .subplot (2 ,1 ,2 , sharex = axcox )
152155plt .suptitle ('Check closed orbit 2 turns' )
153- axcox .plot ([ pp .s [iho ] for pp in list_co ], [ pp .x [iho ] for pp in list_co ])
154- axcox .plot ([ pp .s [iho ] for pp in list_co ], [ pp .x [iho ] for pp in list_co2 ])
156+ axcox .plot (first_turn .s [iho ,:] , first_turn .x [iho ,: ])
157+ axcox .plot (second_turn .s [iho ,:] , second_turn .x [iho ,: ])
155158
156- axcoy .plot ([ pp .s [iho ] for pp in list_co ], [ pp .y [iho ] for pp in list_co ])
157- axcoy .plot ([ pp .s [iho ] for pp in list_co ], [ pp .y [iho ] for pp in list_co2 ])
159+ axcoy .plot (first_turn .s [iho ,:] , first_turn .y [iho ,: ])
160+ axcoy .plot (second_turn .s [iho ,:] , second_turn .y [iho ,: ])
158161
159162plt .figure (20 )
160163axcopx = plt .subplot (2 ,1 ,1 , sharex = axcox )
161164axcopy = plt .subplot (2 ,1 ,2 , sharex = axcox )
162165plt .suptitle ('Check closed orbit 2 turns' )
163- axcopx .plot ([ pp .s [iho ] for pp in list_co ], [ pp .px [iho ] for pp in list_co ])
164- axcopx .plot ([ pp .s [iho ] for pp in list_co ], [ pp .px [iho ] for pp in list_co2 ])
166+ axcopx .plot (first_turn .s [iho ,:] , first_turn .px [iho ,: ])
167+ axcopx .plot (second_turn .s [iho ,:] , second_turn .px [iho ,: ])
165168
166- axcopy .plot ([ pp .s [iho ] for pp in list_co ], [ pp .py [iho ] for pp in list_co ])
167- axcopy .plot ([ pp .s [iho ] for pp in list_co ], [ pp .py [iho ] for pp in list_co2 ])
169+ axcopy .plot (first_turn .s [iho ,:] , first_turn .py [iho ,: ])
170+ axcopy .plot (second_turn .s [iho ,:] , second_turn .py [iho ,: ])
168171
169172plt .figure (3 )
170173axcox = plt .subplot (2 ,1 ,1 )
171174axcoy = plt .subplot (2 ,1 ,2 , sharex = axcox )
172175plt .suptitle ('Check crab' )
173176for iz , zz in enumerate (z_slices ):
174- axcox .plot ([ pp .s [iz ] for pp in list_co ], [ pp .x [iz ] for pp in list_co ])
175- axcoy .plot ([ pp .s [iz ] for pp in list_co ], [ pp .y [iz ] for pp in list_co ])
177+ axcox .plot (first_turn .s [iz ,:] , first_turn .x [iz ,: ])
178+ axcoy .plot (first_turn .s [iz ,:] , first_turn .y [iz ,: ])
176179
177180# For each s_lens, we find the transverse position of the weak beam slice
178181# that collides with the sycnhronous particle of the strong
179182r_lenses = []
180183for ibb , bb in enumerate (bb_elems ):
181- r_lenses .append (getattr (list_co [bb_index [ibb ]], plane )[ibb ])
184+ #r_lenses.append(getattr(list_co[bb_index[ibb]], plane)[ibb])
185+ r_lenses .append (getattr (first_turn , plane )[ibb , bb_index [ibb ]])
182186
183187axcrab .plot (s_rel , r_lenses , 'o' , color = 'b' , alpha = .5 , label = 'weak xsuite' )
184188Rw_crab = phi_c_weak * L_lhc / (2 * np .pi * h_cc ) * np .sin (2 * np .pi * h_cc / L_lhc * 2 * s_rel )
@@ -229,9 +233,10 @@ def prepare_line(path, input_type):
229233 px = 0 * z_test + np .array ([0 , px_twiss [0 ]]),
230234 py = 0 * z_test + np .array ([0 , py_twiss [0 ]]),
231235 delta = 0 * z_test )
232- list_track = ltest .slow_track_elem_by_elem (part )
236+ tracker .track (part , turn_by_turn_monitor = 'ONE_TURN_EBE' )
237+ mon = tracker .record_last_track
233238
234- axcbx .plot ([ pp .s [0 ] for pp in list_track ], [ pp .x [1 ] - pp .x [0 ] for pp in list_track ])
235- axcby .plot ([ pp .s [0 ] for pp in list_track ], [ pp .y [1 ] - pp .y [0 ] for pp in list_track ])
239+ axcbx .plot (mon .s [0 , : ], mon .x [1 , : ] - mon .x [0 , : ])
240+ axcby .plot (mon .s [0 , : ], mon .y [1 , : ] - mon .y [0 , : ])
236241
237242plt .show ()
0 commit comments