예제 #1
0
 def test_set_bmstate(self):
     fm_none = ModelFlame()
     self.assertIsNone(fm_none.bmstate)
     with open(self.testfile, 'rb') as f:
         m = Machine(f)
     s = m.allocState({})
     m.propagate(s, 0, 1)
     fm_none.bmstate = s
     compare_mstates(self, fm_none.bmstate, s)
예제 #2
0
    def test_run_5(self):
        """ test_run_5: using BeamState object
        """
        latfile = self.testfile
        with open(latfile, 'rb') as f:
            m0 = Machine(f)
        ms = BeamState(machine=m0)

        fm = ModelFlame()
        fm.bmstate = ms
        fm.machine = m0
        obs = fm.get_index_by_type(type='bpm')['bpm']
        r,s = fm.run(monitor=obs)

        s0 = m0.allocState({})
        m0.propagate(s0, 0, 1)
        r0 = m0.propagate(s0, 1, len(m0), observe=obs)
        rs0 = [ts for (ti,ts) in r0]
        rs = [ts for (ti,ts) in r]
        for (is1, is2) in zip(rs0, rs):
            compare_mstates(self, is1, is2)
        compare_mstates(self, s, s0)