acceptance module

Define functions related to acceptance calculation.

Todo

Show equations and references in the docstrings.

compute_acceptances(phi_s, freq_cavity_mhz, w_kin, v_cav_mv, length_m, beam_kwargs)[source]

Compute acceptances in phase and energy.

Handles off-limits synchronous phases.

Parameters:
  • phi_s (float) – Synchronous phase; if it is outside \((-\pi / 2,~0)\), both acceptances are nan.

  • freq_cavity_mhz (float) – Cavity frequency in \(\mathrm{MHz}\).

  • w_kin (float | None) – Beam energy at the cavity exit in \(\mathrm{MeV}\).

  • v_cav_mv (float) – Cavity accelerating voltage in \(\mathrm{MV}\).

  • length_m (float) – Cavity length in \(\mathrm{m}\).

  • beam_kwargs (BeamKwargs) – Dict holding beam parameters, and in particular the adimensionned charge q_adim and the rest energy e_rest_mev.

Return type:

tuple[float, float]

Returns:

  • acceptance_phi – Acceptance in phase in \(\mathrm{rad}\).

  • acceptance_energy – Acceptance in energy in \(\mathrm{MeV}\).

_compute_acceptance_phase(phi_s)[source]

Compute the acceptance in phase using Brent method.

Parameters:

phi_s (float) – Synchronous phase, must be in \((-\pi / 2,~0)\).

Return type:

float

Returns:

Cavity acceptance in phase, in \(\mathrm{rad}\).

_compute_phi_2(phi_2, phi_s)[source]

Compute the left boundary of the phase acceptance (phi_2).

Parameters:
  • phi_2 (float) – Phase value in radians to test as the boundary.

  • phi_s (float) – Synchronous phase in radians.

Returns:

Function value to be used in root-finding (zero crossing corresponds to phi_2).

Return type:

float

_compute_acceptance_energy(phi_s, freq_cavity_mhz, w_kin, v_cav_mv, length_m, q_adim, e_rest_mev, **beam_kwargs)[source]

Compute the acceptance in energy.

Parameters:
  • phi_s (float) – Synchronous phase, must be in \((-\pi / 2,~0)\).

  • freq_cavity_mhz (float) – Cavity frequency in \(\mathrm{MHz}\).

  • w_kin (float) – Beam energy at the cavity exit in \(\mathrm{MeV}\).

  • v_cav_mv (float) – Cavity accelerating voltage in \(\mathrm{MV}\).

  • length_m (float) – Cavity length in \(\mathrm{m}\).

  • q_adim (float) – Beam adimensionned charge.

  • e_rest_mev (float) – Beam rest energy in \(\mathrm{MeV}\).

Return type:

float

Returns:

Cavity acceptance in energy, in \(\mathrm{MeV}\).