Twiss

Xtrack provides a twiss method associated to the tracker that can be used to obtain the twiss parameters and other quantities like tunes, chromaticities, slip factor, etc. This is illustrated in the following example.

import json
import numpy as np

import xobjects as xo
import xtrack as xt
import xpart as xp

###############
# Load a line #
###############

fname_line_particles = '../../test_data/hllhc15_noerrors_nobb/line_and_particle.json'

with open(fname_line_particles, 'r') as fid:
    input_data = json.load(fid)
line = xt.Line.from_dict(input_data['line'])
line.particle_ref = xp.Particles.from_dict(input_data['particle'])

#################
# Build tracker #
#################

tracker = xt.Tracker(line=line)

#########
# Twiss #
#########

tw = tracker.twiss()
_images/twiss.png

Twiss functions and accelerator parameters as obtained by Xtrack twiss. See the full code generating the image.