at.tracking.particles#
Functions relating to particle generation
Functions
|
Generates an array of random particles according to the given \(\Sigma\)-matrix |
|
Calculate the correlation matrix \(\Sigma\) to be used for particle generation |
- beam(nparts, sigma, orbit=None)[source]#
Generates an array of random particles according to the given \(\Sigma\)-matrix
- Parameters:
nparts (int) – Number of particles
sigma – \(\Sigma\)-matrix as calculated by
sigma_matrix()
orbit (ndarray | None) – An orbit can be provided to give a center of mass offset to the distribution
- Returns:
particle_dist – a (6, nparts) matrix of coordinates
- sigma_matrix(ring=None, **kwargs)[source]#
Calculate the correlation matrix \(\Sigma\) to be used for particle generation
- Parameters:
ring (Lattice | None) – Lattice object or list of twiss parameters.
- Keyword Arguments:
beam – Particle coordinates
twiss_in – Data structure containing input twiss parameters.
betax (float) – Input horizontal beta function [m]
alphax (float) – Input horizontal alpha function [m]
emitx (float) – Horizontal emittance [m.rad]
betay (float) – Input vertical beta function [m]
alphay (float) – Input vertical alpha function [m]
emity (float) – Vertical emittance [m.rad]
blength (float) – One sigma bunch length [m]
espread (float) – One sigma energy spread [dp/p]
- Returns:
sigma_matrix – (6, 6) \(\Sigma\)-matrix
beam is a (6, nparticles) coordinates array of a particle population. If provided, all other parameters are ignored.
If twiss_in is provided, its R or alpha and beta fields are used, emitx and emity must be provided.
If ring is provided:
for a 6d lattice,
ohmi_envelope()
is called to compute the equilibrium emittances. emitx, emity may overload these values.for a 4d lattice, emitx, emity must be provided.
Otherwise, alphax, betax, emitx, alphay, betay and emity must be provided. The result is an uncoupled \(\Sigma\)-matrix
If espread and blength are not specified, the results is a monochromatic beam.