at.load.madx#
Load a lattice from a MADX file (.seq).
Functions
Classes
|
MAD-X specific parser |
- class MadxParser(*, strict=True, verbose=False, **kwargs)[source]#
Bases:
_MadParser
MAD-X specific parser
The parser is a subclass of
dict
and is database containing all the MAD-X variables.Example
Parse a 1st file:
>>> parser = at.MadxParser() >>> parser.parse_file("file1")
Parse another file:
>>> parser.parse_file("file2")
Get the variable “vkick”
>>> parser["vkick"] 0.003
Define a new variable:
>>> parser["hkick"] = -0.0024
Get the “qf1” element
>>> parser["qf1"] quadrupole(name=qf1, l=1.0, k1=0.5, tilt=0.001)
Generate an AT
Lattice
from the “ring” sequence>>> ring = parser.lattice(use="ring") # generate an AT Lattice
- Parameters:
- clear()#
Clean the database
- expand(key)#
iterator over AT objects generated by a source object
- lattice(use='ring', **kwargs)#
Create a lattice from the selected sequence
- Parameters:
use (str) – Name of the MAD sequence or line containing the desired lattice. Default:
ring
- Keyword Arguments:
- parse_files(*filenames, final=True, prolog=None, epilog=None, **kwargs)#
Process files and fill the database
- parse_lines(lines, final=True, **kwargs)#
Process input lines and fill the database
- property missing#
Set of missing definitions
- property sequences#
List of available sequences or lines
- load_madx(*files, use='ring', strict=True, verbose=False, **kwargs)[source]#
Create a
Lattice
from MAD-X filesThe energy and particle of the generated lattice are taken from the MAD-X
BEAM
object, using the MAD-X default parameters: positrons at 1 Gev. These parameters are overloaded by the value given in the energy and particle keyword arguments.The radiation state is given by the
RADIATE
flag of theBEAM
object, using the AT defaults: RF cavities active, synchrotron radiation in dipoles and quadrupoles.Long elements are split according to the default AT value for NumIntSteps (10).
- Parameters:
- Keyword Arguments:
name (str) – Name of the lattice. Default: MADX sequence name.
particle (Particle) – Circulating particle. Default: from MADX
energy (float) – Energy of the lattice [eV]. Default: from MADX
periodicity (int) – Number of periods. Default: 1
* – Other keywords will be used as initial variable definitions
- Returns:
lattice (Lattice) – New
Lattice
object
See also
load_lattice()
for a generic lattice-loading function.