Ejemplo n.º 1
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)
Ejemplo n.º 2
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()