field_map_loaders module
Define functions to load field maps.
- warn_norm(path, norm)[source]
Raise this warning only once.
https://stackoverflow.com/questions/31953272/logging-print-message-only-once
- field_1d(path)[source]
Load a 1D field.
- Parameters:
path (pathlib.Path) – The path to the file to load.
- Return type:
- Returns:
n_z (int) – Number of steps in the array.
zmax (float) – z position of the filemap end.
norm (float) – Electric field normalisation factor. It is different from
k_e(6th argument of the FIELD_MAP command). Electric fields are normalised byk_e/norm, hence norm should be unity by default.f_z (numpy.ndarray) – Array holding field. If electric, will be in \(\mathrm{MV/m}\).
n_cell (int) – Number of cells in the cavity.
- field_3d(path)[source]
Load a 3D field.
- Parameters:
path (pathlib.Path) – The path to the file to load.
- Return type:
tuple[int,float,int,float,float,int,float,float,float,ndarray]- Returns:
n_z (int) – Number of steps along the z-axis.
zmax (float) – Maximum z position.
n_x (int) – Number of steps along the x-axis.
xmin (float) – Minimum x position.
xmax (float) – Maximum x position.
n_y (int) – Number of steps along the y-axis.
ymin (float) – Minimum y position.
ymax (float) – Maximum y position.
norm (float) – Field normalization factor.
field (numpy.ndarray) – 3D array holding field values. If electric, will be in \(\mathrm{MV/m}\).
- _get_number_of_cells(f_z)[source]
Count number of times the array of z-electric field changes sign.
See SO.
- Parameters:
f_z (
Collection[float])- Return type:
- FIELD_MAP_LOADERS = {'.edz': <function field_1d at 0x70e253b32de0>}