atip.utils#

Members

get_atsim

Get the ATSimulator object being used by a unified Pytac lattice.

get_sim_lattice

Get the AT lattice that the simulator is using.

load_at_lattice

Load an AT lattice from a .mat file in the 'rings' directory.

loader

Load a unified lattice of the specifed mode.

preload

Load the elements onto an 'elems' object's attributes by family so that groups of elements of the same family can be more easily accessed, e.g. 'elems.bpm' will return a list of all the BPMs in the lattice.

preload_at

Load the elements onto an 'elems' object's attributes by type so that groups of elements of the same type (class) can be more easily accessed, e.g. 'elems.dipole' will return a list of all the dipoles in the lattice.

toggle_thread

Pause or unpause the ATSimulator calculation thread.

trigger_calc

Manually trigger a recalculation of the physics data on the ATSimulator object of the given unified Pytac lattice.

atip.utils.load_at_lattice(mode='I04', **kwargs)[source]#

Load an AT lattice from a .mat file in the ‘rings’ directory.

Note

I add custom attributes ‘Index’ and ‘Class’ to each of the elements in the AT lattice as I find them useful for debugging.

Parameters:
  • mode (str) – The lattice operation mode.

  • kwargs – any keyword arguments are passed to the AT lattice creator.

Returns:

An AT lattice object.

Return type:

at.lattice.Lattice

atip.utils.loader(mode='I04', callback=None, disable_emittance=False)[source]#

Load a unified lattice of the specifed mode.

Note

A unified lattice is a Pytac lattice where the corresponding AT lattice has been loaded into the Pytac lattice’s simulator data source by means of ATIP.

Parameters:
  • mode (str) – The lattice operation mode.

  • callback (Callable) – Callable to be called after completion of each round of physics calculations in ATSimulator.

  • disable_emittance (bool) – Whether the emittance should be calculated.

Returns:

A Pytac lattice object with the simulator data

source loaded.

Return type:

pytac.lattice.Lattice

atip.utils.preload_at(at_lat)[source]#

Load the elements onto an ‘elems’ object’s attributes by type so that groups of elements of the same type (class) can be more easily accessed, e.g. ‘elems.dipole’ will return a list of all the dipoles in the lattice. As a special case ‘elems.all’ will return all the elements in the lattice.

Parameters:

at_lat (at.lattice.Lattice) – The AT lattice object from which to get the elements.

Returns:

The elems object with the elements loaded onto it by type.

Return type:

obj (class)

atip.utils.preload(pytac_lat)[source]#

Load the elements onto an ‘elems’ object’s attributes by family so that groups of elements of the same family can be more easily accessed, e.g. ‘elems.bpm’ will return a list of all the BPMs in the lattice. As a special case ‘elems.all’ will return all the elements in the lattice.

Parameters:

pytac_lat (pytac.lattice.Lattice) – The Pytac lattice object from which to get the elements.

Returns:

The elems object with the elements loaded onto it by family.

Return type:

obj(class)

atip.utils.get_atsim(target)[source]#

Get the ATSimulator object being used by a unified Pytac lattice.

Parameters:

target (pytac.lattice.Lattice or ATSimulator) – An ATSimulator object or a Pytac lattice from which an ATSimulator object can be extracted.

Returns:

The simulator object performing the physics calculations.

Return type:

ATSimulator

atip.utils.get_sim_lattice(target)[source]#

Get the AT lattice that the simulator is using.

Parameters:

target (pytac.lattice.Lattice or ATSimulator) – An ATSimulator object or a Pytac lattice from which an ATSimulator object can be extracted.

Returns:

The corresponding AT lattice used by the simulator.

Return type:

at.lattice.Lattice

atip.utils.toggle_thread(target)[source]#

Pause or unpause the ATSimulator calculation thread.

Parameters:

target (pytac.lattice.Lattice or ATSimulator) – An ATSimulator object or a Pytac lattice from which an ATSimulator object can be extracted.

atip.utils.trigger_calc(target)[source]#

Manually trigger a recalculation of the physics data on the ATSimulator object of the given unified Pytac lattice.

Parameters:

target (pytac.lattice.Lattice or ATSimulator) – An ATSimulator object or a Pytac lattice from which an ATSimulator object can be extracted.