phase_space_beam_parameters module

Handle the beam parameters of a single phase space.

For a list of the units associated with every parameter, see Units and conventions.

Note

In this module, angles are stored in deg, not in rad!

class PhaseSpaceBeamParameters(phase_space_name: Literal['zdelta', 'z', 'phiw', 'x', 'y', 't', 'phiw99', 'x99', 'y99'], eps_no_normalization: ndarray, eps_normalized: ndarray, envelopes: ndarray | None = None, twiss: ndarray | None = None, sigma: ndarray | None = None, tm_cumul: ndarray | None = None, mismatch_factor: ndarray | None = None)

Bases: IPhaseSpaceBeamParameters

Hold Twiss, emittance, envelopes of a single phase-space.

eps_no_normalization: ndarray
eps_normalized: ndarray
mismatch_factor: ndarray | None = None
classmethod from_cumulated_transfer_matrices(phase_space_name: str, sigma_in: ndarray, tm_cumul: ndarray, gamma_kin: ndarray, beta_kin: ndarray, beam_kwargs: dict[str, Any]) Self

Compute \(\sigma\) matrix, and everything from it.

classmethod from_sigma(phase_space_name: str, sigma: ndarray, gamma_kin: ndarray, beta_kin: ndarray, beam_kwargs: dict[str, Any], **kwargs: ndarray) Self

Compute Twiss, eps, envelopes just from sigma matrix.

classmethod from_other_phase_space(other_phase_space: Self, phase_space_name: str, gamma_kin: ndarray, beta_kin: ndarray, beam_kwargs: dict[str, Any], **kwargs: ndarray) Self

Fully initialize from another phase space.

classmethod from_averaging_x_and_y(phase_space_name: str, x_space: Self, y_space: Self) Self

Create average transverse phase space from [xx’] and [yy’].

eps is always initialized. mismatch_factor is calculated if it was already calculated in x_space and y_space.

property alpha: ndarray | None

Get first column of self.twiss.

property beta: ndarray | None

Get second column of self.twiss.

property gamma: ndarray | None

Get third column of self.twiss.

property envelope_pos: ndarray | None

Get first column of self.envelopes.

__init__(phase_space_name: Literal['zdelta', 'z', 'phiw', 'x', 'y', 't', 'phiw99', 'x99', 'y99'], eps_no_normalization: ndarray, eps_normalized: ndarray, envelopes: ndarray | None = None, twiss: ndarray | None = None, sigma: ndarray | None = None, tm_cumul: ndarray | None = None, mismatch_factor: ndarray | None = None) None
_abc_impl = <_abc._abc_data object at 0x7f36f97e8fc0>
property envelope_energy: ndarray | None

Get second column of self.envelopes.

property eps: ndarray

Return the normalized emittance.

property non_norm_eps: ndarray

Return the non-normalized emittance.

property sigma_in: ndarray

Return the first \(\sigma\) beam matrix.

set_mismatch(reference_phase_space: Self, reference_z_abs: ndarray, z_abs: ndarray, raise_missing_twiss_error: bool = True, **mismatch_kw: bool) None

Compute and set the mismatch with reference_phase_space.

Parameters:
  • reference_phase_space (PhaseSpaceBeamParameters) – Beam parameters in the same phase space, corresponding to the reference linac.

  • reference_z_abs (numpy.ndarray) – Positions corresponding to reference_phase_space.

  • z_abs (numpy.ndarray) – Positions in the linac under study.

  • raise_missing_twiss_error (bool) – If set to True and the Twiss parameters were not calculated in current phase space, raise an error.

  • mismatch_kw (bool) – Keyword arguments passed to the function computing mismatch factor.