示例#1
0
    def test_update(self):
        """
        same data different mask
        """
        bpmlst = [e.name for e in ap.getElements('BPM')]
        trimlst = ['ch1g6c15b', 'cl2g6c14b', 'cm1g4c26a']
        trimlst1 = trimlst[0:1]
        trimlst2 = trimlst[1:2]

        #trimx = ['CXH1G6C15B']
        trims = ap.getElements(trimlst)
        for t in trims: 
            t.x = 0
            t.y = 0

        nametag = time.strftime("%Y%m%d_%H%M.hdf5")
        fname1 = "orm_update_1_" + nametag
        fname2 = "orm_update_2_" + nametag
        orm1 = ap.measOrbitRm(bpmlst, trimlst1, fname1, verbose=2)
        orm2 = ap.measOrbitRm(bpmlst, trimlst2, fname2, verbose=2)

        ormdata_dst = ap.OrmData(fname1)
        ormdata_src = ap.OrmData(fname2)
        
        ormdata_dst.update(ormdata_src)

        self.assertIn(trimlst2[0], ormdata_dst.getTrimNames())
示例#2
0
 def test_measure_orm_l2(self):
     bpms = ap.getElements('BPM')
     trims = ap.getElements('COR')
     
     # if jenkins run this test, measure whole ORM
     nbpm, ntrim = 5, 2
     if "JENKINS_URL" in os.environ and \
        int(os.environ.get("BUILD_NUMBER", "0")) % 2 == 0:
         nbpm, ntrim = len(bpms), len(trims)
     bpmlst = [b.name for b in bpms[:nbpm]]
     trimlst = [t.name for t in trims[:ntrim]]
     fname = time.strftime("orm_%Y%m%d_%H%M.hdf5")
     ap.measOrbitRm(bpmlst, trimlst, fname, verbose=2, minwait=5)
示例#3
0
    def test_measure_orm_sub1_l2(self):
        #trimlst = ['ch1g6c15b', 'cl2g6c14b', 'cm1g4c26a']
        trimlst = ['cl2g6c14b']
        #trimx = ['CXH1G6C15B']
        bpmlst = [e.name for e in ap.getElements('BPM')]
        trims = ap.getElements(trimlst)
        for t in trims: 
            t.x = 0
            t.y = 0

        fname = time.strftime("orm_sub1_%Y%m%d_%H%M.hdf5")
        orm1 = ap.measOrbitRm(bpmlst, trimlst, fname, verbose=2)

        ormdat = ap.apdata.OrmData(fname)
        
        corr = trims[0] 
        x0 = corr.x
        obt0 = ap.getOrbit(spos=True)
        dxlst = np.linspace(-1e-4, 1e-4, 5) + x0
        obt = []
        for i,dx in enumerate(dxlst):
            corr.x = dx
            time.sleep(3)
            obt.append(ap.getOrbit(spos=True))

        jbpm = 36
        bpm = ap.getExactElement(bpmlst[jbpm])
        mij = ormdat.get(bpm.name, 'x', corr.name, 'x')
        dxobt = [obt[i][jbpm,0] for i in range(len(dxlst))]
        plt.clf()
        plt.plot(dxlst, dxobt, 'r--o')
        plt.plot(dxlst, mij*dxlst + obt0[jbpm,0])
        plt.savefig(figname("test_measure_orm_sub1_linearity.png"))
        corr.x = x0