simba.Codes.ASTRA package
Submodules
simba.Codes.ASTRA.ASTRA module
SIMBA ASTRA Module
Various objects and functions to handle ASTRA lattices and commands. See ASTRA manual for more details.
- Classes:
astraLattice: The ASTRA lattice object, used for
converting the
frameworkObjects defined in theframeworkLatticeinto a string representation of the lattice suitable for an ASTRA input file.astra_header: Class for defining the &HEADER portion
of the ASTRA input file.
astra_newrun: Class for defining the &NEWRUN portion
of the ASTRA input file.
astra_charge: Class for defining the &CHARGE portion
of the ASTRA input file.
astra_output: Class for defining the &OUTPUT portion
of the ASTRA input file.
astra_errors: Class for defining the &ERRORS portion
of the ASTRA input file.
- class astraLattice(*args, **kwargs)[source]
Bases:
frameworkLatticeClass for defining the ASTRA lattice object, used for converting the
frameworkLatticeinto a string representation of the lattice suitable for an ASTRA input file.- Parameters:
args (
Any)kwargs (
Any)
-
allow_negative_drifts:
bool= True Flag to indicate whether negative drifts are allowed
- astra_to_hdf5(lattice, scr, cathode=False, mult=100, final=False, sval=0.0)[source]
Convert the ASTRA beam file name to HDF5 format and write the beam file.
- Parameters:
lattice (str) – Lattice name
scr (laura.models.diagnostic.DiagnosticElement) – LAURA DiagnosticElement
cathode (bool) – True if beam was emitted from a cathode
mult (int) – Multiplication factor for ASTRA-type filenames
sval (float) – S-position of beam
final (
bool)
- Return type:
None
- property bunch_charge: float
Bunch charge in coulombs
- Returns:
Bunch charge
- Return type:
float
-
code:
str= 'astra' String indicating the lattice object type
- find_ASTRA_filename(lattice, scr, master_run_no, mult)[source]
Determine the ASTRA filename for the screen object.
- Parameters:
lattice (str) – The name of the lattice
scr (laura.models.diagnostic.DiagnosticElement) – LAURA DiagnosticElement
master_run_no (int) – The run number
mult (int) – Multiplication factor for ASTRA-type output
zstart (float) – Start position of lattice
- Returns:
The ASTRA filename for the screen object, or None if the file does not exist.
- Return type:
str or None
- get_screen_scaling()[source]
Determine the screen scaling factor for screens and BPMs
- Returns:
The scaling factor depending on the master_run_no parameter
- Return type:
int
- hdf5_to_astra()[source]
Convert beam input file to ASTRA format and write to master_subdir.
- Returns:
Name of ASTRA beam file
- Return type:
str
-
headers:
Dict= {} Headers to be included in the ASTRA lattice file
- postProcess()[source]
Convert the beam file(s) from the ASTRA output into HDF5 format, see
astra_to_hdf5().- Return type:
None
- preProcess()[source]
Convert the beam file from the previous lattice section into ASTRA format and set the number of particles based on the input distribution, see
hdf5_to_astra().- Return type:
None
-
ref_s:
float= None Reference s position
- property sample_interval: int
Factor by which to reduce the number of particles in the simulation, i.e. every 10th particle.
- Returns:
The sampling interval n_red in ASTRA
- Return type:
int
-
screen_threaded_function:
ClassVar[ScatterGatherDescriptor] Function for converting all screen outputs from ASTRA into the SIMBA generic
beamobject and writing files
- property space_charge_mode: str
The space charge type for ASTRA, i.e. “2D”, “3D”.
- Returns:
The space charge type for ASTRA
- Return type:
str
-
starting_offset:
list[float] = [0.0, 0.0, 0.0] Initial offset of first element
-
starting_rotation:
list[float] = [0.0, 0.0, 0.0] Initial rotation of first element
- property toffset: float
Get the time offset for the reference particle.
- Returns:
The time offset in seconds
- Return type:
float
- write()[source]
Writes the ASTRA input file from
writeElements()to <master_subdir>/<self.objectname>.in.- Return type:
None
-
zstep:
float= 0.01 Tracking step size [m]
-
zstop:
float= None End z position of lattice