def __init__(self, name="tilt no name", angle=0.): """ Constructor. Creates the Tilt TEAPOT element. """ AccNode.__init__(self, name) self.__angle = angle self.setType("tilt teapot")
def __init__(self, name = "tilt no name", angle = 0.): """ Constructor. Creates the Tilt element. """ AccNode.__init__(self,name) self.__angle = angle self.setType("tilt teapot")
def __init__(self, parentNode, trackFunction = None , name = "fringe field no name"): """ Constructor. Creates the Fringe Field element. """ AccNode.__init__(self,name) self.setParamsDict(parentNode.getParamsDict()) self.__trackFunc = trackFunction self.__usage = False self.setType("fringeField teapot")
def addImpedanceNodeAsChild(lattice, AccNode, Impedance_Node): AccNode.addChildNode(Impedance_Node,AccNode.BODY,0,AccNode.BEFORE) lattice.initialize()
import sys import math import posix from orbit.lattice import AccLattice, AccNode, AccActionsContainer lattice = AccLattice("test_lattice") elem1 = AccNode("el-1") elem2 = AccNode("el-2") elem3 = AccNode("el-3") elem1.setLength(1.1) elem2.setLength(2.1) elem3.setLength(3.1) lattice.addNode(elem1) lattice.addNode(elem2) lattice.addNode(elem3) elem1_1 = AccNode("el-1-1") elem1_1.setnParts(2) elem1_1_1 = AccNode("el-1-1-1") elem1_1_2 = AccNode("el-1-1-2") elem1_1_3 = AccNode("el-1-1-3") elem1_1_4 = AccNode("el-1-1-4") elem1.addChildNode(elem1_1,AccNode.ENTRANCE) elem1_1.addChildNode(elem1_1_1,AccNode.ENTRANCE) elem1_1.addChildNode(elem1_1_2,AccNode.BODY,0) elem1_1.addChildNode(elem1_1_3,AccNode.BODY,1)
def addErrorNodeAsChild(lattice, AccNode, Error_Node): AccNode.addChildNode(Error_Node, AccNode.BODY, 0, AccNode.BEFORE) lattice.initialize()
def addErrorNodeAsChild_F(lattice, AccNode, Error_Node): AccNode.addChildNode(Error_Node, AccNode.EXIT) lattice.initialize()
def addErrorNodeAsChild_I(lattice, AccNode, Error_Node): AccNode.addChildNode(Error_Node, AccNode.ENTRANCE) lattice.initialize()
import sys import math import posix from orbit.lattice import AccLattice, AccNode, AccActionsContainer lattice = AccLattice("test_lattice") elem1 = AccNode("el-1") elem2 = AccNode("el-2") elem3 = AccNode("el-3") elem1.setLength(1.1) elem2.setLength(2.1) elem3.setLength(3.1) lattice.addNode(elem1) lattice.addNode(elem2) lattice.addNode(elem3) elem1_1 = AccNode("el-1-1") elem1_1.setnParts(2) elem1_1_1 = AccNode("el-1-1-1") elem1_1_2 = AccNode("el-1-1-2") elem1_1_3 = AccNode("el-1-1-3") elem1_1_4 = AccNode("el-1-1-4") elem1.addChildNode(elem1_1, AccNode.ENTRANCE) elem1_1.addChildNode(elem1_1_1, AccNode.ENTRANCE) elem1_1.addChildNode(elem1_1_2, AccNode.BODY, 0) elem1_1.addChildNode(elem1_1_3, AccNode.BODY, 1)
def __init__(self, name="no name"): AccNode.__init__(self, name) self.setType("end node")
def addLongitudinalSpaceChargeNodeAsChild(lattice, AccNode, scNode): AccNode.addChildNode(scNode,AccNode.BODY,0,AccNode.BEFORE) lattice.initialize()
def addImpedanceNodeAsChild(lattice, AccNode, Impedance_Node): AccNode.addChildNode(Impedance_Node, AccNode.BODY, 0, AccNode.BEFORE) lattice.initialize()
def addTeapotDiagnosticsNodeAsChild(lattice, AccNode, diagnostics_node): AccNode.addChildNode(diagnostics_node, AccNode.ENTRANCE, 0, AccNode.BEFORE) lattice.initialize()
def __init__(self, name="no name", type_in="bunch tracker"): """ Constructor. Creates an empty bunch tracker accelerator node. """ AccNode.__init__(self, name, type_in)
def addTeapotDiagnosticsNodeAsChild(lattice, AccNode, diagnostics_node): AccNode.addChildNode(diagnostics_node, AccNode.ENTRANCE,0,AccNode.BEFORE) lattice.initialize()
nodes = accNode.getChildNodes(AccNode.BODY,ind,AccNode.AFTER) for node in nodes: txt = printAccNodeStructure(node,txt,txt_shift + txt_shift_local*4) txt += txt_shift + txt_shift_local*2 + "==== BODY EXIT n parts =" + str(accNode.getnParts()) txt += txt_shift + txt_shift_local + "==== EXIT AccNode = " + accNode.getName() txt += " L=" + str(accNode.getLength()) txt += os.linesep for node in accNode.getChildNodes(AccNode.EXIT): txt = printAccNodeStructure(node,txt,txt_shift + txt_shift_local*2) txt += txt_shift + txt_shift_local + "==== END of AccNode = " + accNode.getName() txt += os.linesep return txt print "============== INITIAL NODE STRUCTURE =============" accNode = AccNode("test_node") accNode.setnParts(5) L = 0. nParts = accNode.getnParts() for ind in range(nParts): accNode.setLength(ind+1.0,ind) L += accNode.getLength(ind) accNode.setLength(L) for ind in range(nParts): accNode.setLength(ind+1.0,ind) L += accNode.getLength(ind) accNode.addChildNode(AccNode("chEntrn0"),AccNode.ENTRANCE) accNode.addChildNode(AccNode("chEntrn1"),AccNode.ENTRANCE) accNode.addChildNode(AccNode("chEntrn2"),AccNode.ENTRANCE)