:mod:`ocelot.utils.acc_utils` ============================= .. py:module:: ocelot.utils.acc_utils Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: ocelot.utils.acc_utils.RTU_56 ocelot.utils.acc_utils.chicane_RTU ocelot.utils.acc_utils.bunching ocelot.utils.acc_utils.slice_bunching ocelot.utils.acc_utils.calculate_mismatch ocelot.utils.acc_utils.rf2beam ocelot.utils.acc_utils.beam2rf ocelot.utils.acc_utils.beam2rf_xfel_linac ocelot.utils.acc_utils.rf2beam_xfel_linac .. data:: __author__ :annotation: = Sergey Tomin .. function:: RTU_56(LB, LD, r, m) .. function:: chicane_RTU(yoke_len, dip_dist, r, type) Method calculate R56, T566, U5666 and path length of the reference particle for chicanes 's' and 'c' type :param yoke_len: dipole yoke length :param dip_dist: distance between 1st and 2nd dipoles on Z-axis (not a particle path but projection on Z-axis) :param r: radii of the dipoles :param type: type of the chicane "s" or "c" :return: R56, T566, U5666, Sref (distance between magnet 2 and 3 is 0) .. function:: bunching(p_array, lambda_mod, smooth_sigma=None) Function calculates bunching factor for wavelength lambda_mod $b(\lambda) = rac{1}{N_0}\left| \langle e^{- i rac{ 2 \pi}{\lambda} s} N(s) angle ight|$ :param p_array: ParticleArray :param lambda_mod: wavelength :param smooth_sigma: smoothing parameter :return: bunching factor .. function:: slice_bunching(tau, charge, lambda_mod, smooth_sigma=None) Function calculates bunching factor for wavelength lambda_mod $b(\lambda) = rac{1}{N_0}\left| \langle e^{- i rac{ 2 \pi}{\lambda} s} N(s) angle ight|$ :param p_array: ParticleArray :param lambda_mod: wavelength :param smooth_sigma: smoothing parameter :return: bunching factor .. function:: calculate_mismatch(tws_des, tws_err) Function calculates mismatch and mismatch phase using two twiss lists. Result is saved in tws_err list as M_x, M_y, psi_x, psi_y :param tws_des: list, design twiss parameters :param tws_err: list, error twiss parameters :return: (Mx, My, phi_x, phi_y) mismatch at the end of lattice .. function:: rf2beam(v1, phi1, vh, phih, n=3, freq=1300000000.0, E0=0.00675, zeta1=0.0, zeta2=0.0, zeta3=0.0) Function calculates beam parameters: the final beam energy, chirp, curvature, skewness, from the RF parameters: voltages and phases. Note: in EuXFEL case, L1: E0 = 130 MeV, to get correct Sum Voltage for L1/L2, E1' = E1 - E0 :param v1: voltage [GeV] of the first harmonic cavity :param phi1: phase [deg] of the first harmonic cavity :param vh: voltage [GeV] of the high harmonic cavity :param phih: phase [deg] of the high harmonic cavity :param n: 3, number of harmonic of the high harmonic cavity. If n = 0 the high harmonic cavity does not exist :param freq: frequency [Hz] of the first harmonic cavity :param E0: initial beam energy [GeV] (from the gun) :param zeta1: initial beam chirp (from the gun) :param zeta2: initial beam curvature (from the gun) :param zeta3: initial beam skewness (from the gun) :return: E1, chirp, curvature, skewness .. function:: beam2rf(E1, chirp, curvature, skewness, n, freq, E0=0.00675, zeta1=0.0, zeta2=0.0, zeta3=0.0) Function calculates RF parameters: cavities (first and high harmonic) voltage [GV] and phase [deg] from the final beam energy, chirp, curvature, skewness. :param E1: the beam energy [GeV] after RF system :param chirp: the beam chirp :param curvature: the beam curvature :param skewness: the beam skewness :param n: 3, number of harmonic of the high harmonic cavity. If n = 0 the high harmonic cavity does not exist. :param freq: frequency [Hz] of the first harmonic cavity :param E0: initial beam energy [GeV] (from the gun) :param zeta1: initial beam chirp (from the gun) :param zeta2: initial beam curvature (from the gun) :param zeta3: initial beam skewness (from the gun) :return: v1, phi1, vh, phih .. function:: beam2rf_xfel_linac(sum_voltage, chirp, init_energy=0.13) wrapped up function for EuXFEL linacs :param sum_voltage: in control system [GeV] :param chirp: in control system [GeV] :param init_energy: for L1 it is 0.13 GeV, L2 = 0.7 GeV :return: v1, phi1 .. function:: rf2beam_xfel_linac(v, phi, init_energy=0.13) wrapped up function for EuXFEL linacs :param v: :param phi: :param init_energy: for L1 it is 0.13 GeV, L2 = 0.7 GeV :return: