def setUpClass(self):
        self.station = station.Station()
        self.MC = measurement_control.MeasurementControl(
            'MC', live_plot_enabled=True, verbose=True)
        self.MC.station = self.station
        self.station.add_component(self.MC)

        self.mock_parabola = DummyParHolder('mock_parabola')
        self.station.add_component(self.mock_parabola)
    def setup_class(cls):
        cls.station = station.Station()
        cls.MC = measurement_control.MeasurementControl(
            'MC', live_plot_enabled=False, verbose=False)
        cls.MC.station = cls.station
        cls.station.add_component(cls.MC)

        cls.mock_parabola = DummyParHolder('mock_parabola')
        cls.station.add_component(cls.mock_parabola)
Beispiel #3
0
def _simulate_quantumsim(file_path, options):
    st = station.Station()
    # Connect to the qx simulator
    MC_sim = measurement_control.MeasurementControl('MC_sim',
                                                    live_plot_enabled=False,
                                                    verbose=True)

    datadir = os.path.abspath(
        os.path.join(os.path.dirname(pq.__file__), os.pardir, 'execute_data'))
    MC_sim.datadir(datadir)
    MC_sim.station = st

    st.add_component(MC_sim)
    quantumsim_sweep = swf.None_Sweep()
    quantumsim_sweep.parameter_name = 'Circuit number '
    quantumsim_sweep.unit = '#'

    qubit_parameters = {
        'Q0': {
            'T1': 30e3,
            'T2': 17e3,
            'frac1_0': 0.0189,
            'frac1_1': 0.918
        },
        'Q1': {
            'T1': 30e3,
            'T2': 17e3,
            'frac1_0': 0.068,
            'frac1_1': 0.949
        },
        'q0': {
            'T1': 30e3,
            'T2': 17e3,
            'frac1_0': 0.0189,
            'frac1_1': 0.918
        },
        'q1': {
            'T1': 30e3,
            'T2': 17e3,
            'frac1_0': 0.068,
            'frac1_1': 0.949
        }
    }

    quantumsim_det = Quantumsim_Two_QB_Hard_Detector(
        file_path, dt=(40, 280), qubit_parameters=qubit_parameters)
    sweep_points = range(len(quantumsim_det.parser.circuits))

    MC_sim.set_detector_function(quantumsim_det)
    MC_sim.set_sweep_function(quantumsim_sweep)
    MC_sim.set_sweep_points(sweep_points)
    dat = MC_sim.run("run QASM")
    print('simulation finished')
    return dat
def f_to_parallelize_new(arglist):
    # cluster wants a list as an argument.
    # Below the various list items are assigned to their own variable

    fitted_stepresponse_ty = arglist['fitted_stepresponse_ty']
    fluxlutman_args = arglist['fluxlutman_args']       # see function return_instrument_args in czf
    noise_parameters_CZ_args = arglist['noise_parameters_CZ_args']       # see function return_instrument_args in czf
    number = arglist['number']
    adaptive_pars = arglist['adaptive_pars']


    try: 
        MC = Instrument.find_instrument('MC'+'{}'.format(number))
    except KeyError:
        MC = mc.MeasurementControl('MC'+'{}'.format(number), live_plot_enabled=False)
    from qcodes import station
    station = station.Station()
    station.add_component(MC)
    MC.station =station

    
    fluxlutman = flm.AWG8_Flux_LutMan('fluxlutman'+'{}'.format(number))
    station.add_component(fluxlutman)
    noise_parameters_CZ = npCZ.NoiseParametersCZ('noise_parameters_CZ'+'{}'.format(number))
    station.add_component(noise_parameters_CZ)

    fluxlutman, noise_parameters_CZ = czf.return_instrument_from_arglist(fluxlutman,fluxlutman_args,noise_parameters_CZ,noise_parameters_CZ_args)

    d=ramsey_experiment(fluxlutman=fluxlutman, noise_parameters_CZ=noise_parameters_CZ,
                                                         fitted_stepresponse_ty=fitted_stepresponse_ty)
    MC.set_sweep_functions([fluxlutman.cz_length])
    MC.set_detector_function(d)
    MC.set_sweep_points(np.arange(0, adaptive_pars['max_time'], adaptive_pars['time_step']))

    exp_metadata = {'detuning': noise_parameters_CZ.detuning(), 
                     'sigma_q1': noise_parameters_CZ.sigma_q1(), 
                     'sigma_q0': noise_parameters_CZ.sigma_q0()}

    if noise_parameters_CZ.cluster():
        dat = MC.run('1D ramsey_new_cluster sigma_q1 {:.0f}, sigma_q0 {:.0f}, detuning {:.0f}'.format(noise_parameters_CZ.sigma_q1()*1e6, noise_parameters_CZ.sigma_q0()*1e6,
                                                                            noise_parameters_CZ.detuning()/1e6), 
            mode='1D',exp_metadata=exp_metadata)
    else:
        if adaptive_pars['long_name']:
            dat = MC.run('1D ramsey_new sigma_q1 {:.0f}, sigma_q0 {:.0f}, detuning {:.0f}'.format(noise_parameters_CZ.sigma_q1()*1e6, noise_parameters_CZ.sigma_q0()*1e6,
                                                                    noise_parameters_CZ.detuning()/1e6), 
                                                                    mode='1D',exp_metadata=exp_metadata)
        else:
            dat = MC.run('1D ramsey_new', mode='1D',exp_metadata=exp_metadata)


    fluxlutman.close()
    noise_parameters_CZ.close()
    MC.close()
Beispiel #5
0
    def setUpClass(self):
        self.station = station.Station()
        self.datadir = os.path.join(pq.__path__[0], 'tests', 'test_data')
        self.MC = measurement_control.MeasurementControl(
            'MC', live_plot_enabled=False, verbose=False)
        self.MC.station = self.station
        self.MC.datadir(self.datadir)
        a_tools.datadir = self.datadir
        self.station.add_component(self.MC)

        self.mock_parabola = DummyParHolder('mock_parabola')
        self.station.add_component(self.mock_parabola)
        self.mock_parabola_2 = DummyParHolder('mock_parabola_2')
        self.station.add_component(self.mock_parabola_2)
    def setUpClass(self):
        self.station = station.Station()
        self.CCL_qubit = ct.Mock_CCLight_Transmon('CCL_qubit')

        self.fluxcurrent = flx.virtual_SPI_S4g_FluxCurrent('fluxcurrent',
                                                           channel_map={
                                                               'FBL_Q1':
                                                               (0, 0),
                                                               'FBL_Q2':
                                                               (0, 1),
                                                           })
        self.fluxcurrent.FBL_Q1(0)
        self.fluxcurrent.FBL_Q2(0)
        self.station.add_component(self.fluxcurrent)

        self.MW1 = vmw.VirtualMWsource('MW1')
        self.MW2 = vmw.VirtualMWsource('MW2')
        self.MW3 = vmw.VirtualMWsource('MW3')
        self.SH = sh.virtual_SignalHound_USB_SA124B('SH')
        self.UHFQC = dummy_UHFQC('UHFQC')

        self.CCL = dummy_CCL('CCL')
        # self.VSM = Dummy_Duplexer('VSM')
        self.VSM = Dummy_QuTechVSMModule('VSM')

        self.MC = measurement_control.MeasurementControl(
            'MC', live_plot_enabled=False, verbose=False)
        self.MC.station = self.station
        self.station.add_component(self.MC)

        # Required to set it to the testing datadir
        test_datadir = os.path.join(pq.__path__[0], 'tests', 'test_output')
        self.MC.datadir(test_datadir)
        a_tools.datadir = self.MC.datadir()

        self.AWG = v8.VirtualAWG8('DummyAWG8')
        self.AWG8_VSM_MW_LutMan = mwl.AWG8_VSM_MW_LutMan('MW_LutMan_VSM')
        self.AWG8_VSM_MW_LutMan.AWG(self.AWG.name)
        self.AWG8_VSM_MW_LutMan.channel_GI(1)
        self.AWG8_VSM_MW_LutMan.channel_GQ(2)
        self.AWG8_VSM_MW_LutMan.channel_DI(3)
        self.AWG8_VSM_MW_LutMan.channel_DQ(4)
        self.AWG8_VSM_MW_LutMan.mw_modulation(100e6)
        self.AWG8_VSM_MW_LutMan.sampling_rate(2.4e9)

        self.ro_lutman = UHFQC_RO_LutMan('RO_lutman',
                                         num_res=5,
                                         feedline_number=0)
        self.ro_lutman.AWG(self.UHFQC.name)

        # Assign instruments
        self.CCL_qubit.instr_LutMan_MW(self.AWG8_VSM_MW_LutMan.name)
        self.CCL_qubit.instr_LO_ro(self.MW1.name)
        self.CCL_qubit.instr_LO_mw(self.MW2.name)
        self.CCL_qubit.instr_spec_source(self.MW3.name)

        self.CCL_qubit.instr_acquisition(self.UHFQC.name)
        self.CCL_qubit.instr_VSM(self.VSM.name)
        self.CCL_qubit.instr_CC(self.CCL.name)
        self.CCL_qubit.instr_LutMan_RO(self.ro_lutman.name)
        self.CCL_qubit.instr_MC(self.MC.name)
        self.CCL_qubit.instr_FluxCtrl(self.fluxcurrent.name)
        self.CCL_qubit.instr_SH(self.SH.name)

        config_fn = os.path.join(pq.__path__[0], 'tests', 'openql',
                                 'test_cfg_CCL.json')
        self.CCL_qubit.cfg_openql_platform_fn(config_fn)

        # Setting some "random" initial parameters
        self.CCL_qubit.ro_freq(5.43e9)
        self.CCL_qubit.ro_freq_mod(200e6)

        self.CCL_qubit.freq_qubit(4.56e9)
        self.CCL_qubit.freq_max(4.62e9)

        self.CCL_qubit.mw_freq_mod(-100e6)
        self.CCL_qubit.mw_awg_ch(1)
        self.CCL_qubit.cfg_qubit_nr(0)

        self.CCL_qubit.mw_vsm_delay(15)

        self.CCL_qubit.mw_mixer_offs_GI(.1)
        self.CCL_qubit.mw_mixer_offs_GQ(.2)
        self.CCL_qubit.mw_mixer_offs_DI(.3)
        self.CCL_qubit.mw_mixer_offs_DQ(.4)
        # self.CCL_qubit.ro_acq_averages(32768)
        self.device = do.DeviceCCL(name='device')
        self.CCL_qubit.instr_device(self.device.name)
Beispiel #7
0
def f_to_parallelize_new(arglist):
    # cluster wants a list as an argument.
    # Below the various list items are assigned to their own variable

    fitted_stepresponse_ty = arglist['fitted_stepresponse_ty']
    fluxlutman_args = arglist[
        'fluxlutman_args']  # see function return_instrument_args in czf
    noise_parameters_CZ_args = arglist[
        'noise_parameters_CZ_args']  # see function return_instrument_args in czf
    number = arglist['number']
    adaptive_pars = arglist['adaptive_pars']

    try:
        MC = Instrument.find_instrument('MC' + '{}'.format(number))
    except KeyError:
        MC = mc.MeasurementControl('MC' + '{}'.format(number),
                                   live_plot_enabled=False)
    from qcodes import station
    station = station.Station()
    station.add_component(MC)
    MC.station = station

    fluxlutman = flm.AWG8_Flux_LutMan('fluxlutman' + '{}'.format(number))
    station.add_component(fluxlutman)
    noise_parameters_CZ = npCZ.NoiseParametersCZ('noise_parameters_CZ' +
                                                 '{}'.format(number))
    station.add_component(noise_parameters_CZ)

    fluxlutman, noise_parameters_CZ = czf.return_instrument_from_arglist(
        fluxlutman, fluxlutman_args, noise_parameters_CZ,
        noise_parameters_CZ_args)

    d = CZ_trajectory_superoperator(
        fluxlutman=fluxlutman,
        noise_parameters_CZ=noise_parameters_CZ,
        fitted_stepresponse_ty=fitted_stepresponse_ty,
        qois=adaptive_pars.get('qois', 'all'))
    MC.set_detector_function(d)

    exp_metadata = {
        'double sided': fluxlutman.czd_double_sided(),
        'length': fluxlutman.cz_length(),
        'distortions': noise_parameters_CZ.distortions(),
        'T2_scaling': noise_parameters_CZ.T2_scaling(),
        'sigma_q1': noise_parameters_CZ.sigma_q1(),
        'sigma_q0': noise_parameters_CZ.sigma_q0()
    }

    if adaptive_pars['mode'] == 'adaptive':
        MC.set_sweep_functions([fluxlutman.cz_theta_f, fluxlutman.cz_lambda_2])
        if adaptive_pars['uniform']:
            loss_per_triangle = adaptive.learner.learner2D.uniform_loss
        else:
            loss_per_triangle = None
        MC.set_adaptive_function_parameters({
            'adaptive_function':
            adaptive.Learner2D,
            'loss_per_triangle':
            loss_per_triangle,
            'goal':
            lambda l: l.npoints > adaptive_pars['n_points'],
            'bounds':
            [(adaptive_pars['theta_f_min'], adaptive_pars['theta_f_max']),
             (adaptive_pars['lambda2_min'], adaptive_pars['lambda2_max'])]
        })

        if noise_parameters_CZ.cluster():
            dat = MC.run(
                '2D simulation_new_cluster2 double sided {} - length {:.1f} - distortions {} - waiting {:.2f} - T2_scaling {:.2f} - sigma_q1 {:.0f}, sigma_q0 {:.0f}'
                .format(fluxlutman.czd_double_sided(),
                        fluxlutman.cz_length() * 1e9,
                        noise_parameters_CZ.distortions(),
                        noise_parameters_CZ.waiting_at_sweetspot(),
                        noise_parameters_CZ.T2_scaling(),
                        noise_parameters_CZ.sigma_q1() * 1e6,
                        noise_parameters_CZ.sigma_q0() * 1e6),
                mode='adaptive',
                exp_metadata=exp_metadata)

        else:
            if adaptive_pars['long_name']:
                dat = MC.run(
                    '2D simulation_new_2 double sided {} - length {:.1f} - distortions {} - T2_scaling {:.1f} - sigma_q1 {:.0f}, sigma_q0 {:.0f}'
                    .format(fluxlutman.czd_double_sided(),
                            fluxlutman.cz_length() * 1e9,
                            noise_parameters_CZ.distortions(),
                            noise_parameters_CZ.T2_scaling(),
                            noise_parameters_CZ.sigma_q1() * 1e6,
                            noise_parameters_CZ.sigma_q0() * 1e6),
                    mode='adaptive',
                    exp_metadata=exp_metadata)
            else:
                dat = MC.run('2D simulation_new_2',
                             exp_metadata=exp_metadata,
                             mode='adaptive')

    elif adaptive_pars['mode'] == '1D':
        MC.set_sweep_functions([fluxlutman.cz_theta_f])
        MC.set_sweep_points(
            np.linspace(adaptive_pars['theta_f_min'],
                        adaptive_pars['theta_f_max'],
                        adaptive_pars['n_points']))
        if noise_parameters_CZ.cluster():
            dat = MC.run(
                '1D simulation_new_cluster2 double sided {} - length {:.1f} - distortions {} - T2_scaling {:.1f} - sigma_q1 {:.0f}, sigma_q0 {:.0f}'
                .format(fluxlutman.czd_double_sided(),
                        fluxlutman.cz_length() * 1e9,
                        noise_parameters_CZ.distortions(),
                        noise_parameters_CZ.T2_scaling(),
                        noise_parameters_CZ.sigma_q1() * 1e6,
                        noise_parameters_CZ.sigma_q0() * 1e6),
                mode='1D',
                exp_metadata=exp_metadata)

        else:
            if adaptive_pars['long_name']:
                dat = MC.run(
                    '1D simulation_new_2 double sided {} - length {:.1f} - distortions {} - T2_scaling {:.1f} - sigma_q1 {:.0f}, sigma_q0 {:.0f}'
                    .format(fluxlutman.czd_double_sided(),
                            fluxlutman.cz_length() * 1e9,
                            noise_parameters_CZ.distortions(),
                            noise_parameters_CZ.T2_scaling(),
                            noise_parameters_CZ.sigma_q1() * 1e6,
                            noise_parameters_CZ.sigma_q0() * 1e6),
                    mode='1D',
                    exp_metadata=exp_metadata)
            else:
                dat = MC.run('1D simulation_new_2',
                             exp_metadata=exp_metadata,
                             mode='1D')

    if adaptive_pars['mode'] == 'cma_optimizer':
        MC.set_sweep_functions([fluxlutman.cz_theta_f, fluxlutman.cz_lambda_2])
        if adaptive_pars['uniform']:
            loss_per_triangle = adaptive.learner.learner2D.uniform_loss
        else:
            loss_per_triangle = None
        MC.set_adaptive_function_parameters({
            'adaptive_function': cma.fmin,
            'x0': adaptive_pars['x0'],
            'sigma0': adaptive_pars['sigma0'],
            # options for the CMA algorithm can be found using
            # "cma.CMAOptions()"
            'options': {
                'maxfevals':
                adaptive_pars['n_points'],  # maximum function cals
                # Scaling for individual sigma's
                'cma_stds': [5, 6, 3],
                'ftarget': 0.005
            },  # Target function value
        })

        if noise_parameters_CZ.cluster():
            dat = MC.run(
                '2D simulation_new_cluster2 double sided {} - length {:.1f} - waiting {:.2f} - T2_scaling {:.2f} - sigma_q1 {:.0f}, sigma_q0 {:.0f}'
                .format(fluxlutman.czd_double_sided(),
                        fluxlutman.cz_length() * 1e9,
                        noise_parameters_CZ.waiting_at_sweetspot(),
                        noise_parameters_CZ.T2_scaling(),
                        noise_parameters_CZ.sigma_q1() * 1e6,
                        noise_parameters_CZ.sigma_q0() * 1e6),
                mode='adaptive',
                exp_metadata=exp_metadata)

        else:
            if adaptive_pars['long_name']:
                dat = MC.run(
                    '2D simulation_new_2 double sided {} - length {:.1f} - distortions {} - T2_scaling {:.1f} - sigma_q1 {:.0f}, sigma_q0 {:.0f}'
                    .format(fluxlutman.czd_double_sided(),
                            fluxlutman.cz_length() * 1e9,
                            noise_parameters_CZ.distortions(),
                            noise_parameters_CZ.T2_scaling(),
                            noise_parameters_CZ.sigma_q1() * 1e6,
                            noise_parameters_CZ.sigma_q0() * 1e6),
                    mode='adaptive',
                    exp_metadata=exp_metadata)
            else:
                dat = MC.run('2D simulation_new_2',
                             exp_metadata=exp_metadata,
                             mode='adaptive')

    fluxlutman.close()
    noise_parameters_CZ.close()
    MC.close()
}

try:
    MC = Instrument.find_instrument('MC')
    st = MC.station
    new_station = False
except KeyError:
    st = qc.station.Station()
    new_station = True

"""
Create the station for which the Instruments can connect to. A virtual representation
of the physical setup. In our case, the CCL. Since we're calling the station,
"""
try:
    MC_demo = measurement_control.MeasurementControl(
        'Demonstrator_MC', live_plot_enabled=True, verbose=True)

    datadir = os.path.abspath(os.path.join(
        os.path.dirname(pq.__file__), os.pardir, 'demonstrator_execute_data'))
    MC_demo.datadir(datadir)
    MC_demo.station = st

    st.add_component(MC_demo)
except KeyError:
    MC_demo = Instrument.find_instrument('Demonstrator_MC')


def execute_qumis_file(file_url: str,  config_json: str,
                      verbosity_level: int=0):
    write_to_log('QUMIS!')
    return 
    'datadir': 'D:/users/LukaBavdaz/users/petitlp/measurements/',
    'PycQEDdir': 'D:/users/LukaBavdaz/Pycqed'
}

import pycqed as pq
import numpy as np
from pycqed.measurement import measurement_control
from pycqed.measurement.sweep_functions import None_Sweep
import pycqed.measurement.detector_functions as det

import temp
#station = temp.initialize(server_name = default_server_name)
station = temp.initialize()

MC = measurement_control.MeasurementControl('MC',
                                            live_plot_enabled=True,
                                            verbose=True)
MC.station = station
#station = MC.station
station.add_component(MC)


def MC_sweep1D(gate, r, outputs, avg=1):

    sweep_gates = [getattr(station.gates, x) for x in gate]
    instrument = output_map[outputs]
    sweep_gates_range = []

    if np.size(r) == 3:
        sweep_range = np.linspace(r[0], r[1],
                                  1 + np.floor(abs(r[0] - r[1]) / r[2]))
Beispiel #10
0
    def setUpClass(self):
        """
        This sets up a mock setup using a CCL to control multiple qubits
        """
        self.station = station.Station()

        self.MW1 = vmw.VirtualMWsource('MW1')
        self.MW2 = vmw.VirtualMWsource('MW2')
        self.MW3 = vmw.VirtualMWsource('MW3')
        self.SH = sh.virtual_SignalHound_USB_SA124B('SH')
        self.UHFQC_0 = UHF.UHFQC(name='UHFQC_0',
                                 server='emulator',
                                 device='dev2109',
                                 interface='1GbE')

        self.UHFQC_1 = UHF.UHFQC(name='UHFQC_1',
                                 server='emulator',
                                 device='dev2110',
                                 interface='1GbE')

        self.UHFQC_2 = UHF.UHFQC(name='UHFQC_2',
                                 server='emulator',
                                 device='dev2111',
                                 interface='1GbE')

        self.CCL = dummy_CCL('CCL')
        self.QCC = dummy_QCC('QCC')
        self.CC = QuTechCC('CC', DummyTransport())
        self.VSM = Dummy_Duplexer('VSM')

        self.MC = measurement_control.MeasurementControl(
            'MC', live_plot_enabled=False, verbose=False)
        self.MC.station = self.station
        self.station.add_component(self.MC)

        # Required to set it to the testing datadir
        test_datadir = os.path.join(pq.__path__[0], 'tests', 'test_output')
        self.MC.datadir(test_datadir)
        a_tools.datadir = self.MC.datadir()

        self.AWG_mw_0 = HDAWG.ZI_HDAWG8(name='AWG_mw_0',
                                        server='emulator',
                                        num_codewords=32,
                                        device='dev8026',
                                        interface='1GbE')

        self.AWG_mw_1 = HDAWG.ZI_HDAWG8(name='AWG_mw_1',
                                        server='emulator',
                                        num_codewords=32,
                                        device='dev8027',
                                        interface='1GbE')
        self.AWG_flux_0 = HDAWG.ZI_HDAWG8(name='AWG_flux_0',
                                          server='emulator',
                                          num_codewords=32,
                                          device='dev8028',
                                          interface='1GbE')

        self.AWG8_VSM_MW_LutMan = mwl.AWG8_VSM_MW_LutMan('MW_LutMan_VSM')
        self.AWG8_VSM_MW_LutMan.AWG(self.AWG_mw_0.name)
        self.AWG8_VSM_MW_LutMan.channel_GI(1)
        self.AWG8_VSM_MW_LutMan.channel_GQ(2)
        self.AWG8_VSM_MW_LutMan.channel_DI(3)
        self.AWG8_VSM_MW_LutMan.channel_DQ(4)
        self.AWG8_VSM_MW_LutMan.mw_modulation(100e6)
        self.AWG8_VSM_MW_LutMan.sampling_rate(2.4e9)

        self.ro_lutman_0 = UHFQC_RO_LutMan('ro_lutman_0',
                                           feedline_number=0,
                                           feedline_map='S17',
                                           num_res=9)
        self.ro_lutman_0.AWG(self.UHFQC_0.name)

        self.ro_lutman_1 = UHFQC_RO_LutMan('ro_lutman_1',
                                           feedline_number=1,
                                           feedline_map='S17',
                                           num_res=9)
        self.ro_lutman_1.AWG(self.UHFQC_1.name)

        self.ro_lutman_2 = UHFQC_RO_LutMan('ro_lutman_2',
                                           feedline_number=2,
                                           feedline_map='S17',
                                           num_res=9)
        self.ro_lutman_2.AWG(self.UHFQC_2.name)

        # Assign instruments
        qubits = []
        for q_idx in range(17):
            q = ct.CCLight_Transmon('q{}'.format(q_idx))
            qubits.append(q)

            q.instr_LutMan_MW(self.AWG8_VSM_MW_LutMan.name)
            q.instr_LO_ro(self.MW1.name)
            q.instr_LO_mw(self.MW2.name)
            q.instr_spec_source(self.MW3.name)

            if q_idx in [13, 16]:
                q.instr_acquisition(self.UHFQC_0.name)
                q.instr_LutMan_RO(self.ro_lutman_0.name)
            elif q_idx in [1, 4, 5, 7, 8, 10, 11, 14, 15]:
                q.instr_acquisition(self.UHFQC_1.name)
                q.instr_LutMan_RO(self.ro_lutman_1.name)
            elif q_idx in [0, 2, 3, 6, 9, 12]:
                q.instr_acquisition(self.UHFQC_2.name)
                q.instr_LutMan_RO(self.ro_lutman_2.name)

            q.instr_VSM(self.VSM.name)
            q.instr_CC(self.CCL.name)
            q.instr_MC(self.MC.name)

            q.instr_SH(self.SH.name)

            config_fn = os.path.join(pq.__path__[0], 'tests',
                                     'test_cfg_CCL.json')
            q.cfg_openql_platform_fn(config_fn)

            # Setting some "random" initial parameters
            q.ro_freq(5.43e9 + q_idx * 50e6)
            q.ro_freq_mod(200e6)

            q.freq_qubit(4.56e9 + q_idx * 50e6)
            q.freq_max(4.62e9 + q_idx * 50e6)

            q.mw_freq_mod(-100e6)
            q.mw_awg_ch(1)
            q.cfg_qubit_nr(q_idx)
            # q.mw_vsm_delay(15)
            q.mw_mixer_offs_GI(.1)
            q.mw_mixer_offs_GQ(.2)
            q.mw_mixer_offs_DI(.3)
            q.mw_mixer_offs_DQ(.4)

        # Set up the device object and set required params
        self.device = do.DeviceCCL('device')
        self.device.qubits([q.name for q in qubits])
        self.device.instr_CC(self.CCL.name)
        self.device.instr_AWG_mw_0(self.AWG_mw_0.name)
        self.device.instr_AWG_mw_1(self.AWG_mw_1.name)
        self.device.instr_AWG_flux_0(self.AWG_flux_0.name)

        self.device.ro_lo_freq(6e9)
Beispiel #11
0
def f_to_parallelize_v2(arglist):
    # cluster wants a list as an argument.
    # Below the various list items are assigned to their own variable

    fitted_stepresponse_ty = arglist["fitted_stepresponse_ty"]
    fluxlutman_args = arglist[
        "fluxlutman_args"]  # see function return_instrument_args in czf_v2
    fluxlutman_static_args = arglist[
        "fluxlutman_static_args"]  # see function return_instrument_args in czf_v2
    sim_control_CZ_args = arglist[
        "sim_control_CZ_args"]  # see function return_instrument_args in czf_v2
    number = arglist["number"]
    adaptive_pars = arglist["adaptive_pars"]
    additional_pars = arglist["additional_pars"]
    live_plot_enabled = arglist["live_plot_enabled"]
    exp_metadata = arglist["exp_metadata"]
    #which_gate = arglist["which_gate"]

    try:
        MC = Instrument.find_instrument("MC" + "{}".format(number))
    except KeyError:
        MC = mc.MeasurementControl("MC" + "{}".format(number),
                                   live_plot_enabled=live_plot_enabled)
    from qcodes import station

    station = station.Station()
    station.add_component(MC)
    MC.station = station

    fluxlutman = flm.HDAWG_Flux_LutMan("fluxlutman" + "{}".format(number))
    station.add_component(fluxlutman)
    fluxlutman_static = flm.HDAWG_Flux_LutMan("fluxlutman_static" +
                                              "{}".format(number))
    station.add_component(fluxlutman_static)
    sim_control_CZ = scCZ_v2.SimControlCZ_v2("sim_control_CZ" +
                                             "{}".format(number))
    station.add_component(sim_control_CZ)

    fluxlutman = czf_v2.return_instrument_from_arglist_v2(
        fluxlutman, fluxlutman_args)
    fluxlutman_static = czf_v2.return_instrument_from_arglist_v2(
        fluxlutman_static, fluxlutman_static_args)
    sim_control_CZ = czf_v2.return_instrument_from_arglist_v2(
        sim_control_CZ, sim_control_CZ_args)

    sim_control_CZ.set_cost_func()
    which_gate = sim_control_CZ.which_gate()

    d = CZ_trajectory_superoperator(
        fluxlutman=fluxlutman,
        fluxlutman_static=fluxlutman_static,
        sim_control_CZ=sim_control_CZ,
        fitted_stepresponse_ty=fitted_stepresponse_ty,
        qois=additional_pars['qois'],
    )
    MC.set_detector_function(d)

    if exp_metadata["mode"] == "adaptive":
        MC.set_sweep_functions([
            getattr(fluxlutman, "vcz_amp_sq_{}".format(which_gate)),
            getattr(fluxlutman, "vcz_amp_fine_{}".format(which_gate)),
        ])

        MC.set_adaptive_function_parameters(adaptive_pars)

        if sim_control_CZ.cluster():
            dat = MC.run(
                additional_pars["label"] + "_cluster",
                mode="adaptive",
                exp_metadata=exp_metadata,
            )

        else:
            if additional_pars["long_name"]:
                dat = MC.run(
                    additional_pars["label"],
                    mode="adaptive",
                    exp_metadata=exp_metadata,
                )
            else:
                dat = MC.run(
                    "2D_simulations_v2",
                    mode="adaptive",
                    exp_metadata=exp_metadata,
                )

    elif exp_metadata["mode"] == "contour_scan":

        from pycqed.analysis_v2.tools import contours2d as c2d
        from pycqed.measurement import sweep_functions as swf

        timestamp = sim_control_CZ.timestamp_for_contour()
        coha_for_contour = ma2.Conditional_Oscillation_Heatmap_Analysis(
            t_start=timestamp,
            t_stop=timestamp,
            close_figs=True,
            extract_only=False,
            plt_orig_pnts=True,
            plt_contour_L1=False,
            plt_contour_phase=True,
            plt_optimal_values=True,
            plt_optimal_values_max=1,
            find_local_optimals=True,
            plt_clusters=False,
            cluster_from_interp=False,
            clims={
                "Cost func": [0., 100],
                "missing fraction": [0, 30],
                "offset difference": [0, 30]
            },
            target_cond_phase=180,
            phase_thr=15,
            L1_thr=5,
            clustering_thr=0.15,
            gen_optima_hulls=True,
            hull_L1_thr=10,
            hull_phase_thr=20,
            plt_optimal_hulls=True,
            save_cond_phase_contours=[180],
        )

        c_180 = coha_for_contour.proc_data_dict["quantities_of_interest"][
            "cond_phase_contours"]["180"]["0"]
        hull = coha_for_contour.proc_data_dict["quantities_of_interest"][
            "hull_vertices"]["0"]

        c_180_in_hull = c2d.pnts_in_hull(pnts=c_180, hull=hull)
        if c_180_in_hull[0][0] > c_180_in_hull[-1][0]:
            c_180_in_hull = np.flip(c_180_in_hull, axis=0)

        swf_2d_contour = swf.SweepAlong2DContour(
            getattr(fluxlutman, "vcz_amp_sq_{}".format(which_gate)),
            getattr(fluxlutman, "vcz_amp_fine_{}".format(which_gate)),
            c_180_in_hull)
        MC.set_sweep_function(swf_2d_contour)
        MC.set_sweep_points(np.linspace(0, 1, 40))

        if sim_control_CZ.cluster():
            dat = MC.run(
                additional_pars["label"] + "_cluster",
                mode="1D",
                exp_metadata=exp_metadata,
            )

        else:
            if additional_pars["long_name"]:
                dat = MC.run(
                    additional_pars["label"],
                    mode="1D",
                    exp_metadata=exp_metadata,
                )
            else:
                dat = MC.run(
                    "contour_scan",
                    mode="1D",
                    exp_metadata=exp_metadata,
                )

    elif exp_metadata["mode"] == "fluxbias_scan":

        MC.set_sweep_function(getattr(sim_control_CZ, "fluxbias_mean"))
        MC.set_sweep_points(np.arange(-3000e-6, 3001e-6, 50e-6))

        if sim_control_CZ.cluster():
            dat = MC.run(
                additional_pars["label"] + "_cluster",
                mode="1D",
                exp_metadata=exp_metadata,
            )

        else:
            if additional_pars["long_name"]:
                dat = MC.run(
                    additional_pars["label"],
                    mode="1D",
                    exp_metadata=exp_metadata,
                )
            else:
                dat = MC.run(
                    "contour_scan",
                    mode="1D",
                    exp_metadata=exp_metadata,
                )

    elif exp_metadata["mode"] == "fluxbias_scan_q1":

        MC.set_sweep_function(getattr(sim_control_CZ, "fluxbias_mean_q1"))
        MC.set_sweep_points(np.arange(20000e-6, 30001e-6, 10000e-6))

        if sim_control_CZ.cluster():
            dat = MC.run(
                additional_pars["label"] + "_cluster",
                mode="1D",
                exp_metadata=exp_metadata,
            )

        else:
            if additional_pars["long_name"]:
                dat = MC.run(
                    additional_pars["label"],
                    mode="1D",
                    exp_metadata=exp_metadata,
                )
            else:
                dat = MC.run(
                    "contour_scan",
                    mode="1D",
                    exp_metadata=exp_metadata,
                )

    fluxlutman.close()
    fluxlutman_static.close()
    sim_control_CZ.close()
    MC.close()
Beispiel #12
0
                 allocated_buffers=100,
                 buffer_timeout=1000
)

HS = hd.HeterodyneInstrument('HS', LO=RFLO, RF=RFLO, AWG=None,
                             acquisition_instr=ATS.name,
                             acquisition_instr_controller=ATS_controller.name,
                             server_name=None)
station.add_component(HS)

# VNA
# VNA = ZNB20.ZNB20(name='VNA', address='TCPIP0::192.168.0.55', server_name=None)  #
# station.add_component(VNA)


MC = mc.MeasurementControl('MC')

MC.station = station
station.MC = MC
station.add_component(MC)

# The AWG sequencer
station.pulsar = ps.Pulsar()
station.pulsar.AWG = station.components['AWG']
for i in range(2):
    # Note that these are default parameters and should be kept so.
    # the channel offset is set in the AWG itself. For now the amplitude is
    # hardcoded. You can set it by hand but this will make the value in the
    # sequencer different.
    station.pulsar.define_channel(id='ch{}'.format(i+1),
                                  name='ch{}'.format(i+1), type='analog',
def f_to_parallelize_new(arglist):
    # cluster wants a list as an argument.
    # Below the various list items are assigned to their own variable

    fitted_stepresponse_ty = arglist['fitted_stepresponse_ty']
    fluxlutman_args = arglist[
        'fluxlutman_args']  # see function return_instrument_args in czf
    noise_parameters_CZ_args = arglist[
        'noise_parameters_CZ_args']  # see function return_instrument_args in czf
    number = arglist['number']
    adaptive_pars = arglist['adaptive_pars']

    try:
        MC = Instrument.find_instrument('MC' + '{}'.format(number))
    except KeyError:
        MC = mc.MeasurementControl('MC' + '{}'.format(number),
                                   live_plot_enabled=False)
    from qcodes import station
    station = station.Station()
    station.add_component(MC)
    MC.station = station

    fluxlutman = flm.AWG8_Flux_LutMan('fluxlutman' + '{}'.format(number))
    station.add_component(fluxlutman)
    noise_parameters_CZ = npCZ.NoiseParametersCZ('noise_parameters_CZ' +
                                                 '{}'.format(number))
    station.add_component(noise_parameters_CZ)

    fluxlutman, noise_parameters_CZ = czf.return_instrument_from_arglist(
        fluxlutman, fluxlutman_args, noise_parameters_CZ,
        noise_parameters_CZ_args)

    d = CZ_trajectory_superoperator(
        fluxlutman=fluxlutman,
        noise_parameters_CZ=noise_parameters_CZ,
        fitted_stepresponse_ty=fitted_stepresponse_ty,
        qois=adaptive_pars.get('qois', 'all'))
    MC.set_detector_function(d)

    exp_metadata = {
        'double sided': fluxlutman.czd_double_sided(),
        'length': fluxlutman.cz_length(),
        'distortions': noise_parameters_CZ.distortions(),
        'T2_scaling': noise_parameters_CZ.T2_scaling(),
        'sigma_q1': noise_parameters_CZ.sigma_q1(),
        'sigma_q0': noise_parameters_CZ.sigma_q0()
    }

    if adaptive_pars['mode'] == 'adaptive':
        MC.set_sweep_functions([fluxlutman.cz_theta_f, fluxlutman.cz_lambda_2])
        if adaptive_pars['uniform']:
            loss_per_triangle = adaptive.learner.learner2D.uniform_loss
        else:
            loss_per_triangle = None
        MC.set_adaptive_function_parameters({
            'adaptive_function':
            adaptive.Learner2D,
            'loss_per_triangle':
            loss_per_triangle,
            'goal':
            lambda l: l.npoints > adaptive_pars['n_points'],
            'bounds':
            [(adaptive_pars['theta_f_min'], adaptive_pars['theta_f_max']),
             (adaptive_pars['lambda2_min'], adaptive_pars['lambda2_max'])]
        })

        if noise_parameters_CZ.cluster():
            dat = MC.run(
                '2D simulation_new_cluster2 double sided {} - length {:.0f} - distortions {} - T2_scaling {:.1f} - sigma_q1 {:.0f}, sigma_q0 {:.0f}'
                .format(fluxlutman.czd_double_sided(),
                        fluxlutman.cz_length() * 1e9,
                        noise_parameters_CZ.distortions(),
                        noise_parameters_CZ.T2_scaling(),
                        noise_parameters_CZ.sigma_q1() * 1e6,
                        noise_parameters_CZ.sigma_q0() * 1e6),
                mode='adaptive',
                exp_metadata=exp_metadata)

        else:
            if adaptive_pars['long_name']:
                dat = MC.run(
                    '2D simulation_new_2 double sided {} - length {:.0f} - distortions {} - T2_scaling {:.1f} - sigma_q1 {:.0f}, sigma_q0 {:.0f}'
                    .format(fluxlutman.czd_double_sided(),
                            fluxlutman.cz_length() * 1e9,
                            noise_parameters_CZ.distortions(),
                            noise_parameters_CZ.T2_scaling(),
                            noise_parameters_CZ.sigma_q1() * 1e6,
                            noise_parameters_CZ.sigma_q0() * 1e6),
                    mode='adaptive',
                    exp_metadata=exp_metadata)
            else:
                dat = MC.run('2D simulation_new_2',
                             exp_metadata=exp_metadata,
                             mode='adaptive')

    elif adaptive_pars['mode'] == '1D':
        MC.set_sweep_functions([fluxlutman.cz_theta_f])
        MC.set_sweep_points(
            np.linspace(adaptive_pars['theta_f_min'],
                        adaptive_pars['theta_f_max'],
                        adaptive_pars['n_points']))
        if noise_parameters_CZ.cluster():
            dat = MC.run(
                '1D simulation_new_cluster2 double sided {} - length {:.0f} - distortions {} - T2_scaling {:.1f} - sigma_q1 {:.0f}, sigma_q0 {:.0f}'
                .format(fluxlutman.czd_double_sided(),
                        fluxlutman.cz_length() * 1e9,
                        noise_parameters_CZ.distortions(),
                        noise_parameters_CZ.T2_scaling(),
                        noise_parameters_CZ.sigma_q1() * 1e6,
                        noise_parameters_CZ.sigma_q0() * 1e6),
                mode='1D',
                exp_metadata=exp_metadata)

        else:
            if adaptive_pars['long_name']:
                dat = MC.run(
                    '1D simulation_new_2 double sided {} - length {:.0f} - distortions {} - T2_scaling {:.1f} - sigma_q1 {:.0f}, sigma_q0 {:.0f}'
                    .format(fluxlutman.czd_double_sided(),
                            fluxlutman.cz_length() * 1e9,
                            noise_parameters_CZ.distortions(),
                            noise_parameters_CZ.T2_scaling(),
                            noise_parameters_CZ.sigma_q1() * 1e6,
                            noise_parameters_CZ.sigma_q0() * 1e6),
                    mode='1D',
                    exp_metadata=exp_metadata)
            else:
                dat = MC.run('1D simulation_new_2',
                             exp_metadata=exp_metadata,
                             mode='1D')

    elif adaptive_pars['mode'] == 'spectral_tomo':
        MC.set_sweep_functions([noise_parameters_CZ.T1_q0])
        MC.set_sweep_points(
            np.logspace(adaptive_pars['theta_f_min'],
                        adaptive_pars['theta_f_max'],
                        adaptive_pars['n_points']))
        if noise_parameters_CZ.cluster():
            dat = MC.run(
                '1D sim_spectral_tomo double sided {} - length {:.0f} - distortions {} - T2_scaling {:.1f} - sigma_q1 {:.0f}, sigma_q0 {:.0f}'
                .format(fluxlutman.czd_double_sided(),
                        fluxlutman.cz_length() * 1e9,
                        noise_parameters_CZ.distortions(),
                        noise_parameters_CZ.T2_scaling(),
                        noise_parameters_CZ.sigma_q1() * 1e6,
                        noise_parameters_CZ.sigma_q0() * 1e6),
                mode='1D',
                exp_metadata=exp_metadata)

        else:
            if adaptive_pars['long_name']:
                dat = MC.run(
                    '1D sim_spectral_tomo double sided {} - length {:.0f} - distortions {} - T2_scaling {:.1f} - sigma_q1 {:.0f}, sigma_q0 {:.0f}'
                    .format(fluxlutman.czd_double_sided(),
                            fluxlutman.cz_length() * 1e9,
                            noise_parameters_CZ.distortions(),
                            noise_parameters_CZ.T2_scaling(),
                            noise_parameters_CZ.sigma_q1() * 1e6,
                            noise_parameters_CZ.sigma_q0() * 1e6),
                    mode='1D',
                    exp_metadata=exp_metadata)
            else:
                dat = MC.run('1D sim_spectral_tomo',
                             exp_metadata=exp_metadata,
                             mode='1D')

    elif adaptive_pars['mode'] == 'spectral_tomo_nonmarkovian':
        MC.set_sweep_functions([noise_parameters_CZ.repetitions])
        MC.set_sweep_points(np.arange(0, adaptive_pars['n_points'], 1))
        if noise_parameters_CZ.cluster():
            dat = MC.run(
                '1D sim_spectral_tomo_nonmarkovian double sided {} - length {:.0f} - distortions {} - T2_scaling {:.1f} - sigma_q1 {:.0f}, sigma_q0 {:.0f}'
                .format(fluxlutman.czd_double_sided(),
                        fluxlutman.cz_length() * 1e9,
                        noise_parameters_CZ.distortions(),
                        noise_parameters_CZ.T2_scaling(),
                        noise_parameters_CZ.sigma_q1() * 1e6,
                        noise_parameters_CZ.sigma_q0() * 1e6),
                mode='1D',
                exp_metadata=exp_metadata)

        else:
            if adaptive_pars['long_name']:
                dat = MC.run(
                    '1D sim_spectral_tomo_nonmarkovian double sided {} - length {:.0f} - distortions {} - T2_scaling {:.1f} - sigma_q1 {:.0f}, sigma_q0 {:.0f}'
                    .format(fluxlutman.czd_double_sided(),
                            fluxlutman.cz_length() * 1e9,
                            noise_parameters_CZ.distortions(),
                            noise_parameters_CZ.T2_scaling(),
                            noise_parameters_CZ.sigma_q1() * 1e6,
                            noise_parameters_CZ.sigma_q0() * 1e6),
                    mode='1D',
                    exp_metadata=exp_metadata)
            else:
                dat = MC.run('1D sim_spectral_tomo_nonmarkovian',
                             exp_metadata=exp_metadata,
                             mode='1D')

    elif adaptive_pars['mode'] == 'time_series':
        MC.set_sweep_functions(
            [noise_parameters_CZ.detuning]
        )  # random sweep function never used in this file. Put it just because I need to put one
        MC.set_sweep_points(np.array([-1]))
        if noise_parameters_CZ.cluster():
            dat = MC.run(
                '1D time_series_cluster double sided {} - length {:.0f} - sigma_q0 {:.0f}'
                .format(fluxlutman.czd_double_sided(),
                        fluxlutman.cz_length() * 1e9,
                        noise_parameters_CZ.sigma_q0() * 1e6),
                mode='1D',
                exp_metadata=exp_metadata)

        else:
            if adaptive_pars['long_name']:
                dat = MC.run(
                    '1D time_series double sided {} - length {:.0f} - sigma_q0 {:.0f}'
                    .format(fluxlutman.czd_double_sided(),
                            fluxlutman.cz_length() * 1e9,
                            noise_parameters_CZ.sigma_q0() * 1e6),
                    mode='1D',
                    exp_metadata=exp_metadata)
            else:
                dat = MC.run('1D time_series',
                             exp_metadata=exp_metadata,
                             mode='1D')

    fluxlutman.close()
    noise_parameters_CZ.close()
    MC.close()
Beispiel #14
0
    def setUpClass(self):
        """
        This sets up a mock setup using a CCL to control multiple qubits
        """
        self.station = station.Station()
        self.CCL_qubit = ct.CCLight_Transmon('CCL_qubit')

        self.MW1 = vmw.VirtualMWsource('MW1')
        self.MW2 = vmw.VirtualMWsource('MW2')
        self.MW3 = vmw.VirtualMWsource('MW3')
        self.SH = sh.virtual_SignalHound_USB_SA124B('SH')
        self.UHFQC = dummy_UHFQC('UHFQC')

        self.CCL = dummy_CCL('CCL')
        self.QCC = dummy_QCC('QCC')
        self.VSM = Dummy_Duplexer('VSM')

        self.MC = measurement_control.MeasurementControl(
            'MC', live_plot_enabled=False, verbose=False)
        self.MC.station = self.station
        self.station.add_component(self.MC)

        # Required to set it to the testing datadir
        test_datadir = os.path.join(pq.__path__[0], 'tests', 'test_output')
        self.MC.datadir(test_datadir)
        a_tools.datadir = self.MC.datadir()

        self.AWG_mw_0 = v8.VirtualAWG8('AWG_mw_0')

        self.AWG_mw_1 = v8.VirtualAWG8('AWG_mw_1')
        self.AWG_flux_0 = v8.VirtualAWG8('AWG_flux_0')

        self.AWG8_VSM_MW_LutMan = mwl.AWG8_VSM_MW_LutMan('MW_LutMan_VSM')
        self.AWG8_VSM_MW_LutMan.AWG(self.AWG_mw_0.name)
        self.AWG8_VSM_MW_LutMan.channel_GI(1)
        self.AWG8_VSM_MW_LutMan.channel_GQ(2)
        self.AWG8_VSM_MW_LutMan.channel_DI(3)
        self.AWG8_VSM_MW_LutMan.channel_DQ(4)
        self.AWG8_VSM_MW_LutMan.mw_modulation(100e6)
        self.AWG8_VSM_MW_LutMan.sampling_rate(2.4e9)

        self.ro_lutman = UHFQC_RO_LutMan('RO_lutman', num_res=5)
        self.ro_lutman.AWG(self.UHFQC.name)

        # Assign instruments
        self.CCL_qubit.instr_LutMan_MW(self.AWG8_VSM_MW_LutMan.name)
        self.CCL_qubit.instr_LO_ro(self.MW1.name)
        self.CCL_qubit.instr_LO_mw(self.MW2.name)
        self.CCL_qubit.instr_spec_source(self.MW3.name)

        self.CCL_qubit.instr_acquisition(self.UHFQC.name)
        self.CCL_qubit.instr_VSM(self.VSM.name)
        self.CCL_qubit.instr_CC(self.CCL.name)
        self.CCL_qubit.instr_LutMan_RO(self.ro_lutman.name)
        self.CCL_qubit.instr_MC(self.MC.name)

        self.CCL_qubit.instr_SH(self.SH.name)

        config_fn = os.path.join(pq.__path__[0], 'tests', 'test_cfg_CCL.json')
        self.CCL_qubit.cfg_openql_platform_fn(config_fn)

        # Setting some "random" initial parameters
        self.CCL_qubit.ro_freq(5.43e9)
        self.CCL_qubit.ro_freq_mod(200e6)

        self.CCL_qubit.freq_qubit(4.56e9)
        self.CCL_qubit.freq_max(4.62e9)

        self.CCL_qubit.mw_freq_mod(-100e6)
        self.CCL_qubit.mw_awg_ch(1)
        self.CCL_qubit.cfg_qubit_nr(0)

        self.CCL_qubit.mw_vsm_delay(15)

        self.CCL_qubit.mw_mixer_offs_GI(.1)
        self.CCL_qubit.mw_mixer_offs_GQ(.2)
        self.CCL_qubit.mw_mixer_offs_DI(.3)
        self.CCL_qubit.mw_mixer_offs_DQ(.4)

        # Set up the device object and set required params
        self.device = do.DeviceCCL('device')
        self.device.qubits([self.CCL_qubit.name])
        self.device.instr_CC(self.CCL.name)
        self.device.instr_AWG_mw_0(self.AWG_mw_0.name)
        self.device.instr_AWG_mw_1(self.AWG_mw_1.name)
        self.device.instr_AWG_flux_0(self.AWG_flux_0.name)
from pycqed.measurement import measurement_control
import os
import pycqed as pq
from qcodes.instrument.base import Instrument
import qcodes as qc

import pycqed.measurement.openql_experiments.generate_qi_cfg as gcfg_qi

from QICCLightWorker import CCLightWorker

try:
    MC_demo = measurement_control.MeasurementControl('QInfinity_MC',
                                                     live_plot_enabled=True,
                                                     verbose=True)

    datadir = os.path.abspath(
        os.path.join(os.path.dirname(pq.__file__), os.pardir,
                     'demonstrator_execute_data'))
    MC_demo.datadir(datadir)
    st = qc.station.Station()
    MC_demo.station = st
    st.add_component(MC_demo)

except KeyError:
    MC_demo = qc.Instrument.find_instrument('QInfinity_MC')

config_fn = 'D:\\GitHubRepos\\PycQED_py3\\pycqed\\measurement\\openql_experiments\\output\\cfg_CCL_QI.json'
gcfg_qi.generate_config(filename=config_fn,
                        mw_pulse_duration=20,
                        ro_duration=5000,
                        flux_pulse_duration=40,
    def setUpClass(self):
        """
        This sets up a mock setup using a CCL to control multiple qubits
        """
        self.station = station.Station()

        self.MW1 = vmw.VirtualMWsource("MW1")
        self.MW2 = vmw.VirtualMWsource("MW2")
        self.MW3 = vmw.VirtualMWsource("MW3")
        self.SH = sh.virtual_SignalHound_USB_SA124B("SH")
        self.UHFQC_0 = UHF.UHFQC(
            name="UHFQC_0", server="emulator", device="dev2109", interface="1GbE"
        )

        self.UHFQC_1 = UHF.UHFQC(
            name="UHFQC_1", server="emulator", device="dev2110", interface="1GbE"
        )

        self.UHFQC_2 = UHF.UHFQC(
            name="UHFQC_2", server="emulator", device="dev2111", interface="1GbE"
        )

        self.CCL = dummy_CCL('CCL')
        self.QCC = dummy_QCC('QCC')
        self.CC = CC('CC', DummyTransport())
        self.VSM = Dummy_QuTechVSMModule('VSM')
        self.MC = measurement_control.MeasurementControl(
            "MC", live_plot_enabled=False, verbose=False
        )
        self.MC.station = self.station
        self.station.add_component(self.MC)

        # Required to set it to the testing datadir
        test_datadir = os.path.join(pq.__path__[0], "tests", "test_output")
        self.MC.datadir(test_datadir)
        a_tools.datadir = self.MC.datadir()

        self.AWG_mw_0 = HDAWG.ZI_HDAWG8(
            name="AWG_mw_0",
            server="emulator",
            num_codewords=32,
            device="dev8026",
            interface="1GbE",
        )

        self.AWG_mw_1 = HDAWG.ZI_HDAWG8(
            name="AWG_mw_1",
            server="emulator",
            num_codewords=32,
            device="dev8027",
            interface="1GbE",
        )
        self.AWG_flux_0 = HDAWG.ZI_HDAWG8(
            name="AWG_flux_0",
            server="emulator",
            num_codewords=32,
            device="dev8028",
            interface="1GbE",
        )

        if 0: # FIXME: PR #658: test broken by commit bd19f56
            self.mw_lutman = mwl.AWG8_VSM_MW_LutMan("MW_LutMan_VSM")
            self.mw_lutman.AWG(self.AWG_mw_0.name)
            self.mw_lutman.channel_GI(1)
            self.mw_lutman.channel_GQ(2)
            self.mw_lutman.channel_DI(3)
            self.mw_lutman.channel_DQ(4)
        else: # FIXME: workaround
            self.mw_lutman = mwl.AWG8_MW_LutMan("MW_LutMan")
            self.mw_lutman.channel_I(1)
            self.mw_lutman.channel_Q(2)

        self.mw_lutman.mw_modulation(100e6)
        self.mw_lutman.sampling_rate(2.4e9)

        self.ro_lutman_0 = UHFQC_RO_LutMan(
            "ro_lutman_0", feedline_number=0, feedline_map="S17", num_res=9
        )
        self.ro_lutman_0.AWG(self.UHFQC_0.name)

        self.ro_lutman_1 = UHFQC_RO_LutMan(
            "ro_lutman_1", feedline_number=1, feedline_map="S17", num_res=9
        )
        self.ro_lutman_1.AWG(self.UHFQC_1.name)

        self.ro_lutman_2 = UHFQC_RO_LutMan(
            "ro_lutman_2", feedline_number=2, feedline_map="S17", num_res=9
        )
        self.ro_lutman_2.AWG(self.UHFQC_2.name)

        # Assign instruments
        qubits = []
        for q_idx in range(17):
            q = ct.CCLight_Transmon("q{}".format(q_idx))
            qubits.append(q)

            q.instr_LutMan_MW(self.mw_lutman.name)
            q.instr_LO_ro(self.MW1.name)
            q.instr_LO_mw(self.MW2.name)
            q.instr_spec_source(self.MW3.name)

            if q_idx in [13, 16]:
                q.instr_acquisition(self.UHFQC_0.name)
                q.instr_LutMan_RO(self.ro_lutman_0.name)
            elif q_idx in [1, 4, 5, 7, 8, 10, 11, 14, 15]:
                q.instr_acquisition(self.UHFQC_1.name)
                q.instr_LutMan_RO(self.ro_lutman_1.name)
            elif q_idx in [0, 2, 3, 6, 9, 12]:
                q.instr_acquisition(self.UHFQC_2.name)
                q.instr_LutMan_RO(self.ro_lutman_2.name)

            q.instr_VSM(self.VSM.name)
            q.instr_CC(self.CCL.name)
            q.instr_MC(self.MC.name)

            q.instr_SH(self.SH.name)

            config_fn = os.path.join(pq.__path__[0], "tests", "test_cfg_CCL.json")
            q.cfg_openql_platform_fn(config_fn)

            # Setting some "random" initial parameters
            q.ro_freq(5.43e9 + q_idx * 50e6)
            q.ro_freq_mod(200e6)

            q.freq_qubit(4.56e9 + q_idx * 50e6)
            q.freq_max(4.62e9 + q_idx * 50e6)

            q.mw_freq_mod(-100e6)
            q.mw_awg_ch(1)
            q.cfg_qubit_nr(q_idx)
            # q.mw_vsm_delay(15)
            q.mw_mixer_offs_GI(0.1)
            q.mw_mixer_offs_GQ(0.2)
            q.mw_mixer_offs_DI(0.3)
            q.mw_mixer_offs_DQ(0.4)

        # Set up the device object and set required params
        self.device = do.DeviceCCL("device")
        self.device.qubits([q.name for q in qubits])
        self.device.instr_CC(self.CCL.name)

        self.device.instr_AWG_mw_0(self.AWG_mw_0.name)
        self.device.instr_AWG_mw_1(self.AWG_mw_1.name)
        self.device.instr_AWG_flux_0(self.AWG_flux_0.name)

        self.device.ro_lo_freq(6e9)

        # Fixed by design
        self.dio_map_CCL = {"ro_0": 1, "ro_1": 2, "flux_0": 3, "mw_0": 4, "mw_1": 5}
        # Fixed by design
        self.dio_map_QCC = {
            "ro_0": 1,
            "ro_1": 2,
            "ro_2": 3,
            "mw_0": 4,
            "mw_1": 5,
            "flux_0": 6,
            "flux_1": 7,
            "flux_2": 8,
            "mw_2": 9,
            "mw_3": 10,
            "mw_4": 11,
        }
        # Modular, arbitrary example here
        self.dio_map_CC = {
            "ro_0": 0,
            "ro_1": 1,
            "ro_2": 2,
            "mw_0": 3,
            "mw_1": 4,
            "flux_0": 6,
            "flux_1": 7,
            "flux_2": 8,
        }

        self.device.dio_map(self.dio_map_CCL)
Beispiel #17
0
    def setUpClass(self):
        self.station = station.Station()
        self.CCL_qubit = ct.CCLight_Transmon('CCL_qubit')

        self.MW1 = vmw.VirtualMWsource('MW1')
        self.MW2 = vmw.VirtualMWsource('MW2')
        self.MW3 = vmw.VirtualMWsource('MW3')
        self.SH = sh.virtual_SignalHound_USB_SA124B('SH')
        self.UHFQC = UHF.UHFQC(name='UHFQC',
                               server='emulator',
                               device='dev2109',
                               interface='1GbE')

        self.CCL = dummy_CCL('CCL')
        # self.VSM = Dummy_Duplexer('VSM')
        self.VSM = Dummy_QuTechVSMModule('VSM')

        self.MC = measurement_control.MeasurementControl(
            'MC', live_plot_enabled=False, verbose=False)
        self.MC.station = self.station
        self.station.add_component(self.MC)

        # Required to set it to the testing datadir
        test_datadir = os.path.join(pq.__path__[0], 'tests', 'test_output')
        self.MC.datadir(test_datadir)
        a_tools.datadir = self.MC.datadir()

        self.AWG = HDAWG.ZI_HDAWG8(name='DummyAWG8',
                                   server='emulator',
                                   num_codewords=32,
                                   device='dev8026',
                                   interface='1GbE')
        self.AWG8_VSM_MW_LutMan = mwl.AWG8_VSM_MW_LutMan('MW_LutMan_VSM')
        self.AWG8_VSM_MW_LutMan.AWG(self.AWG.name)
        self.AWG8_VSM_MW_LutMan.channel_GI(1)
        self.AWG8_VSM_MW_LutMan.channel_GQ(2)
        self.AWG8_VSM_MW_LutMan.channel_DI(3)
        self.AWG8_VSM_MW_LutMan.channel_DQ(4)
        self.AWG8_VSM_MW_LutMan.mw_modulation(100e6)
        self.AWG8_VSM_MW_LutMan.sampling_rate(2.4e9)

        self.ro_lutman = UHFQC_RO_LutMan('RO_lutman',
                                         num_res=5,
                                         feedline_number=0)
        self.ro_lutman.AWG(self.UHFQC.name)

        # Assign instruments
        self.CCL_qubit.instr_LutMan_MW(self.AWG8_VSM_MW_LutMan.name)
        self.CCL_qubit.instr_LO_ro(self.MW1.name)
        self.CCL_qubit.instr_LO_mw(self.MW2.name)
        self.CCL_qubit.instr_spec_source(self.MW3.name)

        self.CCL_qubit.instr_acquisition(self.UHFQC.name)
        self.CCL_qubit.instr_VSM(self.VSM.name)
        self.CCL_qubit.instr_CC(self.CCL.name)
        self.CCL_qubit.instr_LutMan_RO(self.ro_lutman.name)
        self.CCL_qubit.instr_MC(self.MC.name)

        self.CCL_qubit.instr_SH(self.SH.name)

        config_fn = os.path.join(pq.__path__[0], 'tests', 'openql',
                                 'test_cfg_CCL.json')
        self.CCL_qubit.cfg_openql_platform_fn(config_fn)

        # Setting some "random" initial parameters
        self.CCL_qubit.ro_freq(5.43e9)
        self.CCL_qubit.ro_freq_mod(200e6)

        self.CCL_qubit.freq_qubit(4.56e9)
        self.CCL_qubit.freq_max(4.62e9)

        self.CCL_qubit.mw_freq_mod(-100e6)
        self.CCL_qubit.mw_awg_ch(1)
        self.CCL_qubit.cfg_qubit_nr(0)

        self.CCL_qubit.mw_vsm_delay(15)

        self.CCL_qubit.mw_mixer_offs_GI(.1)
        self.CCL_qubit.mw_mixer_offs_GQ(.2)
        self.CCL_qubit.mw_mixer_offs_DI(.3)
        self.CCL_qubit.mw_mixer_offs_DQ(.4)
def f_to_parallelize_v2(arglist):
    # cluster wants a list as an argument.
    # Below the various list items are assigned to their own variable

    fitted_stepresponse_ty = arglist["fitted_stepresponse_ty"]
    fluxlutman_args = arglist[
        "fluxlutman_args"]  # see function return_instrument_args in czf_v2
    fluxlutman_static_args = arglist[
        "fluxlutman_static_args"]  # see function return_instrument_args in czf_v2
    sim_control_CZ_args = arglist[
        "sim_control_CZ_args"]  # see function return_instrument_args in czf_v2
    number = arglist["number"]
    additional_pars = arglist["additional_pars"]
    live_plot_enabled = arglist["live_plot_enabled"]
    exp_metadata = arglist["exp_metadata"]
    #which_gate = arglist["which_gate"]

    try:
        MC = Instrument.find_instrument("MC" + "{}".format(number))
    except KeyError:
        MC = mc.MeasurementControl("MC" + "{}".format(number),
                                   live_plot_enabled=live_plot_enabled)
    from qcodes import station

    station = station.Station()
    station.add_component(MC)
    MC.station = station

    fluxlutman = flm.HDAWG_Flux_LutMan("fluxlutman" + "{}".format(number))
    station.add_component(fluxlutman)
    fluxlutman_static = flm.HDAWG_Flux_LutMan("fluxlutman_static" +
                                              "{}".format(number))
    station.add_component(fluxlutman_static)
    sim_control_CZ = scCZ_v2.SimControlCZ_v2("sim_control_CZ" +
                                             "{}".format(number))
    station.add_component(sim_control_CZ)

    fluxlutman = czf_v2.return_instrument_from_arglist_v2(
        fluxlutman, fluxlutman_args)
    fluxlutman_static = czf_v2.return_instrument_from_arglist_v2(
        fluxlutman_static, fluxlutman_static_args)
    sim_control_CZ = czf_v2.return_instrument_from_arglist_v2(
        sim_control_CZ, sim_control_CZ_args)

    sim_control_CZ.set_cost_func()
    which_gate = sim_control_CZ.which_gate()

    d = Ramsey_experiment(
        fluxlutman=fluxlutman,
        fluxlutman_static=fluxlutman_static,
        sim_control_CZ=sim_control_CZ,
        fitted_stepresponse_ty=fitted_stepresponse_ty,
        qois="all",
    )
    MC.set_detector_function(d)

    if additional_pars["mode"] == "1D_ramsey":
        MC.set_sweep_functions([sim_control_CZ.scanning_time])
        MC.set_sweep_points(
            np.arange(0, additional_pars['max_time'],
                      additional_pars['time_step']))
        if sim_control_CZ.cluster():
            dat = MC.run(
                "1D ramsey_v2_cluster double sided {} - sigma_q0 {:.0f} - detuning {:.0f}"
                .format(sim_control_CZ.get("czd_double_sided"),
                        sim_control_CZ.sigma_q0() * 1e6,
                        sim_control_CZ.detuning() / 1e6),
                mode="1D",
                exp_metadata=exp_metadata,
            )

        else:
            if additional_pars["long_name"]:
                dat = MC.run(
                    "1D ramsey_v2 double sided {} - sigma_q0 {:.0f} - detuning {:.0f}"
                    .format(sim_control_CZ.get("czd_double_sided"),
                            sim_control_CZ.sigma_q0() * 1e6,
                            sim_control_CZ.detuning() / 1e6),
                    mode="1D",
                    exp_metadata=exp_metadata,
                )
            else:
                dat = MC.run("1D ramsey_v2",
                             exp_metadata=exp_metadata,
                             mode="1D")

    fluxlutman.close()
    fluxlutman_static.close()
    sim_control_CZ.close()
    MC.close()