Xpart API

The particle class

class xpart.Particles(s=0.0, x=0.0, px=0.0, y=0.0, py=0.0, delta=None, ptau=None, psigma=None, rvv=None, zeta=None, tau=None, sigma=None, mass0=938272081.0, q0=1.0, p0c=None, energy0=None, gamma0=None, beta0=None, chi=None, mass_ratio=None, charge_ratio=None, particle_id=None, parent_particle_id=None, at_turn=None, state=None, weight=None, at_element=None, mathlib=<class 'xline.mathlibs.MathlibDefault'>, **args)

Particle objects have the following fields:

  • s [m]: Reference accumulated pathlength

  • x [m]: Horizontal position

  • px[1]: Px / (m/m0 * p0c) = beta_x gamma /(beta0 gamma0)

  • y [m]: Vertical position

  • py [1]: Py / (m/m0 * p0c)

  • delta[1]: Pc / (m/m0 * p0c) - 1

  • ptau [1]: Energy / (m/m0 * p0c) - 1

  • psigma [1]: ptau/beta0

  • rvv [1]: beta/beta0

  • rpp [1]: 1/(1+delta) = (m/m0 * p0c) / Pc

  • zeta [m]: beta (s/beta0 - ct )

  • tau [m]:

  • sigma [m]: s - beta0 ct = rvv * zeta

  • mass0 [eV]:

  • q0 [e]: Reference charge

  • p0c [eV]: Reference momentum

  • energy0 [eV]: Reference energy

  • gamma0 [1]: Reference relativistic gamma

  • beta0 [1]: Reference relativistix beta

  • chi [1]: q/ q0 * m0/m = qratio / mratio

  • mass_ratio [1]: mass/mass0

  • charge_ratio [1]: q / q0

  • particle_id [int]: Identifier of the particle

  • at_turn [int]: Number of tracked turns

  • state [int]: It is 0 if the particle is lost, 1 otherwise

  • weight [int]: particle weight in number of particles (for collective sims.)

  • at_element [int]: Identifier of the last element through which the particle has been

  • parent_particle_id [int]: Identifier of the parent particle (secondary production processes)

clight = 299792458
pi = 3.141592653589793
echarge = 1.602176565e-19
emass = 510998.928
pmass = 938272081.0
epsilon0 = 8.854187817e-12
mu0 = 1.2566370614359173e-06
eradius = 5.0234346981155707e-51
pradius = 2.7358479460235164e-54
anumber = 6.02214129e+23
kboltz = 1.3806488e-23
copy(index=None)
property Px
property Py
property energy
property pc
property mass
property beta
property rvv
property rpp
add_to_energy(energy)
property delta
property psigma
property tau
property sigma
property ptau
property mass0
property beta0
property gamma0
property p0c
property energy0
property mass_ratio
property charge_ratio
property chi
remove_lost_particles(keep_memory=True)
to_dict()
classmethod from_dict(dct)
to_json(filename)
classmethod from_json(filename)
compare(particle, rel_tol=1e-06, abs_tol=1e-15)
classmethod from_madx_twiss(twiss)
classmethod from_madx_track(mad)
classmethod from_list(lst)