at.load.matfile#

Load lattices from Matlab files.

Functions

load_mat(filename, **kwargs)

Create a Lattice from a Matlab mat-file

save_mat(ring, filename[, mat_key])

Save a Lattice as a Matlab mat-file

load_m(filename, **kwargs)

Create a Lattice from a Matlab m-file

save_m(ring[, filename])

Save a Lattice as a Matlab m-file

load_var(matlat, **kwargs)

Create a Lattice from a Matlab cell array

load_m(filename, **kwargs)[source]#

Create a Lattice from a Matlab m-file

Parameters:

filename (str) – Name of a ‘.m’ file

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

  • name (str) – Name of the lattice. Default: taken from the lattice, or ''

  • energy (float) – Energy of the lattice [eV]. Default: taken from the lattice elements

  • periodicity (int) – Number of periods. Default: taken from the elements, or 1

  • * – All other keywords will be set as Lattice attributes

Returns:

lattice (Lattice) – New Lattice object

See also

load_lattice() for a generic lattice-loading function.

load_mat(filename, **kwargs)[source]#

Create a Lattice from a Matlab mat-file

Parameters:

filename (str) – Name of a ‘.mat’ file

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 the coherence tests. Default: True

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

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

  • name (str) – Name of the lattice. Default: taken from the lattice, or ''

  • energy (float) – Energy of the lattice [eV]. Default: taken from the lattice elements

  • periodicity (int) – Number of periods. Default: taken from the elements, or 1

  • * – All other keywords will be set as Lattice attributes

Returns:

lattice (Lattice) – New Lattice object

See also

load_lattice() for a generic lattice-loading function.

load_var(matlat, **kwargs)[source]#

Create a Lattice from a Matlab cell array

Parameters:

matlat (Sequence[dict]) – Matlab lattice

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

  • name (str) – Name of the lattice. Default: taken from the lattice, or ''

  • energy (float) – Energy of the lattice [eV]. Default: taken from the lattice elements

  • periodicity (int) – Number of periods. Default: taken from the elements, or 1

  • * – All other keywords will be set as Lattice attributes

Returns:

lattice (Lattice) – New Lattice object

save_m(ring, filename=None)[source]#

Save a Lattice as a Matlab m-file

Parameters:
  • ring (Lattice) – Lattice description

  • filename (str | None) – Name of the ‘.m’ file. Default: outputs on sys.stdout

See also

save_lattice() for a generic lattice-saving function.

save_mat(ring, filename, mat_key='RING')[source]#

Save a Lattice as a Matlab mat-file

Parameters:
  • ring (Lattice) – Lattice description

  • filename (str) – Name of the ‘.mat’ file

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

See also

save_lattice() for a generic lattice-saving function.