particle module

Define objects to store initial state/trajectory of a particle.

class ParticleInitialState(w_kin, phi_abs, z_in, synchronous)[source]

Bases: object

Hold the initial energy/phase of a particle, and if it is synchronous.

It is used for ListOfElements attribute.

Parameters:
w_kin: float
phi_abs: float
z_in: float
synchronous: bool
property tracewin_command: list[str]

Create the energy and phase arguments for TraceWin command.

__init__(w_kin, phi_abs, z_in, synchronous)
Parameters:
class ParticleFullTrajectory(w_kin, phi_abs, synchronous, beam)[source]

Bases: object

Hold the full energy, phase, etc of a particle.

It is stored in a SimulationOutput.

Phase is defined as:

\[\phi = \omega_{0,\,\mathrm{bunch}} t\]

while in Field it is:

\[\phi = \omega_{0,\,\mathrm{rf}} t\]
Parameters:
w_kin: ndarray | list
phi_abs: ndarray | list
synchronous: bool
beam: dict[str, ndarray[tuple[int, ...], dtype[float64]] | float]
__post_init__()[source]

Ensure that LightWin has everything it needs, with proper format.

__str__()[source]

Show amplitude of phase and energy.

Return type:

str

property tracewin_command: list[str]

Raise an error, this method should be called from InitialPart.

compute_complementary_data()[source]

Compute some data necessary to do the post-treatment.

has(key)[source]

Tell if the required attribute is in this class.

Parameters:

key (str)

Return type:

bool

get(*keys, to_deg=False, **kwargs)[source]

Shorthand to get attributes.

Parameters:
  • keys (Literal['beta', 'gamma', 'phi_abs', 'synchronous', 'w_kin', 'z_in'] | Literal['e_mev', 'e_rest_mev', 'f_bunch_mhz', 'i_milli_a', 'q_adim', 'sigma', 'inv_e_rest_mev', 'gamma_init', 'omega_0_bunch', 'lambda_bunch', 'q_over_m', 'm_over_q'])

  • to_deg (bool, default: False)

  • kwargs (dict)

Return type:

tuple[Any]

__init__(w_kin, phi_abs, synchronous, beam)
Parameters: