Tracking¶
- xtrack_tools.tracking.run_tracking(line, particles, nturns, monitor_names=None, replace_thick_monitors_with_thin=True)[source]¶
Track particles through a copied line for a fixed number of turns.
- Parameters:
line (xt.Line) – The xsuite line to copy and track through.
particles (xt.Particles) – Particles to track.
nturns (int) – Number of turns to track.
monitor_names (list[str] | None) – Element names to pass to
multi_element_monitor_at.replace_thick_monitors_with_thin (bool) – If
True, insert thin markers at the centres of thick monitored elements before tracking while keeping the recorded monitor names mapped back to the originals. Thin monitors are left unchanged.
- Returns:
A tracked copy of
line. The input line is not modified.- Raises:
RuntimeError – If tracking ends with non-successful particle state.
- Return type:
xt.Line
- xtrack_tools.tracking.run_tracking_without_ac_dipole(line, tws, flattop_turns, bpm_pattern='bpm.*[^k]', particle_coords=None, action_list=None, angle_list=None, use_diagonal_kicks=True, start_marker=None, deltas=None, context=None, replace_thick_monitors_with_thin=True)[source]¶
Track particles without an AC dipole using a multi-element BPM monitor.
- Parameters:
line (xt.Line) – Base line to copy and track.
tws (xt.TwissTable | pd.DataFrame) – xsuite Twiss table or MAD-NG-normalised DataFrame used to convert action-angle to coordinates.
flattop_turns (int) – Number of turns to track at flat top.
bpm_pattern (str) – Regex pattern for BPM element names.
particle_coords (dict[str, list[float]] | None) – Explicit particle coordinate arrays.
action_list (list[float] | None) – Action values used with
angle_listto build coordinates.angle_list (list[float] | None) – Angle values used with
action_listto build coordinates.use_diagonal_kicks (bool) – If
True, use action-angle in both planes.start_marker (str | None) – Optional marker name to set as the first element.
deltas (list[float] | float | None) – Optional momentum offsets per particle.
context (Context | None) – Optional xobjects context.
replace_thick_monitors_with_thin (bool) – If
True, replace thick monitored elements with thin monitor points before tracking. Thin monitors are left unchanged.
- Returns:
The monitored line after tracking.
- Raises:
ValueError – If neither explicit coordinates nor action-angle inputs are provided.
- Return type:
xt.Line
- xtrack_tools.tracking.start_tracking_xsuite_batch(env, batch_start, batch_end, action_list, angle_list, twiss_data, use_diagonal_kicks, flattop_turns, progress_interval, num_tracks, true_deltap, seq_name, replace_thick_monitors_with_thin=True)[source]¶
Track a batch of particles defined by action-angle coordinates.
- Parameters:
env (xt.Environment) – xsuite environment containing the target sequence.
batch_start (int) – Inclusive start index for the batch.
batch_end (int) – Exclusive end index for the batch.
action_list (list[float]) – Action values for initial conditions.
angle_list (list[float]) – Angle values for initial conditions.
twiss_data (tfs.TfsDataFrame) – Twiss data table for coordinate conversion.
use_diagonal_kicks (bool) – If
True, initialize both planes.flattop_turns (int) – Number of turns to track.
progress_interval (int) – Logging interval for batch progress.
num_tracks (int) – Total number of tracks for progress reporting.
true_deltap (float) – Momentum deviation applied to all particles.
seq_name (str) – Sequence name in the environment.
replace_thick_monitors_with_thin (bool) – If
True, replace thick monitored elements with thin monitor points before tracking. Thin monitors are left unchanged.
- Returns:
The tracked line with multi-element monitor data recorded.
- Return type:
xt.Line