rf_field module

Hold parameters that are shared by all cavities of same type.

See also

CavitySettings

compute_param_cav(integrated_field: complex) dict[str, float]

Compute synchronous phase and accelerating field.

class RfField(section_idx: int)

Bases: object

Cos-like RF field.

Warning, all phases are defined as:

\[\phi = \omega_0^{rf} t\]

While in the rest of the code it is defined as:

\[\phi = \omega_0_^{bunch} t\]

All phases are stored in radian.

Parameters:
  • e_spat (Callable[[float], float]) – Spatial component of the electric field. Needs to be multiplied by the \(\cos(\omega t)\) to have the full electric field. Initialized to null function.

  • n_cell (int) – Number of cells in the cavity.

  • n_z (int | None) – Number of points in the file that gives e_spat, the spatial component of the electric field.

__init__(section_idx: int) None

Instantiate object.

has(key: str) bool

Tell if the required attribute is in this class.

get(*keys: str, **kwargs: bool | str | None) Any

Shorthand to get attributes from this class or its attributes.

Parameters:
  • *keys (str) – Name of the desired attributes.

  • **kwargs (bool | str | None) – Other arguments passed to recursive getter.

Returns:

out – Attribute(s) value(s).

Return type:

Any

set_e_spat(e_spat: Callable[[float], float], n_cell: int) None

Set the pos. component of electric field, set number of cells.

shift() None

Shift the electric field map.

Warning

You must ensure that for z < 0 and z > element.length_m the electric field is null. Interpolation can lead to funny results!