ocelot.cpbd.io
¶
Module Contents¶
Functions¶
|
|
|
Load beam file in npz format and return ParticleArray |
|
Universal function to load beam file, *.ast (ASTRA), *.fmt1 (CSRTrack) or *.npz format |
|
Universal function to save beam file, *.ast (ASTRA), *.fmt1 (CSRTrack) or *.npz format |
|
|
|
Function finds objects by types and adds it to list if object is unique. |
|
|
|
|
|
returns python input string for the lattice in the lat object |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
saves lattice as python imput file |
module contains lat2input function which creates python input string (ocelot lattice) for a lattice object author sergey.tomin
-
ocelot.cpbd.io.
save_particle_array2npz
(filename, p_array)¶
-
ocelot.cpbd.io.
load_particle_array_from_npz
(filename, print_params=False)¶ Load beam file in npz format and return ParticleArray
- Parameters
filename –
- Returns
-
ocelot.cpbd.io.
load_particle_array
(filename, print_params=False)¶ Universal function to load beam file, *.ast (ASTRA), *.fmt1 (CSRTrack) or *.npz format
Note that downloading ParticleArray from the astra file (.ast) and saving it back does not give the same distribution. The difference arises because the array of particles does not have a reference particle, and in this case the first particle is used as a reference.
- Parameters
filename – path to file, filename.ast or filename.npz
- Returns
ParticleArray
-
ocelot.cpbd.io.
save_particle_array
(filename, p_array)¶ Universal function to save beam file, *.ast (ASTRA), *.fmt1 (CSRTrack) or *.npz format
Note that downloading ParticleArray from the astra file (.ast) and saving it back does not give the same distribution. The difference arises because the array of particles does not have a reference particle, and in this case the first particle is used as a reference.
- Parameters
filename – path to file, filename.ast or filename.npz
- Returns
ParticleArray
-
ocelot.cpbd.io.
find_drifts
(lat)¶
-
ocelot.cpbd.io.
find_objects
(lat, types)¶ Function finds objects by types and adds it to list if object is unique. :param lat: MagneticLattice :param types: types of the Elements :return: list of elements
-
ocelot.cpbd.io.
create_var_name
(objects)¶
-
ocelot.cpbd.io.
find_obj_and_create_name
(lat, types)¶
-
ocelot.cpbd.io.
lat2input
(lattice, tws0=None)¶ returns python input string for the lattice in the lat object
-
ocelot.cpbd.io.
get_elements
(lattice)¶
-
ocelot.cpbd.io.
matrix_def_string
(element, params)¶
-
ocelot.cpbd.io.
element_def_string
(element)¶
-
ocelot.cpbd.io.
pprinting
(element, element_type, params)¶
-
ocelot.cpbd.io.
print_elements
(elements_dict)¶
-
ocelot.cpbd.io.
sort_elements
(elements)¶
-
ocelot.cpbd.io.
elements2input
(lattice)¶
-
ocelot.cpbd.io.
cell2input
(lattice, split=False)¶
-
ocelot.cpbd.io.
twiss2input
(tws)¶
-
ocelot.cpbd.io.
beam2input
(beam)¶
-
ocelot.cpbd.io.
rem_drifts
(lat)¶
-
ocelot.cpbd.io.
write_power_supply_id
(lattice, lines=[])¶
-
ocelot.cpbd.io.
write_lattice
(lattice, tws0=None, file_name='lattice.py', remove_rep_drifts=True, power_supply=False)¶ saves lattice as python imput file lattice - MagneticLattice file_name - name of the file remove_rep_drifts - if True, remove the drifts with the same lengths from the lattice drifts definition