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
- class Field(folder, filename, length_m, z_0=0.0, flag_cython=False)[source]
Bases:
ABCGeneric electro-magnetic field.
This object can be shared by several
Elementand we create as few as possible.- Parameters:
- extensions: Collection[str]
- __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 theFIELD_MAPcommand).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
xRF electric field. To multiply by norm andcos(phi).
- _e_y_spat_rf: Callable[[Any], float]
Spatial component of
yRF electric field. To multiply by norm andcos(phi).
- _e_z_spat_rf: Callable[[Any], float]
Spatial component of
zRF electric field. To multiply by norm andcos(phi).
- _b_x_spat_rf: Callable[[Any], float]
Spatial component of
xRF magnetic field. To multiply by norm andcos(phi).
- _b_y_spat_rf: Callable[[Any], float]
Spatial component of
yRF magnetic field. To multiply by norm andcos(phi).
- _b_z_spat_rf: Callable[[Any], float]
Spatial component of
zRF magnetic field. To multiply by norm andcos(phi).
- _e_x_dc: Callable[[Any], float]
Spatial component of
xDC electric field. To multiply by norm andcos(phi).
- _e_y_dc: Callable[[Any], float]
Spatial component of
yDC electric field. To multiply by norm andcos(phi).
- _e_z_dc: Callable[[Any], float]
Spatial component of
zDC electric field. To multiply by norm andcos(phi).
- _b_x_dc: Callable[[Any], float]
Spatial component of
xDC magnetic field. To multiply by norm andcos(phi).
- _b_y_dc: Callable[[Any], float]
Spatial component of
yDC magnetic field. To multiply by norm andcos(phi).
- _b_z_dc: Callable[[Any], float]
Spatial component of
zDC magnetic field. To multiply by norm andcos(phi).
- load_fieldmaps()[source]
Load all field components for class
extensions.- Return type:
- 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:
- 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
EDZas for now).
- e_z_functions(amplitude, phi_0_rel)[source]
Generate functions for longitudinal transfer matrix calculation.
- Return type:
- 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:
- _abc_impl = <_abc._abc_data object at 0x7318fb8ec100>