ParticleBunch#

class wake_t.particles.particle_bunch.ParticleBunch(w, x=None, y=None, xi=None, px=None, py=None, pz=None, bunch_matrix=None, matrix_type='standard', gamma_ref=None, tags=None, prop_distance=0, t_flight=0, z_injection=None, name=None, q_species=-1.602176634e-19, m_species=9.1093837139e-31)[source]#

Defines a particle bunch.

Parameters:
wndarray

Weight of the macroparticles, i.e., the number of real particles represented by each macroparticle. In practice, \(w = q_m / q\), where \(q_m\) and \(q\) are, respectively the charge of the macroparticle and of the real particle (e.g., an electron).

x, y, xindarray

Position of the macropparticles in the x, y, and xi directions in units of m.

px, py, pzndarray

Momentum of the macropparticles in the x, y, and z directions in non-dimensional units (beta*gamma).

bunch_matrixndarray

6 x N matrix, where N is the number of particles, containing the phase-space information of the bunch. If provided, the arguments x to pz are not considered. The matrix contains (x, px, y, py, z, pz) if matrix_type=’standard’ or (x, x’, y, y’, xi, dp) if matrix_type=’alternative’.

matrix_typestring

Indicates the type of bunch_matrix. Possible values are ‘standard’ or ‘alternative’ (see above).

gamma_reffloat

Reference energy with respect to which the particle momentum dp is calculated. Only needed if bunch_matrix is used and matrix_type=’alternative’.

tagsndarray

Individual tags assigned to each particle.

prop_distancefloat

Propagation distance of the bunch along the beamline.

t_flightfloat

Time of flight of the bunch along the beamline.

z_injection: float

Particles have a ballistic motion for z<z_injection (in meters).

namestr

Name of the particle bunch. Used for species identification in openPMD diagnostics.

q_species, m_speciesfloat

Charge and mass of a single particle of the species represented by the macroparticles. For an electron bunch (default), q_species=-e and m_species=m_e

Methods

copy()

Return a copy of the bunch.

evolve(fields, t, dt[, pusher])

Evolve particle bunch to the next time step.

get_6D_matrix()

Returns the 6D phase space matrix of the bunch containing (x, px, y, py, xi, pz)

get_6D_matrix_with_charge()

Returns the 6D phase space matrix of the bunch containing (x, px, y, py, xi, pz)

get_alternative_6D_matrix()

Returns the 6D matrix of the bunch containing (x, x', y, y', xi, dp)

get_bunch_matrix()

Returns a matrix with the 6D phase space and charge of the bunch

get_field_arrays()

Get the arrays where the gathered fields will be stored.

get_openpmd_diagnostics_data(global_time)

Returns a dictionary with the necessary data to write the openPMD diagnostics of the particle bunch.

get_rk4_arrays()

Get the arrays needed by the RK4 pusher.

increase_prop_distance(dist)

Increases the propagation distance

reposition_xi(xi_c)

Recenter bunch along xi around the specified xi_c

set_bunch_matrix(beam_matrix)

Sets the 6D phase space and charge of the bunch

set_name(name)

Set the particle bunch name

set_phase_space(x, y, xi, px, py, pz)

Sets the phase space coordinates

set_phase_space_from_alternative_matrix(...)

Sets the phase space coordinates from a matrix with the values of (x, x', y, y', xi, dp).

set_phase_space_from_matrix(beam_matrix)

Sets the phase space coordinates from a matrix with the values of (x, px, y, py, xi, pz).

show(**kwargs)

Show the phase space of the bunch in all dimensions.

Attributes

q

Get an array with the charge of each macroparticle.