at.load.mad8#
Load a lattice from a MAD8 file.
Functions
Classes
|
MAD-X specific parser |
- class Mad8Parser(*, 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.Mad8Parser() >>> 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_mad8(*files, use='ring', strict=True, verbose=False, **kwargs)[source]#
Create a
Lattice
from MAD8 filesThe energy and particle of the generated lattice are taken from the MAD8
BEAM
object, using the MAD8 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: MAD8 sequence name.
particle (Particle) – Circulating particle. Default: from MAD8
energy (float) – Energy of the lattice [eV]. Default: from MAD8
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.