at.load.file_input#
Generic text parsers for conversion of lattices in different formats to AT
Classes
|
Base class for source object descriptors |
|
Simple representation of an element as a dict |
|
Simple representation of a sequence of elements as a list |
|
Generic file parser |
|
parser allowing definitions in any order |
- class BaseParser(env, *args, delimiter=None, continuation='\\', linecomment='#', blockcomment=None, endfile=None, verbose=False, **kwargs)[source]#
Bases:
DictNoDot
Generic file parser
Analyses files with the following MAD-like format:
variable = value
label : command [,attribute=value] [,attribute=value]...
The parser builds a database of all the defined objects
- Parameters:
env (dict) – global namespace used for evaluating commands
delimiter (str | None) – command delimiter
continuation (str) – command continuation character
linecomment (str | tuple[str] | None) – Line comment character
blockcomment (tuple[str, str] | None) – Block comment delimiter
endfile (str | None) – “End of input” marker
verbose (bool) – If True, print detail on the processing
*args – dict initializer
**kwargs – dict initializer
- lattice(use='ring', **kwargs)[source]#
Create a lattice from the selected sequence
- Parameters:
use – Name of the MADX sequence or line containing the desired lattice. Default:
ring
- Keyword Arguments:
- class ElementDescr(*args, **kwargs)[source]#
-
Simple representation of an element as a dict
- class SequenceDescr(*args, **kwargs)[source]#
-
Simple representation of a sequence of elements as a list
- class UnorderedParser(env, *args, **kwargs)[source]#
Bases:
BaseParser
parser allowing definitions in any order
This is done by storing the failed statements in a queue and iteratively trying to execute them after all input statements have been processed, until the number of failures is constant (hopefully zero)
- Parameters:
env (dict) – global namespace
delimiter – command delimiter
continuation – command continuation character
linecomment – Line comment character
blockcomment – Block comment delimiter
endfile – End of input marker
verbose – If True, print detail on the processing
*args – dict initializer
**kwargs – dict initializer
- property missing#
Set of missing definitions