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 (
Path) – The path to the file to load.- Return type:
- Returns:
n_z – Number of steps in the array.
zmax – z position of the filemap end.
norm – 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 – Array holding field. If electric, will be in \(\mathrm{MV/m}\).
n_cell – Number of cells in the cavity.
- field_3d(path)[source]
Load a 3D field.
- Parameters:
path (
Path) – The path to the file to load.- Return type:
tuple[int,float,int,float,float,int,float,float,float,ndarray]- Returns:
n_z – Number of steps along the z-axis.
zmax – Maximum z position.
n_x – Number of steps along the x-axis.
xmin – Minimum x position.
xmax – Maximum x position.
n_y – Number of steps along the y-axis.
ymin – Minimum y position.
ymax – Maximum y position.
norm – Field normalization factor.
field – 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 0x75e51740cd60>}