at.load.allfiles#
Generic function to save and load python AT lattices. The format is determined by the file extension
Functions
|
Load a Lattice object from a file |
|
Save a Lattice object |
|
Register format-specific processing functions |
- load_lattice(filepath, **kwargs)[source]#
Load a Lattice object from a file
The file format is indicated by the filepath extension. The file name is stored in the in_file Lattice attribute. The selected variable, if relevant, is stored in the use Lattice attribute.
- Parameters:
filepath (str) – Name of the file
- Keyword Arguments:
use (str) – Name of the variable containing the desired lattice. Default: if there is a single variable, use it, otherwise select
"RING"name (str) – Name of the lattice. Default: taken from the file, or
""energy (float) – Energy of the lattice (default: taken from the file)
periodicity (int) – Number of periods (default: taken from the file, or 1)
* – All other keywords will be set as
Latticeattributes
- Returns:
lattice (Lattice) – New
Latticeobject
Check the format-specific function for specific keyword arguments:
Known extensions are:
- .mat
Matlab binary mat-file. See
load_mat().- .m
Matlab text m-file. See
load_m().- .repr
Text representation of a python AT Lattice. See
load_repr().- .lat
Tracy format. See
load_tracy().- .seq
MAD-X lattice description. See
load_madx().- .lte
Elegant lattice description. See
load_elegant().- .json
JSON representation of a python AT Lattice. See
load_json().
- register_format(extension, load_func=None, save_func=None, descr='')[source]#
Register format-specific processing functions
- save_lattice(ring, filepath, **kwargs)[source]#
Save a Lattice object
The file format is indicated by the filepath extension.
Check the format-specific function for specific keyword arguments:
Known extensions are:
- .mat
Matlab binary mat-file. See
load_mat().- .m
Matlab text m-file. See
load_m().- .repr
Text representation of a python AT Lattice. See
load_repr().- .seq
MAD-X lattice description. See
load_madx().- .lte
Elegant lattice description. See
load_elegant().- .json
JSON representation of a python AT Lattice. See
load_json().