apace.classes
¶
Module Contents¶
Classes¶
Abstract base for all element and lattice classes. |
|
Abstract base for all element classes. |
|
A drift space element. |
|
A dipole element. |
|
A quadrupole element. |
|
A sextupole element. |
|
An octupole element. |
|
Defines the order of elements in the accelerator. |
- class apace.classes.Base(name, length, info='')¶
Abstract base for all element and lattice classes.
- Parameters
Attributes
- name :str¶
The name of the object.
- info :str¶
Additional information about the object
- parent_lattices :Set[Lattice]¶
All lattices which contain the object.
Methods
- __repr__()¶
Return repr(self).
- __str__()¶
Return str(self).
- class apace.classes.Element(name, length, info='')¶
Inherits:
Base
Abstract base for all element classes.
- Parameters
Attributes
- attribute_changed :apace.utils.Signal¶
Gets emitted when one of the attributes changes.
Methods
- _on_attribute_changed(element, attribute)¶
- __repr__()¶
Return repr(self).
- __str__()¶
Return str(self).
- class apace.classes.Drift(name, length, info='')¶
Inherits:
Element
A drift space element.
- Parameters
Attributes
- attribute_changed :apace.utils.Signal¶
Gets emitted when one of the attributes changes.
Methods
- _on_attribute_changed(element, attribute)¶
- __repr__()¶
Return repr(self).
- __str__()¶
Return str(self).
- class apace.classes.Dipole(name, length, angle, e1=0, e2=0, info='')¶
Inherits:
Element
A dipole element.
- Parameters
Attributes
Methods
- _on_attribute_changed(element, attribute)¶
- __repr__()¶
Return repr(self).
- __str__()¶
Return str(self).
- class apace.classes.Quadrupole(name, length, k1, info='')¶
Inherits:
Element
A quadrupole element.
- Parameters
Attributes
Methods
- _on_attribute_changed(element, attribute)¶
- __repr__()¶
Return repr(self).
- __str__()¶
Return str(self).
- class apace.classes.Sextupole(name, length, k2, info='')¶
Inherits:
Element
A sextupole element.
- Parameters
Attributes
Methods
- _on_attribute_changed(element, attribute)¶
- __repr__()¶
Return repr(self).
- __str__()¶
Return str(self).
- class apace.classes.Octupole(name, length, k3, info='')¶
Inherits:
Element
An octupole element.
- Parameters
Attributes
Methods
- _on_attribute_changed(element, attribute)¶
- __repr__()¶
Return repr(self).
- __str__()¶
Return str(self).
- class apace.classes.Lattice(name, children, info='')¶
Inherits:
Base
Defines the order of elements in the accelerator.
- Parameters
Attributes
- length_changed :apace.utils.Signal¶
Gets emitted when the length of lattice changes.
- element_changed :apace.utils.Signal¶
Gets emitted when an attribute of an element within this lattice changes.
- n_elements¶
The number of elements within this lattice.
- children¶
List of direct children (elements or sub-lattices) in physical order.
- Return type
List[Base]
- indices¶
A dict which contains the a List of indices for each element. Can be thought of as inverse of sequence. Sub-lattices are associated with the list of indices of their first element.
- objects¶
A Mapping from names to the given Element or Lattice object.
Methods
- traverse_children() :staticmethod:
Returns iterator which traverses all children of a lattice.
- _init_properties()¶
A recursive helper function to initialize the properties.
- __getitem__(key)¶
- __del__()¶
- update_length()¶
Manually update the Length of the lattice (m).
- _on_length_changed()¶
- _on_element_changed(element, attribute)¶
- print_tree()¶
Print the lattice as tree of objects. (Similar to unix tree command)
- _print_tree( prefix='') :staticmethod:
- from_file( location, file_format=None) :classmethod:
Creates a new Lattice from file at location (path or url). :param location: path-like or url-like string which locates the lattice file :type location: Union[AnyStr, Path] :param file_format str: File format of the lattice file :type file_format: str, optional (use file extension) :rtype Lattice
- from_dict( data) :classmethod:
Creates a new Lattice object from a latticeJSON compliant dictionary.
- as_file(path, file_format=None)¶
- as_dict()¶
Serializes the Lattice object into a latticeJSON compliant dictionary.
- __repr__()¶
Return repr(self).
- __str__()¶
Return str(self).