Beispiel #1
0
    def test_clear_programs(self) -> None:
        setup = HardwareSetup()
        awg1 = DummyAWG(num_channels=2, num_markers=0)
        awg2 = DummyAWG(num_channels=1, num_markers=1)
        dac1 = DummyDAC()
        dac2 = DummyDAC()
        setup.set_channel('A', PlaybackChannel(awg1, 0))
        setup.set_channel('B', PlaybackChannel(awg1, 1))
        setup.set_channel('C', PlaybackChannel(awg2, 0))
        setup.set_channel('M1', MarkerChannel(awg2, 0))

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

        loop1, loop2, loop3 = self.get_test_loops()

        setup.register_program('prog1', loop1)
        setup.register_program('prog2', loop2)
        setup.register_program('prog3', loop3)

        self.assertTrue(setup.registered_programs)

        setup.clear_programs()

        self.assertFalse(setup.registered_programs)
Beispiel #2
0
    def test_remove_program(self):
        loop1, loop2, _ = 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'))

        setup.register_program('test_1', loop1)

        setup.register_program('test_2', loop2)

        setup.arm_program('test_1')

        setup.remove_program('test_1')

        self.assertEqual(setup.registered_programs.keys(), {'test_2'})

        self.assertIsNone(awg1._armed)
        self.assertIsNone(awg2._armed)
Beispiel #3
0
    def test_update_parameters(self) -> None:
        setup = HardwareSetup()
        awg1 = DummyAWG(num_channels=2, num_markers=0)
        awg2 = DummyAWG(num_channels=1, num_markers=1)
        dac1 = DummyDAC()
        dac2 = DummyDAC()
        setup.set_channel('A', PlaybackChannel(awg1, 0))
        setup.set_channel('B', PlaybackChannel(awg1, 1))
        setup.set_channel('C', PlaybackChannel(awg2, 0))
        setup.set_measurement('m1', MeasurementMask(dac1, 'DAC_1'))
        setup.set_measurement('m2', MeasurementMask(dac2, 'DAC_2'))
        loop1, loop2, _ = self.get_test_loops()
        name1 = 'prog1'
        name2 = 'prog2'
        setup.register_program(name1, loop1)
        setup.register_program(name2, loop2)

        parameters = dict(a=1, b=5)

        with mock.patch.object(DummyAWG, 'set_volatile_parameters') as setpara:
            setup.update_parameters(name1, parameters)
            setpara.assert_called_once_with(name1, parameters)
        with mock.patch.object(DummyAWG, 'set_volatile_parameters') as setpara:
            setup.update_parameters(name2, parameters)
            assert setpara.call_count == 2
            setpara.assert_called_with(name2, parameters)
Beispiel #4
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)
Beispiel #5
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)
Beispiel #6
0
    def test_remove_program(self):
        wf_1 = DummyWaveform(duration=1.1, defined_channels={'A', 'B'})
        wf_2 = DummyWaveform(duration=1.1, defined_channels={'A', 'C'})

        block_1 = InstructionBlock()
        block_2 = InstructionBlock()

        block_1.add_instruction_meas([('m1', 0., 1.)])
        block_1.add_instruction_exec(wf_1)

        block_2.add_instruction_meas([('m2', 0., 1.)])
        block_2.add_instruction_exec(wf_2)

        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'))

        setup.register_program('test_1', block_1)

        setup.register_program('test_2', block_2)

        setup.arm_program('test_1')

        setup.remove_program('test_1')

        self.assertEqual(setup.registered_programs.keys(), {'test_2'})

        self.assertIsNone(awg1._armed)
        self.assertIsNone(awg2._armed)
Beispiel #7
0
    def test_clear_programs(self) -> None:
        setup = HardwareSetup()
        awg1 = DummyAWG(num_channels=2, num_markers=0)
        awg2 = DummyAWG(num_channels=1, num_markers=1)
        dac1 = DummyDAC()
        dac2 = DummyDAC()
        setup.set_channel('A', PlaybackChannel(awg1, 0))
        setup.set_channel('B', PlaybackChannel(awg1, 1))
        setup.set_channel('C', PlaybackChannel(awg2, 0))
        setup.set_channel('M1', MarkerChannel(awg2, 0))

        wf1 = DummyWaveform(duration=1.1, defined_channels={'C'})
        wf2 = DummyWaveform(duration=7.2, defined_channels={'A'})
        wf3 = DummyWaveform(duration=3.7, defined_channels={'B', 'C'})

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

        block1 = InstructionBlock()
        block1.add_instruction_exec(wf1)

        block2 = InstructionBlock()
        block2.add_instruction_meas([('m1', 0., 1.)])
        block2.add_instruction_exec(wf2)

        block3 = InstructionBlock()
        block3.add_instruction_meas([('m2', 2., 3.)])
        block3.add_instruction_exec(wf3)

        setup.register_program('prog1', block1)
        setup.register_program('prog2', block2)
        setup.register_program('prog3', block3)

        self.assertTrue(setup.registered_programs)

        setup.clear_programs()

        self.assertFalse(setup.registered_programs)
Beispiel #8
0
    def test_register_program_exceptions(self):
        setup = HardwareSetup()

        loop, *rest = self.get_test_loops()

        with self.assertRaises(TypeError):
            setup.register_program('p1', loop, 4)

        with self.assertRaises(KeyError):
            setup.register_program('p1', loop, lambda: None)

        awg = DummyAWG(num_channels=2, num_markers=5)

        setup.set_channel('A', PlaybackChannel(awg, 0, lambda x: x))
        setup.set_channel('B', MarkerChannel(awg, 1))

        with self.assertRaises(KeyError):
            setup.register_program('p1', loop, lambda: None)
Beispiel #9
0
    def test_register_program_exceptions(self):
        setup = HardwareSetup()

        wfg = WaveformGenerator(num_channels=2,
                                duration_generator=itertools.repeat(1))
        block = get_two_chan_test_block(wfg)

        with self.assertRaises(TypeError):
            setup.register_program('p1', block, 4)

        with self.assertRaises(KeyError):
            setup.register_program('p1', block, lambda: None)

        awg = DummyAWG(num_channels=2, num_markers=5)

        setup.set_channel('A', PlaybackChannel(awg, 0, lambda x: x))
        setup.set_channel('B', MarkerChannel(awg, 1))

        with self.assertRaises(ValueError):
            setup.register_program('p1', block, lambda: None)
    def test_all(self):
        from qupulse.hardware.feature_awg.tabor import TaborChannelTuple, TaborDevice
        #import warnings
        tawg = TaborDevice(r'USB0::0x168C::0x2184::0000216488::INSTR')
        tchannelpair = TaborChannelTuple(tawg, (1, 2), 'TABOR_AB')
        tawg.paranoia_level = 2

        #warnings.simplefilter('error', Warning)

        from qupulse.hardware.setup import HardwareSetup, PlaybackChannel, MarkerChannel
        hardware_setup = HardwareSetup()

        hardware_setup.set_channel('TABOR_A', PlaybackChannel(tchannelpair, 0))
        hardware_setup.set_channel('TABOR_B', PlaybackChannel(tchannelpair, 1))
        hardware_setup.set_channel('TABOR_A_MARKER',
                                   MarkerChannel(tchannelpair, 0))
        hardware_setup.set_channel('TABOR_B_MARKER',
                                   MarkerChannel(tchannelpair, 1))

        if with_alazar:
            from qupulse.hardware.dacs.alazar import AlazarCard
            import atsaverage.server

            if not atsaverage.server.Server.default_instance.running:
                atsaverage.server.Server.default_instance.start(key=b'guest')

            import atsaverage.core

            alazar = AlazarCard(atsaverage.core.getLocalCard(1, 1))
            alazar.register_mask_for_channel('A', 0)
            alazar.register_mask_for_channel('B', 0)
            alazar.register_mask_for_channel('C', 0)
            alazar.config = get_alazar_config()

            alazar.register_operations('test', get_operations())
            window = get_window(atsaverage.core.getLocalCard(1, 1))
            hardware_setup.register_dac(alazar)

        repeated = get_pulse()

        from qupulse.pulses.sequencing import Sequencer

        sequencer = Sequencer()
        sequencer.push(repeated,
                       parameters=dict(n=1000, min=-0.5, max=0.5, tau=192 * 3),
                       channel_mapping={
                           'out': 'TABOR_A',
                           'trigger': 'TABOR_A_MARKER'
                       },
                       window_mapping=dict(A='A', B='B', C='C'))
        instruction_block = sequencer.build()

        hardware_setup.register_program('test', instruction_block)

        if with_alazar:
            from atsaverage.masks import PeriodicMask
            m = PeriodicMask()
            m.identifier = 'D'
            m.begin = 0
            m.end = 1
            m.period = 1
            m.channel = 0
            alazar._registered_programs['test'].masks.append(m)

        hardware_setup.arm_program('test')

        d = 1
Beispiel #11
0
    def test_register_program(self):
        awg1 = DummyAWG()
        awg2 = DummyAWG(num_channels=2, num_markers=5)

        dac = DummyDAC()

        setup = HardwareSetup()

        loop, *rest = self.get_test_loops()

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

            def __call__(self):
                self.was_started = True

        program_started = ProgStart()

        trafo1 = lambda x: x

        setup.set_channel('A', PlaybackChannel(awg1, 0, trafo1))
        setup.set_channel('B', MarkerChannel(awg2, 1))

        setup.set_measurement('m1', MeasurementMask(dac, 'DAC'))

        setup.register_program('p1', loop, program_started)

        self.assertEqual(tuple(setup.registered_programs.keys()), ('p1', ))
        self.assertEqual(setup.registered_programs['p1'].run_callback,
                         program_started)
        self.assertEqual(setup.registered_programs['p1'].awgs_to_upload_to,
                         {awg1, awg2})

        self.assertFalse(program_started.was_started)

        self.assertEqual(len(awg1._programs), 1)
        self.assertEqual(len(awg2._programs), 1)

        _, channels, markers, trafos = awg1._programs['p1']
        self.assertEqual(channels, ('A', ))
        self.assertEqual(markers, (None, ))
        self.assertEqual(trafos, (trafo1, ))

        _, channels, markers, trafos = awg2._programs['p1']
        self.assertEqual(channels, (None, None))
        self.assertEqual(markers, (None, 'B', None, None, None))

        self.assertEqual(awg1._armed, None)
        self.assertEqual(awg2._armed, None)

        expected_measurement_windows = {
            'p1': {
                'DAC': (np.array([
                    0,
                ]), np.array([
                    1,
                ]))
            }
        }
        np.testing.assert_equal(dac._measurement_windows,
                                expected_measurement_windows)
Beispiel #12
0
#%%
""" Create a program dnp with the number of pulse repetitions as volatile parameters """

sample_rate = awg_channel.sample_rate / 10**9
n_quant = 192
t_quant = n_quant / sample_rate

dnp_prog = dnp.create_program(parameters=dict(tend=float(t_quant), ta=float(t_quant/3), tb=float(2*t_quant/3),
                                              va=0.12, vb=0.25, n_minus=3, n_zero=3, n_plus=3),
                              channel_mapping={'X': '{}_A'.format(awg_name), 'Y': '{}_B'.format(awg_name)},
                              volatile={'n_minus', 'n_zero', 'n_plus'})
dnp_prog.cleanup()

#%%
""" Upload this program to the AWG """

hardware_setup.register_program('dnp', dnp_prog)
hardware_setup.arm_program('dnp')

#%%
""" Run initial program """

awg_channel.run_current_program()

#%%
""" Change volatile parameters to new values and run the modified program """

hardware_setup.update_parameters('dnp', dict(n_zero=1, n_plus=5))
awg_channel.run_current_program()
Beispiel #13
0
    def test_register_program(self):
        awg1 = DummyAWG()
        awg2 = DummyAWG(num_channels=2, num_markers=5)

        dac = DummyDAC()

        setup = HardwareSetup()

        wfg = WaveformGenerator(num_channels=2,
                                duration_generator=itertools.repeat(1))
        block = get_two_chan_test_block(wfg)
        block._InstructionBlock__instruction_list[:0] = (MEASInstruction([
            ('m1', 0.1, 0.2)
        ]), )

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

            def __call__(self):
                self.was_started = True

        program_started = ProgStart()

        trafo1 = lambda x: x

        setup.set_channel('A', PlaybackChannel(awg1, 0, trafo1))
        setup.set_channel('B', MarkerChannel(awg2, 1))

        setup.set_measurement('m1', MeasurementMask(dac, 'DAC'))

        setup.register_program('p1', block, program_started)

        self.assertEqual(tuple(setup.registered_programs.keys()), ('p1', ))
        self.assertEqual(setup.registered_programs['p1'].run_callback,
                         program_started)
        self.assertEqual(setup.registered_programs['p1'].awgs_to_upload_to,
                         {awg1, awg2})

        self.assertFalse(program_started.was_started)

        self.assertEqual(len(awg1._programs), 1)
        self.assertEqual(len(awg2._programs), 1)

        _, channels, markers, trafos = awg1._programs['p1']
        self.assertEqual(channels, ('A', ))
        self.assertEqual(markers, (None, ))
        self.assertEqual(trafos, (trafo1, ))

        _, channels, markers, trafos = awg2._programs['p1']
        self.assertEqual(channels, (None, None))
        self.assertEqual(markers, (None, 'B', None, None, None))

        self.assertEqual(awg1._armed, None)
        self.assertEqual(awg2._armed, None)

        expected_measurement_windows = {
            'p1': {
                'DAC': (np.array([0.1, 0.1]), np.array([0.2, 0.2]))
            }
        }
        np.testing.assert_equal(dac._measurement_windows,
                                expected_measurement_windows)
class PulseLoadingAndSequencingHelper:
    def __init__(self, data_folder, pulse_name):
        self.data_folder = data_folder
        self.pulse_name = pulse_name

        self.parameters = self.load_json('parameters.json')
        self.window_mapping = self.load_json('measurement_mapping.json')
        self.channel_mapping = self.load_json('channel_mapping.json')
        self.preparation_commands = self.load_json('preparation_commands.json')

        expected_binary_programs = self.load_json('binary_programs.json')
        if expected_binary_programs:
            self.expected_binary_programs = [
                PlottableProgram.from_builtin(prog) if prog else None
                for prog in expected_binary_programs
            ]
        else:
            self.expected_binary_programs = None

        self.validate_programs = self.load_function_from_file(
            'binary_program_validation.py', 'validate_programs')
        self.validation_data = self.load_json('binary_program_validation.json')

        self.pulse = None
        self.program = None

        self.simulator_manager = None

        self.hardware_setup = None  # type: HardwareSetup
        self.dac = None  # type: DummyDAC
        self.awg = None  # type: TaborAWGRepresentation

        self.program_AB = None
        self.program_CD = None

    def load_json(self, file_name):
        complete_file_name = os.path.join(self.data_folder, file_name)
        if os.path.exists(complete_file_name):
            with open(complete_file_name, 'r') as file_handle:
                return json.load(file_handle)
        else:
            return None

    def load_function_from_file(self, file_name, function_name):
        full_file_name = os.path.join(self.data_folder, file_name)
        if not os.path.exists(full_file_name):
            return None
        module_name = os.path.normpath(
            os.path.splitext(full_file_name)[0]).replace(os.sep, '.')

        if module_name in sys.modules:
            module = sys.modules[module_name]
        else:
            try:
                spec = importlib.util.spec_from_file_location(
                    module_name, full_file_name)
                module = importlib.util.module_from_spec(spec)
                spec.loader.exec_module(module)
            except ImportError:
                return None
        return getattr(module, function_name, None)

    def deserialize_pulse(self):
        serializer = Serializer(
            FilesystemBackend(os.path.join(self.data_folder, 'pulse_storage')))
        self.pulse = typing.cast(PulseTemplate,
                                 serializer.deserialize(self.pulse_name))

    def deserialize_pulse_2018(self) -> None:
        pulse_storage = PulseStorage(
            FilesystemBackend(
                os.path.join(self.data_folder,
                             'pulse_storage_converted_2018')))
        self.pulse = typing.cast(PulseTemplate, pulse_storage[self.pulse_name])

    def sequence_pulse(self):
        self.program = self.pulse.create_program(
            parameters=self.parameters,
            measurement_mapping=self.window_mapping,
            channel_mapping=self.channel_mapping)

    def initialize_hardware_setup(self):
        self.simulator_manager = TaborSimulatorManager()

        try:
            self.simulator_manager.start_simulator()
        except RuntimeError as err:
            raise unittest.SkipTest(*err.args) from err

        self.awg = self.simulator_manager.connect()
        if self.preparation_commands:
            for cmd in self.preparation_commands:
                self.awg.send_cmd(cmd)

        self.dac = DummyDAC()
        self.hardware_setup = HardwareSetup()

        self.hardware_setup.set_channel(
            'TABOR_A', PlaybackChannel(self.awg.channel_pair_AB, 0))
        self.hardware_setup.set_channel(
            'TABOR_B', PlaybackChannel(self.awg.channel_pair_AB, 1))
        self.hardware_setup.set_channel(
            'TABOR_A_MARKER', MarkerChannel(self.awg.channel_pair_AB, 0))
        self.hardware_setup.set_channel(
            'TABOR_B_MARKER', MarkerChannel(self.awg.channel_pair_AB, 1))

        self.hardware_setup.set_channel(
            'TABOR_C', PlaybackChannel(self.awg.channel_pair_CD, 0))
        self.hardware_setup.set_channel(
            'TABOR_D', PlaybackChannel(self.awg.channel_pair_CD, 1))
        self.hardware_setup.set_channel(
            'TABOR_C_MARKER', MarkerChannel(self.awg.channel_pair_CD, 0))
        self.hardware_setup.set_channel(
            'TABOR_D_MARKER', MarkerChannel(self.awg.channel_pair_CD, 1))

        self.hardware_setup.set_measurement(
            "MEAS_A", MeasurementMask(self.dac, "MASK_A"))
        self.hardware_setup.set_measurement(
            "MEAS_B", MeasurementMask(self.dac, "MASK_B"))
        self.hardware_setup.set_measurement(
            "MEAS_C", MeasurementMask(self.dac, "MASK_C"))
        self.hardware_setup.set_measurement(
            "MEAS_D", MeasurementMask(self.dac, "MASK_D"))

    def register_program(self):
        self.hardware_setup.register_program(self.pulse_name, self.program)

    def arm_program(self):
        self.hardware_setup.arm_program(self.pulse_name)

    def read_program(self):
        self.program_AB = self.awg.channel_pair_AB.read_complete_program()
        self.program_CD = self.awg.channel_pair_CD.read_complete_program()
        return self.program_AB, self.program_CD
Beispiel #15
0
def exec_test():
    import time
    import numpy as np

    t = []
    names = []

    def tic(name):
        t.append(time.time())
        names.append(name)

    from qupulse.hardware.awgs.tabor import TaborChannelPair, TaborAWGRepresentation
    tawg = TaborAWGRepresentation(r'USB0::0x168C::0x2184::0000216488::INSTR', reset=True)

    tchannelpair = TaborChannelPair(tawg, (1, 2), 'TABOR_AB')
    tawg.paranoia_level = 2

    # warnings.simplefilter('error', Warning)

    from qupulse.hardware.setup import HardwareSetup, PlaybackChannel, MarkerChannel
    hardware_setup = HardwareSetup()

    hardware_setup.set_channel('TABOR_A', PlaybackChannel(tchannelpair, 0))
    hardware_setup.set_channel('TABOR_B', PlaybackChannel(tchannelpair, 1))
    hardware_setup.set_channel('TABOR_A_MARKER', MarkerChannel(tchannelpair, 0))
    hardware_setup.set_channel('TABOR_B_MARKER', MarkerChannel(tchannelpair, 1))

    if with_alazar:
        from qupulse.hardware.dacs.alazar import AlazarCard
        import atsaverage.server

        if not atsaverage.server.Server.default_instance.running:
            atsaverage.server.Server.default_instance.start(key=b'guest')

        import atsaverage.core

        alazar = AlazarCard(atsaverage.core.getLocalCard(1, 1))
        alazar.register_mask_for_channel('A', 0)
        alazar.config = get_alazar_config()

        alazar.register_operations('test', get_operations())

        window = get_window(atsaverage.core.getLocalCard(1, 1))

        hardware_setup.register_dac(alazar)

    repeated = get_pulse()

    from qupulse.pulses.sequencing import Sequencer

    tic('init')
    sequencer = Sequencer()
    sequencer.push(repeated,
                   parameters=dict(n=10000, tau=1920, U=0.5),
                   channel_mapping={'out': 'TABOR_A', 'trigger': 'TABOR_A_MARKER'},
                   window_mapping=dict(A='A'))
    instruction_block = sequencer.build()

    tic('sequence')

    hardware_setup.register_program('test', instruction_block)

    tic('register')

    if with_alazar:
        from atsaverage.masks import PeriodicMask
        m = PeriodicMask()
        m.identifier = 'D'
        m.begin = 0
        m.end = 1
        m.period = 1
        m.channel = 0
        alazar._registered_programs['test'].masks.append(m)

    tic('per_mask')

    hardware_setup.arm_program('test')

    tic('arm')

    for d, name in zip(np.diff(np.asarray(t)), names[1:]):
        print(name, d)

    d = 1