at.load.allfiles#

Generic function to save and load python AT lattices. The format is determined by the file extension

Functions

load_lattice(filepath, **kwargs)

Load a Lattice object from a file

save_lattice(ring, filepath, **kwargs)

Save a Lattice object

register_format(extension[, load_func, ...])

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.

Parameters:

filepath (str) – Name of the file

Keyword Arguments:
  • 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 Lattice attributes

Specific keywords for .mat files

Keyword Arguments:
  • mat_key (str) – Name of the Matlab variable containing the lattice. Default: Matlab variable name if there is only one, otherwise 'RING'

  • check (bool) – Run coherence tests. Default: True

  • quiet (bool) – Suppress the warning for non-standard classes. Default: False

  • keep_all (bool) – Keep Matlab RingParam elements as Markers. Default: False

Returns:

lattice (Lattice) – New Lattice object

Known extensions are:

.mat

Matlab binary mat-file

.m

Matlab text m-file

.repr

Text representation of a python AT Lattice

.lat

Tracy format

.lte

Elegant format

register_format(extension, load_func=None, save_func=None, descr='')[source]#

Register format-specific processing functions

Parameters:
  • extension (str) – File extension string.

  • load_func – load function. Default: None

  • save_func – save_lattice function Default: None

  • descr (str) – File type description

save_lattice(ring, filepath, **kwargs)[source]#

Save a Lattice object

The file format is indicated by the filepath extension.

Parameters:
  • ring (Lattice) – Lattice description

  • filepath (str) – Name of the file

Specific keywords for .mat files

Keyword Arguments:

mat_key (str) – Name of the Matlab variable containing the lattice. Default: 'RING'

Known extensions are:

.mat

Matlab binary mat-file

.m

Matlab text m-file

.repr

Text representation of a python AT Lattice