field module

Define an equivalent to TraceWin’s FIELD_MAP.

Note

For now, we expect that coordinates are always cartesian.

Todo

Define a FieldMapLoader function to easily choose between binary/ascii file format.

Todo

Should have a omega0_rf attribute

See also

CavitySettings

class Field(folder, filename, length_m, z_0=0.0, flag_cython=False)[source]

Bases: ABC

Generic electro-magnetic field.

This object can be shared by several Element and we create as few as possible.

Parameters:
  • folder (Path)

  • filename (str)

  • length_m (float)

  • z_0 (float, default: 0.0)

  • flag_cython (bool, default: False)

extensions: Collection[str]
is_implemented: bool
__init__(folder, filename, length_m, z_0=0.0, flag_cython=False)[source]

Instantiate object.

Parameters:
  • folder (Path) – Where the field map files are.

  • filename (str) – The base name of the field map file(s), without extension (as in the FIELD_MAP command).

  • length_m (float) – Length of the field map.

  • z_0 (float, default: 0.0) – Position of the field map. Used with superpose.

  • flag_cython (bool, default: False) – If Cython field maps should be loaded.

Return type:

None

_e_x_spat_rf: Callable[[Any], float]

Spatial component of x RF electric field. To multiply by norm and cos(phi).

_e_y_spat_rf: Callable[[Any], float]

Spatial component of y RF electric field. To multiply by norm and cos(phi).

_e_z_spat_rf: Callable[[Any], float]

Spatial component of z RF electric field. To multiply by norm and cos(phi).

_b_x_spat_rf: Callable[[Any], float]

Spatial component of x RF magnetic field. To multiply by norm and cos(phi).

_b_y_spat_rf: Callable[[Any], float]

Spatial component of y RF magnetic field. To multiply by norm and cos(phi).

_b_z_spat_rf: Callable[[Any], float]

Spatial component of z RF magnetic field. To multiply by norm and cos(phi).

_e_x_dc: Callable[[Any], float]

Spatial component of x DC electric field. To multiply by norm and cos(phi).

_e_y_dc: Callable[[Any], float]

Spatial component of y DC electric field. To multiply by norm and cos(phi).

_e_z_dc: Callable[[Any], float]

Spatial component of z DC electric field. To multiply by norm and cos(phi).

_b_x_dc: Callable[[Any], float]

Spatial component of x DC magnetic field. To multiply by norm and cos(phi).

_b_y_dc: Callable[[Any], float]

Spatial component of y DC magnetic field. To multiply by norm and cos(phi).

_b_z_dc: Callable[[Any], float]

Spatial component of z DC magnetic field. To multiply by norm and cos(phi).

load_fieldmaps()[source]

Load all field components for class extensions.

Return type:

None

abstractmethod _load_fieldmap(path, **validity_check_kwargs)[source]

Generate field function corresponding to a single field file.

Parameters:

path (Path) – Path to a field map file.

Return type:

tuple[Callable[..., float], Any, int]

Returns:

  • func – Give field at a given position, position being a tuple of 1, 2 or 3 floats.

  • n_interp – Number of interpolation points in the various directions (tuple of 1, 2 or 3 integers).

  • n_cell – Number of cells (makes sense only for EDZ as for now).

shift()[source]

Shift the field maps.

Used in SUPERPOSE_MAP.

Return type:

None

e_z_functions(amplitude, phi_0_rel)[source]

Generate functions for longitudinal transfer matrix calculation.

Return type:

tuple[Callable, Callable]

Returns:

  • Callable – Function taking in 1D/2D/3D position and phase and returning corresponding z electric field (complex). Typically, a :class: .FieldFuncComplexTimedComponent.

  • Callable – Function taking in 1D/2D/3D position and phase and returning corresponding z electric field (real). Typically, a :class: .FieldFuncTimedComponent.

Parameters:
_patch_to_keep_consistency(n_interp, n_cell)[source]

Save n_cell and n_z.

Temporary solution.

Parameters:
Return type:

None

plot(amplitude=1.0, phi_0_rel=0.0)[source]

Plot the profile of the electric field.

Parameters:
  • amplitude (float, default: 1.0)

  • phi_0_rel (float, default: 0.0)

Return type:

None

_abc_impl = <_abc._abc_data object at 0x7318fb8ec100>