simba.Codes.CSRTrack package

Submodules

simba.Codes.CSRTrack.CSRTrack module

SIMBA CSRTrack Module

Various objects and functions to handle CSRTrack lattices and commands. See CSRTrack manual for more details.

Classes:

converting the frameworkLattice into a string representation of the lattice suitable for a CSRTrack input file.

class csrtrackLattice(*args, **kwargs)[source]

Bases: frameworkLattice

Class for defining the CSRTrack lattice object, used for converting the frameworkLattice into a string representation of the lattice suitable for a CSRTrack input file.

Parameters:
  • args (Any)

  • kwargs (Any)

CSRTrackelementObjects: Dict = {}

Dictionary representing all CSRTrack object namelists

code: str = 'csrtrack'

String indicating the lattice object type

csrtrack_to_hdf5()[source]

Convert the particle distribution from a CSRTrack monitor into HDF5 format, and write it to master_subdir.

Return type:

None

property dipoles_screens_and_bpms: List

Get a list of the dipoles, screens and BPMs sorted by their position in the lattice

Returns:

A sorted list of dipoles, screens and BPMs.

Return type:

List

hdf5_to_astra()[source]

Convert HDF5 particle distribution to ASTRA format, suitable for inputting to CSRTrack.

Parameters:

prefix (str) – Prefix for filename

Return type:

None

particle_definition: str = ''

String representing the initial particle distribution

postProcess()[source]

Convert the beam file from the CSRTrack output into HDF5 format, see csrtrack_to_hdf5().

Return type:

None

preProcess()[source]

Convert the beam file from the previous lattice section into CSRTrack format and set the number of particles based on the input distribution, see hdf5_to_astra().

Return type:

None

setCSRMode()[source]

Set up the forces key in CSRTrackelementObjects based on the `csr_mode defined in the settings file for this lattice section. csr_mode can be either [“csr_g_to_p” (2D) or “projected” (1D)]

Return type:

None

set_particles_filename()[source]

Set up the CSRTrackelementObjects namelist for the initial particle distribution, based on the `particle_definition and the global_parameters of the lattice.

Return type:

None

write()[source]

Writes the CSRTrack input file from writeElements() to <master_subdir>/csrtrk.in.

Return type:

str

writeElements()[source]

Write the lattice elements defined in this object into a CSRTrack-compatible format; see elementObjects.

The appropriate headers required for ASTRA are written at the top of the file, see the _write_CSRTrack function in csrtrack_element.

Returns:

The lattice represented as a string compatible with CSRTrack

Return type:

str

Module contents