def scanDFT(self, ch=0): nsmpls = sv("NumSamples", self._path).getVal() + 1 resr = sv("DFTDiagChannels[{:d}]/DFT_R".format(ch), self._path) resu = sv("DFTDiagChannels[{:d}]/DFT_U".format(ch), self._path) resv = sv("DFTDiagChannels[{:d}]/DFT_V".format(ch), self._path) R = list() U = list() V = list() raw = list() self.setWeightReal(ch) sv("DFTScaleR", self._path).setVal(32768) sv("DFTScaleU", self._path).setVal(32768) sv("DFTScaleV", self._path).setVal(32768) for i in range(0, nsmpls): self.setDFT(2 * np.pi * i / nsmpls, ch) raw.append(self.cplx(resr.getVal())) R.append(self.cabs(resr.getVal())) U.append(self.cabs(resu.getVal())) V.append(self.cabs(resv.getVal())) return (U, V, R, raw)
def pc(self, ch): return sv( "Channels[{}]/PolyCoeffs[0-{}]".format( ch, 6 * (self.pOrd + 1) * self.nP - 1), self.bpm.getPath())
def fc(self, ch): return sv( "Channels[{}]/FilterCoeffs[0-{}]".format(ch, 8 * self.nP - 1), self.bpm.getPath())
def setWeightReal(self, ch, val=1.0): ch = self._path.findByName("DFTChannels[{:d}]".format(ch)) sv("CoeffHU_Im", ch).setVal(0) sv("CoeffHU_Re", ch).setVal(self.flt2i17(val)) sv("CoeffHV_Im", ch).setVal(0) sv("CoeffHV_Re", ch).setVal(self.flt2i17(val))
def clearDFT(self, ch): sv("Coeff2C1", ch).setVal(0) sv("Coeff2S1", ch).setVal(0) sv("Coeff2C2", ch).setVal(0) sv("Coeff2C4", ch).setVal(0)
def setDFT(self, fi, ch): ch = self._path.findByName("DFTChannels[{:d}]".format(ch)) sv("Coeff2C1", ch).setVal(self.flt2i17(np.cos(1 * fi))) sv("Coeff2S1", ch).setVal(self.flt2i17(np.sin(1 * fi))) sv("Coeff2C2", ch).setVal(self.flt2i17(np.cos(2 * fi))) sv("Coeff2C4", ch).setVal(self.flt2i17(np.cos(4 * fi)))
def __init__(self, path): self._path = path self._uCplx = sv("ComplexU", path) self._vCplx = sv("ComplexV", path)
hasMode = False for opt, arg in opts: if opt == "-C": modeCav = True hasMode = True elif opt == "-S": modeCav = False hasMode = True bpmMiscUtilsInit(myOpts()) logOn("logf.yaml") # silence the Fan sv(pgrep(".*FanController/Bypass")[0], root()).setVal(0) for bay in [0, 1]: if not hasMode: fwMode = sv( pgrep(".*AmcBay{:d}/Bpm/FirmwareConfiguration".format(bay))[0], root()).getVal() print("FW Mode: ", fwMode) modeCav = (fwMode != "StriplineBpm") print("Cavity Mode: ", modeCav) s = bpm.SIM(bay) s.getBpm().set("Command", "Halt") # U: Fo 30 , Bw: 1.25