rayoptics.elem.parttree module
Manage connectivity between sequence and element models using a tree.
- class PartTree(opt_model, **kwargs)[source]
Bases:
object
- parent_node(obj, tag='#element#space#dummyifc')[source]
Return the parent node for obj, filtered by tag.
- parent_object(obj, tag='#element#space#dummyifc')[source]
Return the parent object (and node) for obj, filtered by tag.
- get_child_filter(tag='#element#assembly', not_tag='')[source]
Returns a fct that filters a list of nodes to satisfy the tags
- list_tree(*args, **kwargs)[source]
Print a graphical console representation of the tree.
The optional arguments are passed through to the by_attr filter. Useful examples or arguments include:
pt.list_tree(lambda node: f”{node.name}: {node.tag}”)
pt.list_tree(attrname=’tag’)
- nodes_with_tag(tag='#element', not_tag='', root=None, node_list=None)[source]
Return a list of nodes that contain the requested tag.
- sequence_to_elements(seq_model, ele_model, part_tree)[source]
Parse the seq_model into elements and update ele_model accordingly.
- find_ele_changes(seq_model, ele_model, part_tree, print_visit=False)[source]
Parse the seq_model into elements and categorize the changes.
- Returns:
list of ele_defs in common between sm and pt added_ele: list of ele_defs for new elements to be created removed_ele: list of ele_defs to be removed modified_ele: list of existing elements to be updated from new ele_defs sme_list: ele_defs obtained by parsing the seq_model seq_str: character encoding of seq_model ifcs and gaps eme_list: ele_defs for current elements in the element model eme_dict: key: ele_def returns the value: element asm_list: ele_defs for current assemblies in the element/part model asm_dict: key: ele_def the value: assembly
- Return type:
common_ele