at.load.utils
Conversion utilities for creating pyat elements
Functions
Classes
RingParam(family_name, energy[, periodicity])
|
Private class for Matlab RingParam element |
-
element_from_dict(elem_dict, index=None, check=True, quiet=False)[source]
Builds an Element from a dictionary of attributes
- Parameters:
elem_dict (dict) – Dictionary of element attributes
index (Optional[int]) – Element index
check (bool) – Check the compatibility of class and PassMethod
quiet (bool) – Suppress the warning for non-standard classes
- Returns:
elem (Element) – new Element
-
element_from_m(line)[source]
Builds an Element from a line in an m-file
- Parameters:
line (str) – Matlab string representation of an Element
- Returns:
elem (Element) – new Element
-
element_from_string(elem_string)[source]
Builds an Element from its python repr() string
- Parameters:
elem_string (str) – String representation of an Element
- Returns:
elem (Element) – new Element
-
element_to_dict(elem)[source]
Builds the Matlab structure of an Element
- Parameters:
elem (Element) – Element
- Returns:
dct (dict) – Dictionary of Element attributes
-
element_to_m(elem)[source]
Builds the Matlab-evaluable string for an Element
- Parameters:
elem (Element) – Element
- Returns:
mstr (str) – Matlab string representation of the
Element attributes
-
find_class(elem_dict, quiet=False)[source]
Identify the class of an element from its attributes
- Parameters:
-
- Returns:
element_class – The guessed Class name
-
find_class_name(elem_dict, quiet=False)[source]
Derive the class name of an Element from its attributes
-
hasattrs(kwargs, *attributes)[source]
Checks the presence of keys in a dict
Returns True if any of the attributes is in kwargs
- Parameters:
kwargs (dict) – The dictionary of keyword arguments passed to the
Element constructor.
attributes – A list of strings, the attribute names to be checked.
- Returns:
found (bool) – True if the element has any of the specified
attributes.
-
split_ignoring_parentheses(string, delimiter)[source]