Ejemplo n.º 1
0
    def test_run_program(self):
        wf = DummyWaveform(duration=1.1, defined_channels={'A', 'B'})

        block = InstructionBlock()
        block.add_instruction_meas([('m1', 0., 1.)])
        block.add_instruction_exec(wf)

        awg1 = DummyAWG()
        awg2 = DummyAWG()
        awg3 = DummyAWG()

        dac1 = DummyDAC()
        dac2 = DummyDAC()

        setup = HardwareSetup()

        setup.set_channel('A', PlaybackChannel(awg1, 0))
        setup.set_channel('B', MarkerChannel(awg2, 0))
        setup.set_channel('C', MarkerChannel(awg3, 0))

        setup.set_measurement('m1', MeasurementMask(dac1, 'DAC_1'))
        setup.set_measurement('m2', MeasurementMask(dac2, 'DAC_2'))

        class ProgStart:
            def __init__(self):
                self.was_started = False

            def __call__(self):
                self.was_started = True

        program_started = ProgStart()

        setup.register_program('test', block, run_callback=program_started)

        self.assertIsNone(awg1._armed)
        self.assertIsNone(awg2._armed)
        self.assertIsNone(awg3._armed)
        self.assertIsNone(dac1._armed_program)
        self.assertIsNone(dac2._armed_program)

        setup.run_program('test')

        self.assertEqual(awg1._armed, 'test')
        self.assertEqual(awg2._armed, 'test')
        self.assertIsNone(awg3._armed)
        self.assertEqual(dac1._armed_program, 'test')
        self.assertIsNone(dac2._armed_program)

        self.assertTrue(program_started.was_started)
Ejemplo n.º 2
0
    def test_run_program(self):

        loop, *rest = self.get_test_loops()

        awg1 = DummyAWG()
        awg2 = DummyAWG()
        awg3 = DummyAWG()

        dac1 = DummyDAC()
        dac2 = DummyDAC()

        setup = HardwareSetup()

        setup.set_channel('A', PlaybackChannel(awg1, 0))
        setup.set_channel('B', MarkerChannel(awg2, 0))
        setup.set_channel('C', MarkerChannel(awg3, 0))

        setup.set_measurement('m1', MeasurementMask(dac1, 'DAC_1'))
        setup.set_measurement('m2', MeasurementMask(dac2, 'DAC_2'))

        class ProgStart:
            def __init__(self):
                self.was_started = False

            def __call__(self):
                self.was_started = True

        program_started = ProgStart()

        setup.register_program('test', loop, run_callback=program_started)

        self.assertIsNone(awg1._armed)
        self.assertIsNone(awg2._armed)
        self.assertIsNone(awg3._armed)
        self.assertIsNone(dac1._armed_program)
        self.assertIsNone(dac2._armed_program)

        setup.run_program('test')

        self.assertEqual(awg1._armed, 'test')
        self.assertEqual(awg2._armed, 'test')
        self.assertIsNone(awg3._armed)
        self.assertEqual(dac1._armed_program, 'test')
        self.assertIsNone(dac2._armed_program)

        self.assertTrue(program_started.was_started)