def __init__(self, phaseLength, nMacrosMin, nBins,\ useX, useY,\ bunch, impeDict,\ qX, alphaX, betaX, qY, alphaY, betaY,\ name = "betfreq. dep. TImpedance node"): """ Constructor. Creates the BetFreqDep_TImpedance-teapot element. """ DriftTEAPOT.__init__(self, name) self.timpedance = TImpedance(phaseLength, nMacrosMin, nBins,\ useX, useY) self.setType("betafreq. dep. timpedance node") self.setLength(0.0) self.phaseLength = phaseLength self.nBins = nBins self.useX = useX self.useY = useY self.localDict = impeDict self.bet_tuple = self.localDict["betas"] self.bet_range = (len(self.bet_tuple) - 1) self.freq_tuple = self.localDict["freqs"] self.freq_range = (len(self.freq_tuple) - 1) self.c = consts.speed_of_light BetaRel = bunch.getSyncParticle().beta() Freq0 = (BetaRel * self.c) / self.phaseLength self.assignLatFuncs(qX, alphaX, betaX, qY, alphaY, betaY) self.calcImpedance(BetaRel, Freq0, self.qX, self.qY)
def __init__(self, phaseLength, nMacrosMin, nBins,\ bunch, impeDict,\ name = "freq. dep long sc node"): """ Constructor. Creates the BetFreqDep_LImpedance-teapot element. """ DriftTEAPOT.__init__(self, name) self.limpedance = LImpedance(phaseLength, nMacrosMin, nBins) self.setType("beta-freq. dep. limpedance node") self.setLength(0.0) self.phaseLength = phaseLength self.nBins = nBins self.localDict = impeDict self.bet_tuple = self.localDict["betas"] self.bet_range = (len(self.bet_tuple) - 1) self.freq_tuple = self.localDict["freqs"] self.freq_range = (len(self.freq_tuple) - 1) self.z_bf = self.localDict["z_imp"] self.c = consts.speed_of_light BetaRel = bunch.getSyncParticle().beta() Freq0 = (BetaRel * self.c) / self.phaseLength Z = [] for n in range(self.nBins / 2 - 1): freq_mode = Freq0 * (n + 1) z_mode = bilinterp(BetaRel, freq_mode,\ self.bet_range, self.freq_range,\ self.bet_tuple, self.freq_tuple,\ self.z_bf) Z.append(z_mode) self.limpedance.assignImpedance(Z)
def __init__(self, n_steps=None, ulims=None, phi=None, rms_frac_count_err=None, name='wire-scanner'): DriftTEAPOT.__init__(self, name) if n_steps is None: n_steps = 90 if ulims is None: ulims = (-0.1335, 0.1335) if phi is None: phi = np.radians(45.0) self.n_steps = n_steps self.rms_frac_count_err = rms_frac_count_err self.phi = phi umin, umax = ulims xmin = umin * np.cos(self.phi) xmax = umax * np.cos(self.phi) ymin = umin * np.sin(self.phi) ymax = umax * np.sin(self.phi) self.xlims = (xmin, xmax) self.ylims = (ymin, ymax) self.ulims = (umin, umax) self.xwire = Wire(self.n_steps, self.xlims, self.rms_frac_count_err) self.ywire = Wire(self.n_steps, self.ylims, self.rms_frac_count_err) self.uwire = Wire(self.n_steps, self.ulims, self.rms_frac_count_err) self.wires = [self.xwire, self.ywire, self.uwire]
def __init__(self, b_a, phaseLength, nMacrosMin, useSpaceCharge,\ nBins, bunch, impeDict,\ name = "freq. dep. long sc node"): """ Constructor. Creates the FreqDep_SC1D-teapot element. """ DriftTEAPOT.__init__(self, name) self.lspacecharge = LSpaceChargeCalc(b_a, phaseLength, nMacrosMin,\ useSpaceCharge, nBins) self.setType("freq. dep. long sc node") self.setLength(0.0) self.phaseLength = phaseLength self.nBins = nBins self.localDict = impeDict self.freq_tuple = self.localDict["freqs"] self.freq_range = (len(self.freq_tuple) - 1) self.z_tuple = self.localDict["z_imp"] self.c = consts.speed_of_light BetaRel = bunch.getSyncParticle().beta() Freq0 = (BetaRel * self.c) / self.phaseLength Z = [] for n in range(self.nBins / 2 - 1): freq_mode = Freq0 * (n + 1) z_mode = interp(freq_mode, self.freq_range,\ self.freq_tuple, self.z_tuple) Z.append(z_mode) self.lspacecharge.assignImpedance(Z)
def __init__(self, phaseLength, nMacrosMin, nBins,\ bunch, impeDict,\ name = "freq. dep. LImpedance node"): """ Constructor. Creates the FreqDep_LImpedance-teapot element. """ DriftTEAPOT.__init__(self, name) self.limpedance = LImpedance(phaseLength, nMacrosMin, nBins) self.setType("freq. dep. limpedance node") self.setLength(0.0) self.phaseLength = phaseLength self.nBins = nBins self.localDict = impeDict self.freq_tuple = self.localDict["freqs"] self.freq_range = (len(self.freq_tuple) - 1) self.z_tuple = self.localDict["z_imp"] self.c = consts.speed_of_light BetaRel = bunch.getSyncParticle().beta() Freq0 = (BetaRel * self.c) / self.phaseLength Z = [] for n in range(self.nBins / 2 - 1): freq_mode = Freq0 * (n + 1) z_mode = interp(freq_mode, self.freq_range,\ self.freq_tuple, self.z_tuple) Z.append(z_mode) self.limpedance.assignImpedance(Z)
def __init__(self, length, name="base_rfnode"): """ Constructor. Creates Base RF Cavity TEAPOT element. It will never be called. """ DriftTEAPOT.__init__(self, name) self.setType("base rf node") self.setLength(0.0)
def __init__(self, length, name = "base_rfnode"): """ Constructor. Creates Base RF Cavity TEAPOT element. It will never be called. """ DriftTEAPOT.__init__(self, name) self.setType("base rf node") self.setLength(0.0)
def __init__(self, nparts, bunch, lostbunch, foilparams, xDistFunc, yDistFunc, lDistFun, nmaxmacroparticles = -1, injectturninterval = 1, name = "injection"): """ Constructor. Creates the Injection TEAPOT element. """ DriftTEAPOT.__init__(self,name) self.injectparts = InjectParts(nparts, bunch, lostbunch, foilparams, xDistFunc, yDistFunc, lDistFun, nmaxmacroparticles, injectturninterval) self.setType("Injection") self.setLength(0.0)
def __init__(self, length, ma, density_fac, shape, a, b, c, d, angle, pos = 0, name = "collimator no name"): """ Constructor. Creates the Collimator TEAPOT element. """ DriftTEAPOT.__init__(self,name) self.collimator = Collimator(length,ma,density_fac,shape,a,b,c,d,angle,pos) self.setType("collimator teapot") self.setLength(length)
def __init__(self, bunch, strength, waveform, name="kicker"): """ Constructor. Creates the Kicker TEAPOT element. """ DriftTEAPOT.__init__(self, name) self.kicker = YKicker(bunch, strength, waveform) self.setType("YKicker") self.setLength(0.0)
def __init__(self, bunch, xbump, xpbump, ybump, ypbump, name = "bump"): """ Constructor. Creates the Bumpe TEAPOT element. """ DriftTEAPOT.__init__(self,name) self.simplebump = simpleBump(bunch, xbump, xpbump, ybump, ypbump); self.setType("Bump") self.setLength(0.0)
def __init__(self, bunch, xbump, xpbump, ybump, ypbump, name="bump"): """ Constructor. Creates the Bumpe TEAPOT element. """ DriftTEAPOT.__init__(self, name) self.simplebump = simpleBump(bunch, xbump, xpbump, ybump, ypbump) self.setType("Bump") self.setLength(0.0)
def __init__(self, drho,\ name = "BendF Field"): """ Constructor. Creates BendFieldF element. """ DriftTEAPOT.__init__(self, name) self.setType("bendf field node") self.setLength(0.0) self.drho = drho
def __init__(self, a, b, pos = 0, c = 0, d = 0, name = "aperture"): DriftTEAPOT.__init__(self,name) self.shape = 3 self.a = a self.b = b self.c = c self.d = d self.pos = pos self.Aperture = Aperture(self.shape, self.a, self.b, self.c, self.d, self.pos)
def __init__(self, angle,\ name = "XY Rotation"): """ Constructor. Creates StraightRotationXY element. """ DriftTEAPOT.__init__(self, name) self.setType("xy rotation node") self.setLength(0.0) self.angle = angle
def __init__(self, ds,\ name = "Longitudinal Displacement"): """ Constructor. Creates LongDisplacement element. """ DriftTEAPOT.__init__(self, name) self.setType("longitudinal displacement node") self.setLength(0.0) self.ds = ds
def __init__(self, phaseLength, nMacrosMin, nBins,\ name = "LImpedance node"): """ Constructor. Creates LImpedance element. """ DriftTEAPOT.__init__(self, name) self.limpedance = LImpedance(phaseLength, nMacrosMin, nBins) self.setType("limpedance node") self.setLength(0.0)
def __init__(self, disp,\ name = "BendYF Displacement"): """ Constructor. Creates BendDisplacementYF element. """ DriftTEAPOT.__init__(self, name) self.setType("yf bend displacement node") self.setLength(0.0) self.disp = disp
def __init__(self, k,\ name = "Quad Kicker"): """ Constructor. Creates QuadKicker element. """ DriftTEAPOT.__init__(self, name) self.setType("quadrupole kicker node") self.setLength(0.0) self.k = k
def __init__(self, name="BPMSignal no name"): """ Constructor. Creates the StatLats TEAPOT element. """ DriftTEAPOT.__init__(self, name) self.bpm = BPMSignal() self.setType("BPMSignal") self.lattlength = 0.0 self.setLength(0.0) self.position = 0.0
def __init__(self, name="tuneanalysis no name"): """ Constructor. Creates the StatLats TEAPOT element. """ DriftTEAPOT.__init__(self, name) self.bunchtune = BunchTuneAnalysis() self.setType("tune calculator teapot") self.lattlength = 0.0 self.setLength(0.0) self.position = 0.0
def __init__(self, name = "BPMSignal no name"): """ Constructor. Creates the StatLats TEAPOT element. """ DriftTEAPOT.__init__(self,name) self.bpm = BPMSignal() self.setType("BPMSignal") self.lattlength = 0.0 self.setLength(0.0) self.position = 0.0
def __init__(self, xmin, xmax, ymin, ymax, thick, name = "foil no name"): """ Constructor. Creates the Foil TEAPOT element. """ DriftTEAPOT.__init__(self,name) self.foil = Foil(xmin, xmax, ymin, ymax, thick) self.setType("foil teapot") self.setLength(0.0) # The user choice of scattering routine. Defualt (0) is full scatter self.scatterChoice = 0
def __init__(self, angle, lengthelt,\ name = "YSF Rotation"): """ Constructor. Creates StraightRotationYSF element. """ DriftTEAPOT.__init__(self, name) self.setType("ysf rotation node") self.setLength(0.0) self.angle = angle self.lengthelt = lengthelt
def __init__(self, b_a, phaseLength, nMacrosMin, useSpaceCharge,\ nBins, name = "long sc node"): """ Constructor. Creates the SC1D-teapot element. """ DriftTEAPOT.__init__(self, name) self.lspacecharge = LSpaceChargeCalc(b_a, phaseLength, nMacrosMin,\ useSpaceCharge, nBins) self.setType("long sc node") self.setLength(0.0)
def __init__(self, bx, by, ax, ay, ex, epx, l, zi, zf, ds, niters, resid, xrefi, yrefi, eulerai, eulerbi, eulergi, b, filename): """ Constructor. Creates the FieldTracker TEAPOT element. """ DriftTEAPOT.__init__(self,name) self.fieldtracker = FieldTracker(order, bx, by, ax, ay, ex, epx, l, zi, zf, ds, niters, resid, xrefi, yrefi, eulerai, eulerbi, eulergi, apflag, b) self.setType("fieldtracker teapot") self.setLength(l)
def __init__(self, bunch, xbump, xpbump, ybump, ypbump, \ waveform, name = "bump"): """ Constructor. Creates a TDBump TEAPOT element. """ DriftTEAPOT.__init__(self, name) self.TDsimplebump = TDsimpleBump(bunch, xbump, xpbump, \ ybump, ypbump, waveform) self.setType("Bump") self.setLength(0.0)
def __init__(self, xmin, xmax, ymin, ymax, thick, name="foil no name"): """ Constructor. Creates the Foil TEAPOT element. """ DriftTEAPOT.__init__(self, name) self.foil = Foil(xmin, xmax, ymin, ymax, thick) self.setType("foil teapot") self.setLength(0.0) # The user choice of scattering routine. Defualt (0) is full scatter self.scatterChoice = 0
def __init__(self, dxp, dyp,\ name = "Dipole Kicker"): """ Constructor. Creates DipoleKicker element. """ DriftTEAPOT.__init__(self, name) self.setType("dipole kicker node") self.setLength(0.0) self.dxp = dxp self.dyp = dyp
def __init__(self, theta, disp,\ name = "BendLI Displacement"): """ Constructor. Creates BendDisplacementLI element. """ DriftTEAPOT.__init__(self, name) self.setType("li bend displacement node") self.setLength(0.0) self.theta = theta self.disp = disp
def __init__(self, name = "tuneanalysis no name"): """ Constructor. Creates the StatLats TEAPOT element. """ DriftTEAPOT.__init__(self,name) self.bunchtune = BunchTuneAnalysis() self.setType("tune calculator teapot") self.lattlength = 0.0 self.setLength(0.0) self.position = 0.0
def __init__(self, filename, name="statlats no name"): """ Constructor. Creates the StatLats TEAPOT element. """ DriftTEAPOT.__init__(self, name) self.statlats = StatLats(filename) self.setType("statlats teapot") self.setLength(0.0) self.position = 0.0 self.lattlength = 0.0 self.file_out = open(filename, "w")
def __init__(self, k, phaselength, phase,\ name = "Quad Kicker Osc"): """ Constructor. Creates QuadKickerOsc element. """ DriftTEAPOT.__init__(self, name) self.setType("oscillating quadrupole kicker node") self.setLength(0.0) self.k = k self.phaselength = phaselength self.phase = phase
def __init__(self, filename , name = "statlats no name"): """ Constructor. Creates the StatLats TEAPOT element. """ DriftTEAPOT.__init__(self,name) self.statlats = StatLats(filename) self.setType("statlats teapot") self.setLength(0.0) self.position = 0.0 self.lattlength = 0.0 self.file_out = open(filename,"w")
def __init__(self, filename, order, nodispersion = True, emitnorm = False, name = "moments no name"): """ Constructor. Creates the StatLats TEAPOT element. """ DriftTEAPOT.__init__(self,name) self.moments = Moments(filename, order, nodispersion, emitnorm) self.setType("moments teapot") self.setLength(0.0) self.position = 0.0 self.lattlength = 0.0 self.file_out = open(filename,"w")
def __init__(self, file, name = "statlats no name"): """ Constructor. Creates the StatLats TEAPOT element. """ DriftTEAPOT.__init__(self,name) self.statlats = StatLatsSetMember(file) self.setType("statlats teapot") self.setLength(0.0) self.position = 0.0 self.lattlength = 0.0 self.active = True self.file = file
def __init__(self, phaseLength, nMacrosMin, nBins,\ useX, useY,\ name = "TImpedance node"): """ Constructor. Creates TImpedance element. """ DriftTEAPOT.__init__(self, name) self.timpedance = TImpedance(phaseLength, nMacrosMin, nBins,\ useX, useY) self.setType("timpedance node") self.setLength(0.0) self.nBins = nBins
def __init__(self, file, name="statlats no name"): """ Constructor. Creates the StatLats TEAPOT element. """ DriftTEAPOT.__init__(self, name) self.statlats = StatLatsSetMember(file) self.setType("statlats teapot") self.setLength(0.0) self.position = 0.0 self.lattlength = 0.0 self.active = True self.file = file
def __init__(self, file, order, nodispersion = True, emitnorm = False, name = "moments no name"): """ Constructor. Creates the Moments TEAPOT element. """ DriftTEAPOT.__init__(self,str(name)) self.file = file self.moments = MomentsSetMember(self.file, order, nodispersion, emitnorm) self.setType("moments teapot") self.setLength(0.0) self.position = 0.0 self.lattlength = 0.0 self.active = True
def __init__(self, dx, dxp, dy, dyp, dz, dE,\ name = "Coordinate Displacement"): """ Constructor. Creates CoordDisplacement element. """ DriftTEAPOT.__init__(self, name) self.setType("coordinate displacement node") self.setLength(0.0) self.dx = dx self.dxp = dxp self.dy = dy self.dyp = dyp self.dz = dz self.dE = dE
def __init__(self, angle, rhoi, theta, lengthelt, et, rotype,\ name = "RotationF General"): """ Constructor. Creates RotationF element. """ DriftTEAPOT.__init__(self, name) self.setType("generalf rotation node") self.setLength(0.0) self.angle = angle self.rhoi = rhoi self.theta = theta self.lengthelt = lengthelt self.et = et self.rotype = rotype
def __init__(self, filename, order, nodispersion=True, emitnorm=False, name="moments no name"): """ Constructor. Creates the StatLats TEAPOT element. """ DriftTEAPOT.__init__(self, name) self.moments = Moments(filename, order, nodispersion, emitnorm) self.setType("moments teapot") self.setLength(0.0) self.position = 0.0 self.lattlength = 0.0 self.file_out = open(filename, "w")
def __init__(self, file, order, nodispersion=True, emitnorm=False, name="moments no name"): """ Constructor. Creates the Moments TEAPOT element. """ DriftTEAPOT.__init__(self, str(name)) self.file = file self.moments = MomentsSetMember(self.file, order, nodispersion, emitnorm) self.setType("moments teapot") self.setLength(0.0) self.position = 0.0 self.lattlength = 0.0 self.active = True
def __init__(self, length, ma, density_fac, shape, a, b, c, d, angle, pos=0., name="collimator no name"): """ Constructor. Creates the Collimator TEAPOT element. """ DriftTEAPOT.__init__(self, name) self.collimator = Collimator(length, ma, density_fac, shape, a, b, c, d, angle, pos) self.setType("collimator teapot") self.setLength(length)