simba.Modules.Beams.Particles package
Submodules
simba.Modules.Beams.Particles.centroids module
SIMBA Centroids Module
This module calculates the beam centroids of a particle distribution.
- Classes:
centroids: Centroid calculations.
- class centroids(*args: Any, **kwargs: Any)[source]
Bases:
BaseModelClass for calculating centroids of a particle distribution.
- property mean_cpz: UnitValue
Mean of longitudinal momentum in eV/c
- Returns:
Mean of cpz
- Return type:
- property mean_gamma: UnitValue
Mean relativistic Lorentz factor
- Returns:
Mean of gamma
- Return type:
- property mean_pz: UnitValue
Mean of longitudinal momentum in kg*m/s
- Returns:
Mean of pz
- Return type:
simba.Modules.Beams.Particles.emittance module
SIMBA Emittance Module
This module calculates the beam emittances of a particle distribution. Multiple emittance definitions are provided.
For slice emittance calculations, see slice
- Classes:
emittance: Emittance calculations.
- class emittance(*args: Any, **kwargs: Any)[source]
Bases:
BaseModelClass for calculating emittances of a particle distribution.
- property ecnx: UnitValue
Normalised horizontal emittance of the beam in m-rad corrected for dispersion; see
emittance_calc().- Returns:
x-emittance corrected and normalised
- Return type:
- property ecny: UnitValue
Normalised vertical emittance of the beam in m-rad corrected for dispersion; see
emittance_calc().- Returns:
y-emittance corrected and normalised
- Return type:
- property ecx: UnitValue
Horizontal emittance of the beam in m-rad corrected for dispersion; see
emittance_calc().- Returns:
x-emittance corrected
- Return type:
- property ecy: UnitValue
Vertical emittance of the beam in m-rad corrected for dispersion; see
emittance_calc().- Returns:
y-emittance corrected
- Return type:
- emittance(plane='x', corrected=False)[source]
Calculate the emittance for the plane provided; see
emittance_calc().- Parameters:
plane (str) – Name of the plane to calculate; must be one of [x, y, z]
corrected (bool) – If true, correct with respect to dispersion
- Returns:
The emittance
- Return type:
- Raises:
ValueError – If the plane provided is not one of [x, y, z]
- emittance_calc(x, xp, p=None, units='m-rad')[source]
Calculate the emittance from two arrays using
covariance()- Parameters:
- Returns:
Calculated emittance
- Return type:
- property enx: UnitValue
Normalised horizontal emittance of the beam in m-rad; see
emittance_calc().- Returns:
x-emittance normalised
- Return type:
- property eny: UnitValue
Normalised vertical emittance of the beam in m-rad; see
emittance_calc().- Returns:
y-emittance normalised
- Return type:
- property ex: UnitValue
Horizontal emittance of the beam in m-rad; see
emittance_calc().- Returns:
x-emittance
- Return type:
- property ey: UnitValue
Vertical emittance of the beam in m-rad; see
emittance_calc().- Returns:
y-emittance
- Return type:
- property horizontal_emittance: UnitValue
Horizontal emittance of the beam in m-rad; see
emittance_calc().- Returns:
x-emittance
- Return type:
- property horizontal_emittance_90: UnitValue
Horizontal emittance of 90% of the beam in m-rad; see
emittance_calc().- Returns:
90% x-emittance
- Return type:
- property horizontal_emittance_corrected: UnitValue
Horizontal emittance of the beam in m-rad corrected for dispersion; see
emittance_calc().- Returns:
x-emittance corrected
- Return type:
- property normalised_horizontal_emittance_corrected: UnitValue
Normalised horizontal emittance of the beam in m-rad corrected for dispersion; see
emittance_calc().- Returns:
x-emittance corrected and normalised
- Return type:
- property normalised_vertical_emittance_corrected: UnitValue
Normalised vertical emittance of the beam in m-rad corrected for dispersion; see
emittance_calc().- Returns:
y-emittance corrected and normalised
- Return type:
- normalized_emittance(plane='x', corrected=False)[source]
Calculate the normalised emittance for the plane provided; see
emittance_calc().- Parameters:
plane (str) – Name of the plane to calculate; must be one of [x, y, z]
corrected (bool) – If true, correct with respect to dispersion
- Returns:
The normalised emittance
- Return type:
- Raises:
ValueError – If the plane provided is not one of [x, y, z]
- property normalized_horizontal_emittance: UnitValue
Normalised horizontal emittance of the beam in m-rad; see
emittance_calc().- Returns:
x-emittance normalised
- Return type:
- property normalized_horizontal_emittance_90: UnitValue
Normalised horizontal emittance of 90% of the beam in m-rad; see
emittance_calc().- Returns:
90% x-emittance normalised
- Return type:
- property normalized_vertical_emittance: UnitValue
Normalised vertical emittance of the beam in m-rad; see
emittance_calc().- Returns:
y-emittance normalised
- Return type:
- property normalized_vertical_emittance_90: UnitValue
Normalised vertical emittance of 90% of the beam in m-rad; see
emittance_calc().- Returns:
90% y-emittance normalised
- Return type:
- property vertical_emittance: UnitValue
Vertical emittance of the beam in m-rad; see
emittance_calc().- Returns:
y-emittance
- Return type:
- property vertical_emittance_90: UnitValue
Vertical emittance of 90% of the beam in m-rad; see
emittance_calc().- Returns:
90% y-emittance
- Return type:
- property vertical_emittance_corrected: UnitValue
Vertical emittance of the beam in m-rad corrected for dispersion; see
emittance_calc().- Returns:
y-emittance corrected
- Return type:
simba.Modules.Beams.Particles.kde module
simba.Modules.Beams.Particles.minimumVolumeEllipse module
- getMinVolEllipse(P=None, tolerance=0.01)[source]
Find the minimum volume ellipsoid which holds all the points
Based on work by Nima Moshtagh
Here, P is a numpy array of N dimensional points like this: P = [[x,y,z,…], <– one point per line
[x,y,z,…], [x,y,z,…]]
- Returns:
(center, radii, rotation)
- Return type:
tuple
simba.Modules.Beams.Particles.mve module
- class MVE(beam)[source]
Bases:
object- property density
- property horizontal_mve_emittance
- property normalized_mve_horizontal_emittance
- property normalized_mve_vertical_emittance
- property slice_6D_Volume
- property slice_density
- property slice_normalized_mve_horizontal_emittance
- property slice_normalized_mve_vertical_emittance
- property vertical_mve_emittance
- property volume
simba.Modules.Beams.Particles.sigmas module
SIMBA Sigmas Module
This module calculates the sigmas of a particle distribution.
- Classes:
sigmas: Sigma calculations.
- class sigmas(*args: Any, **kwargs: Any)[source]
Bases:
BaseModelClass for calculating sigmas of a particle distribution.
- property linear_chirp_t_cpz: UnitValue
Linear chirp of the beam as std(t) / (max(cpz) - min(cpz))
- Returns:
Linear chirp t/cpz
- Return type:
- property linear_chirp_t_pz: UnitValue
Linear chirp of the beam as std(t) / (max(pz) - min(pz))
- Returns:
Linear chirp t/pz
- Return type:
- property linear_chirp_z: UnitValue
Linear chirp of the beam as v_z * t / momentum_spread
- Returns:
Linear chirp in z
- Return type:
simba.Modules.Beams.Particles.slice module
SIMBA Slice Module
This module calculates the slice properties of a particle distribution.
- Classes:
slice: Slice calculations.
- class slice(*args: Any, **kwargs: Any)[source]
Bases:
BaseModelClass for calculating slice properties of a particle distribution.
- property alpha_x: UnitValue
Get the slice Twiss horizontal alpha.
- Returns:
Slice alpha
- Return type:
- bin_momentum(width=1000000)[source]
Bin the momentum distribution depending on the width provided. The histogram is calculated and various internal parameters relating to the temporal and momentum slices in the bunch are set.
- Parameters:
width (float) – Width of momentum distribution
- Return type:
None
- bin_time()[source]
Bin the temporal distribution depending on
slice_length. The temporal histogram is calculated and various internal parameters relating to the temporal slices in the bunch are set. Thetime_binneddictionary is then updated.- Return type:
None
- property chirp: UnitValue
Get the longitudinal momentum chirp based on
slice_currentandslice_momentumin eV/s- Returns:
Longitudinal momentum chirp
- Return type:
- property chirp_m1: UnitValue
Get the longitudinal momentum chirp based on
slice_currentandslice_momentumin 1/m- Returns:
Longitudinal momentum chirp
- Return type:
- emitbins(x, y)[source]
Calculate the slice data for two arrays and transpose these with the slice momenta
- property enx: UnitValue
Get the normalised slice horizontal emittance.
Returns
UnitValueNormalised slice horizontal emittance
- property eny: UnitValue
Get the slice vertical emittance.
Returns
UnitValueNormalised slice vertical emittance
- property ex: UnitValue
Get the slice horizontal emittance.
Returns
UnitValueSlice horizontal emittance
- property ey: UnitValue
Get the slice vertical emittance.
Returns
UnitValueSlice vertical emittance
- property gamma_x: UnitValue
Get the slice Twiss horizontal gamma.
- Returns:
Slice gamma
- Return type:
- get_chirp_coeffs(order=3)[source]
Get the momentum chirps up to order-th order based on
slice_currentandslice_momentum- Returns:
Longitudinal momentum chirps
- Return type:
Dict
- have_we_already_been_binned()[source]
Check if time and momentum have already been binned by checking the values in
time_binned- Returns:
True if beam has already been binned
- Return type:
bool
- property peak_current: UnitValue
Get the peak current (i.e. max of
slice_current)- Returns:
Peak current
- Return type:
- set_slices(slices)[source]
Set the slices in the bunch based on the range of time values and the number of slices provided; calls
bin_time().- Parameters:
slices (int) – Number of slices
- Return type:
None
- sliceAnalysis(density=False)[source]
Get various slice properties of the bunch.
- Parameters:
density (bool) – If True, calculate the slice density from
MVE- Returns:
The following slice parameters are returned: -
slice_currentatslice_max_peak_current_slice- standard deviation of slice_current -slice_relative_momentum_spreadatslice_max_peak_current_slice-slice_normalized_horizontal_emittanceatslice_max_peak_current_slice-slice_normalized_vertical_emittanceatslice_max_peak_current_slice-slice_momentumatslice_max_peak_current_slice- slice_density if density is True- Return type:
tuple
- property slice_alpha_x: UnitValue
Get the slice Twiss horizontal alpha.
- Returns:
Slice alpha
- Return type:
- property slice_alpha_y: UnitValue
Get the slice Twiss vertical alpha.
- Returns:
Slice alpha
- Return type:
- property slice_beta_x: UnitValue
Get the slice Twiss horizontal beta.
- Returns:
Slice beta
- Return type:
- property slice_beta_y: UnitValue
Get the slice Twiss vertical beta.
- Returns:
Slice beta
- Return type:
- property slice_bins: UnitValue
Get the slice temporal bins
- Returns:
Slice temporal bins
- Return type:
- property slice_cpbins: UnitValue
Get the slice momentum bins
- Returns:
Slice momentum bins
- Return type:
- property slice_current: UnitValue
Get the slice current based on the bunch charge and temporal binning.
- Returns:
Slice current
- Return type:
- property slice_enx: UnitValue
Get the normalised slice horizontal emittance.
Returns
UnitValueNormalised slice horizontal emittance
- property slice_eny: UnitValue
Get the slice vertical emittance.
Returns
UnitValueNormalised slice vertical emittance
- property slice_ex: UnitValue
Get the slice horizontal emittance.
Returns
UnitValueSlice horizontal emittance
- property slice_ey: UnitValue
Get the slice vertical emittance.
Returns
UnitValueSlice vertical emittance
- property slice_gamma_x: UnitValue
Get the slice Twiss horizontal gamma.
- Returns:
Slice gamma
- Return type:
- property slice_gamma_y: UnitValue
Get the slice Twiss vertical gamma.
- Returns:
Slice gamma
- Return type:
- property slice_horizontal_emittance: UnitValue
Get the slice horizontal emittance.
- Returns:
Slice horizontal emittance
- Return type:
- slice_length(slicelength)
Set the slice length in seconds; sets
_slicelengthand callsbin_time().- Parameters:
slicelength (
UnitValueor float) – Slice length to set.- Return type:
None
- property slice_max_peak_current_slice: int
Get the peak slice current slice from
slice_current.- Returns:
Peak current slice
- Return type:
- property slice_momentum_spread: UnitValue
Get the slice momentum spread (eV/c).
- Returns:
Slice momentum spread
- Return type:
- property slice_normalized_horizontal_emittance: UnitValue
Get the normalised slice horizontal emittance.
- Returns:
Normalised slice horizontal emittance
- Return type:
- property slice_normalized_vertical_emittance: UnitValue
Get the normalised slice vertical emittance.
- Returns:
Normalised slice vertical emittance
- Return type:
- property slice_relative_momentum_spread: UnitValue
Get the slice momentum spread (relative)
- Returns:
Slice momentum spread
- Return type:
- property slice_t: ndarray
Get the slice temporal bins
- Returns:
Slice temporal bins
- Return type:
np.ndarray
- property slice_vertical_emittance: UnitValue
Get the slice vertical emittance.
- Returns:
Slice vertical emittance
- Return type:
- property slice_z: ndarray
Get the slice longitudinal bins
- Returns:
Slice longitudinal bins
- Return type:
np.ndarray
- slices(slices)
Set the number of slices; calls
set_slices()- Parameters:
slices (int) – Number of slices
-
time_binned:
Dict= {'beam': None, 'slice_length': None, 'slices': None} Dictionary representing whether the beam has been binned
- update_binned_parameters()[source]
Update the binned parameters in
time_binned.- Return type:
None
simba.Modules.Beams.Particles.twiss module
SIMBA Twiss Module
This module calculates the Twiss properties of a particle distribution.
- Classes:
twiss: Twiss calculations.
- class twiss(*args: Any, **kwargs: Any)[source]
Bases:
BaseModelClass for calculating Twiss properties of a particle distribution.
- property alpha_x: UnitValue
Get the horizontal Twiss alpha function as -covariance(x, xp) / horizontal_emittance.
- Returns:
Horizontal Twiss alpha
- Return type:
- property alpha_x_corrected: UnitValue
Get the horizontal Twiss beta corrected for dispersion as -covariance(xc, xpc) / horizontal_emittance_corrected.
- Returns:
Corrected horizontal Twiss alpha
- Return type:
- property alpha_y: UnitValue
Get the vertical Twiss beta function as -covariance(y, yp) / horizontal_emittance.
- Returns:
Vertical Twiss alpha
- Return type:
- property alpha_y_corrected: UnitValue
Get the vertical Twiss alpha corrected for dispersion as -covariance(yc, ypc) / vertical_emittance_corrected.
- Returns:
Corrected vertical Twiss alpha
- Return type:
- property beta_x: UnitValue
Get the horizontal Twiss beta function as covariance(x, x) / horizontal_emittance.
- Returns:
Horizontal Twiss beta
- Return type:
- property beta_x_corrected: UnitValue
Get the horizontal Twiss beta corrected for dispersion as covariance(xc, xc) / horizontal_emittance_corrected.
- Returns:
Corrected horizontal Twiss beta
- Return type:
- property beta_y: UnitValue
Get the vertical Twiss beta function as covariance(y, y) / horizontal_emittance.
- Returns:
Vertical Twiss beta
- Return type:
- property beta_y_corrected: UnitValue
Get the vertical Twiss beta corrected for dispersion as covariance(yc, yc) / vertical_emittance_corrected.
- Returns:
Corrected vertical Twiss beta
- Return type:
- calculate_etax()[source]
Get the horizontal dispersion and its derivative.
- Returns:
Horizontal dispersion
Derviative of horizontal dispersion
Mean of temporal distribution
- Return type:
tuple
- calculate_etay()[source]
Get the vertical dispersion and its derivative.
- Returns:
Vertical dispersion
Derviative of vertical dispersion
Mean of temporal distribution
- Return type:
tuple
- property corrected: Dict
Get the following Twiss parameters (corrected for dispersion) as a dictionary keyed by name: -
normalized_horizontal_emittance-horizontal_emittance-alpha_x-beta_x-normalized_vertical_emittance-vertical_emittance-alpha_y-beta_y- Returns:
Dictionary of corrected Twiss parameters
- Return type:
Dict
- property eta_x: UnitValue
Get the horizontal dispersion; see
calculate_etax().- Returns:
Horizontal dispersion
- Return type:
- property eta_xp: UnitValue
Get the derivative of horizontal dispersion; see
calculate_etax().- Returns:
Horizontal dispersion derivative
- Return type:
- property eta_y: UnitValue
Get the vertical dispersion; see
calculate_etay().- Returns:
Vertical dispersion
- Return type:
- property eta_yp: UnitValue
Get the derivative of vertical dispersion; see
calculate_etay().- Returns:
Vertical dispersion derivative
- Return type:
- property gamma_x: UnitValue
Get the horizontal Twiss alpha function as covariance(xp, xp) / horizontal_emittance.
- Returns:
Horizontal Twiss gamma
- Return type:
- property gamma_x_corrected: UnitValue
Get the horizontal Twiss gamma corrected for dispersion as covariance(xpc, xpc) / horizontal_emittance_corrected.
- Returns:
Corrected horizontal Twiss gamma
- Return type:
- property gamma_y: UnitValue
Get the vertical Twiss gamma function as covariance(yp, yp) / horizontal_emittance.
- Returns:
Vertical Twiss gamma
- Return type:
- property gamma_y_corrected: UnitValue
Get the vertical Twiss gamma corrected for dispersion as covariance(ypc, ypc) / vertical_emittance_corrected.
- Returns:
Corrected vertical Twiss gamma
- Return type:
- property horizontal_emittance: UnitValue
Get the horizontal emittance; see
horizontal_emittance.- Returns:
Horizontal emittance
- Return type:
- property horizontal_emittance_corrected: UnitValue
Get the horizontal emittance corrected for dispersion; see
horizontal_emittance_corrected.- Returns:
Corrected horizontal emittance
- Return type:
- property normal: Dict
Get the following Twiss parameters as a dictionary keyed by name: -
normalized_horizontal_emittance-horizontal_emittance-alpha_x-beta_x-normalized_vertical_emittance-vertical_emittance-alpha_y-beta_y- Returns:
Dictionary of Twiss parameters
- Return type:
Dict
- property normalized_horizontal_emittance: UnitValue
Get the normalized horizontal emittance; see
normalized_horizontal_emittance.- Returns:
Normalized horizontal emittance
- Return type:
- property normalized_vertical_emittance: UnitValue
Get the normalized vertical emittance; see
normalized_vertical_emittance.- Returns:
Normalized vertical emittance
- Return type:
- property twiss_analysis: tuple
Get the calculated Twiss parameters as a tuple.
- Returns:
Calculated Twiss parameters in the following order: -
horizontal_emittance-alpha_x-beta_x-gamma_x-vertical_emittance-alpha_y-beta_y-gamma_y- Return type:
tuple
- property twiss_analysis_corrected: tuple
Get the calculated Twiss parameters corrected for dispersion as a tuple.
- Returns:
Calculated Twiss parameters in the following order: -
horizontal_emittance_corrected-alpha_x_corrected-beta_x_corrected-gamma_x_corrected-vertical_emittance_corrected-alpha_y_corrected-beta_y_corrected-gamma_y_corrected- Return type:
tuple
Module contents
SIMBA Particles Module
This module defines the class and utilities for storing a particle distribution.
Each beam consists of particles represented in 6-dimensional phase space (x, cpx, y, cpy, z, cpz), and appropriate transformations of these coordinates are also accessible as properties.
Functions are also available for rematching the beam based on Twiss parameters.
- Classes:
Particles: Container for a particle distribution.
- class Particles(*args: Any, **kwargs: Any)[source]
Bases:
BaseModelClass describing particles in 6D phase space [x (m), y (m), z (m) / t (s), px (kg*m/s), py (kg*m/s), pz (kg*m/s)].
The following objects are created based on this distribution:
The following properties are derived from these arrays:
fullbeam– the transpose of the 6D array.
angular distributions, corrected for dispersion.
deltap– fractional momentum deviation from the mean.[
p,cp] – total beam momentum in kg*m/s and eV/c, respectively.gamma– relativistic Lorentz factor.Brho– magnetic rigidity.BetaGamma– beam momentum as beta*gamma.[
kinetic_energy,mean_energy] – kinetic energy in J and its mean.E0_eV– rest energy of the particles in eV.Q– total charge of the bunch in C.
- property BetaGamma: UnitValue
Get the beam momentum as beta*gamma
- Returns:
Beam momentum
- Return type:
- property Brho: UnitValue
Get the magnetic rigidity in the longitudinal direction
- Returns:
Magnetic rigidity
- Return type:
- property Bx: UnitValue
Get the horizontal relativistic beta
- Returns:
The horizontal relativistic beta
- Return type:
- property By: UnitValue
Get the vertical relativistic beta
- Returns:
The vertical relativistic beta
- Return type:
- property Bz: UnitValue
Get the longitudinal relativistic beta
- Returns:
The longitudinal relativistic beta
- Return type:
- property E0_eV: UnitValue
Get the particle rest energy in eV; see
particle_rest_energy_eV- Returns:
Particle rest energy
- Return type:
- property Ex: UnitValue
Get the horizontal beam energy in eV
- Returns:
The horizontal beam energy
- Return type:
- property Ey: UnitValue
Get the longitudinal beam energy in eV
- Returns:
The longitudinal beam energy
- Return type:
- property Ez: UnitValue
Get the longitudinal beam energy in eV
- Returns:
The longitudinal beam energy
- Return type:
- property Q: UnitValue
Get the total charge of the bunch in C
- Returns:
The total charge
- Return type:
- apply_mask(mask)[source]
Cut the beam with respect to a mask, removing some particles
- Parameters:
mask (int | np.ndarray | list) – Mask to apply
- Return type:
None
- property centroids: centroids
Get the centroids from the distribution.
- Returns:
Beam centroids
- Return type:
-
charge:
UnitValue|list|ndarray= None Charge of the particle [C] – can be all the same, or variable
-
charge_sign_index:
Dict= {1: -1, 2: 1, 3: 1, 4: 1} Dictionary representing the index and charge of supported particles
- property chargesign: list
Get the sign of charge all particles
- Returns:
The charge signs of all particles
- Return type:
list
- computeCorrelations(x, y)[source]
Get the covariances (cov(x,x), cov(x,y), cov(y,y)), see
covariance()
- property cpx: UnitValue
Get the horizontal momentum in eV/c
- Returns:
The horizontal momentum
- Return type:
- property cpy: UnitValue
Get the vertical momentum in eV/c
- Returns:
The vertical momentum
- Return type:
- property cpz: UnitValue
Get the longitudinal momentum in eV/c
- Returns:
The longitudinal momentum
- Return type:
- property deltap: UnitValue
Get the fractional beam momentum
- Returns:
The fractional momentum
- Return type:
- property emittance: emittance
Get the emittance calculations from the distribution.
- Returns:
Beam emittance
- Return type:
- property energy: UnitValue
Get the energy of the particles in eV
- Returns:
The beam energy
- Return type:
- eta_corrected(u)[source]
Correct a column with respect to the beam momentum, subtracting
eta_correlation()from u multiplied withp
- property fullbeam: ndarray
Get the full beam as a transpose of all six columns.
- Returns:
The beam object as [x,y,z,px,py,pz]
- Return type:
np.ndarray
- property gamma: UnitValue
Get the relativistic Lorentz factor of the beam distribution
- Returns:
Lorentz factor
- Return type:
- get_particle_index(m, q)[source]
Get the index of a particle from mass and charge index.
- Parameters:
m (float) – Mass of particle
q (int) – Charge of particle
- Returns:
Particle index (see
mass_indexandcharge_sign_index.- Return type:
int
- property kde: kde
Get the kernel density estimator from the distribution.
- Returns:
KDE
- Return type:
- property kinetic_energy: UnitValue
Get the kinetic energy of the particles in J
- Returns:
Kinetic energy of particles
- Return type:
-
mass:
UnitValue|list|ndarray= None Mass of particles [kg] – can be all the same, or variable #TODO deprecated?
-
mass_index:
Dict= {1: 9.1093837015e-31, 2: 9.1093837015e-31, 3: 1.67262192595e-27, 4: 1.67262192595e-27} Dictionary representing the index and mass of supported particles
- property mean_energy: UnitValue
Get the mean energy of the particles in J (the mean of
kinetic_energy)- Returns:
Mean energy of particles
- Return type:
- property mve: Any
Get the minimum volume ellipse from the distribution.
- Returns:
The MVE
- Return type:
- property p: UnitValue
Get the total beam momentum in kg*m/s
- Returns:
The beam momentum
- Return type:
-
particle_charge:
UnitValue|list|ndarray= None Charge of the particle [C] – can be all the same, or variable #TODO deprecated?
- property particle_index: list
Get the particle index from the mass and charge of all particles.
- Returns:
The particle index for all
particle_massandcharge.- Return type:
list
-
particle_mass:
UnitValue|list|ndarray= None Mass of particles [kg] – can be all the same, or variable
- performTransformation(x, xp, beta=False, alpha=False, nEmit=False)[source]
Transform the arrays provided with respect to the Twiss and emittance functions given.
- Parameters:
x (
UnitValueor np.ndarray) – The first arrayxp (
UnitValueor np.ndarray) – The second arraybeta (
UnitValueor float or bool) – The beta function to transform the arrays; if False, usecomputeCorrelations()alpha (
UnitValueor float or bool) – The alpha function to transform the arrays; if False, usecomputeCorrelations()nEmit (
UnitValueor float or bool) – The emittance to transform the arrays; if False, usecomputeCorrelations()
- Returns:
The transformed arrays
- Return type:
tuple
- performTransformationPeakISlice(xslice, xpslice, x, xp, beta=None, alpha=None, nEmit=None)[source]
Transform the arrays provided with respect to the Twiss and emittance functions given, or match the arrays with respect to their values at a given slice.
- Parameters:
xslice (
UnitValueor np.ndarray) – The first array at a given slicexpslice (
UnitValueor np.ndarray) – The second array at a given slicex (
UnitValueor np.ndarray) – The first arrayxp (
UnitValueor np.ndarray) – The second arraybeta (
UnitValueor float or bool) – The beta function to transform the arrays; if False, usecomputeCorrelations()alpha (
UnitValueor float or bool) – The alpha function to transform the arrays; if False, usecomputeCorrelations()nEmit (
UnitValueor float or bool) – The emittance to transform the arrays; if False, usecomputeCorrelations()
- Returns:
The transformed arrays
- Return type:
tuple
- rematchXPlane(beta=None, alpha=None, nEmit=None)[source]
Rematch
xandxpwith respect to the Twiss and emittance functions given.- Parameters:
- Return type:
None
- rematchXPlanePeakISlice(beta=False, alpha=False, nEmit=False)[source]
Rematch
xandxpwith respect to the Twiss and emittance functions given, or their values at the peak current slice; seeperformTransformationPeakISlice().- Parameters:
- Return type:
None
- rematchYPlane(beta=False, alpha=False, nEmit=False)[source]
Rematch
yandypwith respect to the Twiss and emittance functions given.- Parameters:
- Return type:
None
- rematchYPlanePeakISlice(beta=False, alpha=False, nEmit=False)[source]
Rematch
yandypwith respect to the Twiss and emittance functions given, or their values at the peak current slice; seeperformTransformationPeakISlice().- Parameters:
- Return type:
None
- set_total_charge(q)[source]
Set the total charge of the bunch in C.
This will also update the charge of the individual particles.
- Parameters:
q (float) – The total charge
- Return type:
None
- property sigmas: sigmas
Get the beam sigmas from the distribution.
- Returns:
Beam sigmas
- Return type:
- property slice: slice
Get the slice properties from the distribution.
- Returns:
The slice properties
- Return type:
slices
-
species_name:
Dict= {1: 'electron', 2: 'positron', 3: 'proton', 4: 'hydrogen'}
-
theta:
UnitValue|float= 0.0 Horizontal rotation of particle distribution with respect to the nominal axis [rad]
- property twiss: twiss
Get the Twiss parameters from the distribution.
- Returns:
Twiss parameters
- Return type:
- property xc: UnitValue
Get the horizontal distribution corrected with respect to dispersion
- Returns:
The corrected horizontal distribution
- Return type:
- property xp: UnitValue
Get the horizontal momentum angle in rad
- Returns:
The horizontal angle
- Return type:
- property xpc: UnitValue
Get the horizontal angle corrected with respect to dispersion
- Returns:
The corrected horizontal angle
- Return type:
- property yc: UnitValue
Get the vertical distribution corrected with respect to dispersion
- Returns:
The corrected vertical distribution
- Return type:
- property yp: UnitValue
Get the vertical momentum angle in rad
- Returns:
The vertical angle
- Return type: