def CROT_cali_meas(pair, target, ancilla, old_freq, time, flip):

	s = six_dot_sample(qc.Station.default.pulse)
	var_mgr = variable_mgr()

	pair = str(int(pair))
	s.init(pair[0], pair[1])

	s.wait(100).add(s.manip)
	s.pre_pulse.add(s.manip)
	s.wait(100).add(s.manip)

	gate_set = getattr(s, f'q{pair}')
	target_gate_set = getattr(s, f'q{pair[target-1]}')
	ancilla_gate_set = getattr(s, f'q{pair[ancilla-1]}')

	if flip:
		ancilla_gate_set.X180.add(s.manip)
		# target_gate_set.X180.add(s.manip)

	scan_range = single_qubit_gate_spec(f'qubit{target}_MW', 
                                    linspace(old_freq*1e9-10e6, old_freq*1e9+10e6, 100, axis= 0, name='freq', unit='Hz'),
                                    time, getattr(var_mgr, f'q{pair[target-1]}_MW_power'), padding=2)

	gate_to_test = getattr(gate_set, f'CROT{target}{ancilla}')

	gate_to_test.add(s.manip, gate_spec = scan_range)
	s.wait(100).add(s.manip)
	s.read(pair[target-1])
	sequence, minstr, name = run_qubit_exp(f'crot-z_crot_cal_q{pair}_target{pair[target-1]}', s.segments(), s.measurement_manager)

	return sequence, minstr, name
Beispiel #2
0
def phase_calib(target, ancillary, gate, undo_gate=None, plot=False):
    '''
	calibrates a single qubit phase for a target qubit

	Args:
		target (int) : qubit number to target (1-6)
		ancillary (list) : qubit that need to be initialized to make this work
		gate (str) : name of the gate to call (e.g, q2.X or q12.cphase )
		undo_gate (str) : name of the gate that cancels the previous gate
	'''
    s = six_dot_sample(qc.Station.default.pulse)

    s.init(target, *ancillary)

    s.wait(100).add(s.manip)
    s.pre_pulse.add(s.manip)
    s.wait(100).add(s.manip)

    gate_set = getattr(s, f'q{target}')
    phase_offset_charac(s.manip, gate_set, get_target(s, gate))

    s.wait(100).add(s.manip)
    if undo_gate is not None:
        get_target(s, undo_gate).add(s.manip)
    s.wait(100).add(s.manip)

    s.read(target)

    sequence, minstr, name = run_qubit_exp(
        f'phase_cal_q{target}, target gate : {gate}', s.segments(),
        s.measurement_manager)
    ds = scan_generic(sequence, minstr, name=name).run()

    input_phases = ds(f'read{target}').x()
    amplitude = ds(f'read{target}').y()

    # get rid of the first part due to heating
    input_phases = input_phases[20:]
    amplitude = amplitude[20:]

    phase, std_error = fit_phase(input_phases, amplitude, plot=plot)

    var_mgr = variable_mgr()

    if not hasattr(var_mgr, f'PHASE_q{target}_{gate.replace(".", "_")}'):
        var_mgr.add_variable(f'Qubit {target}',
                             f'PHASE_q{target}_{gate.replace(".", "_")}',
                             'rad', 0.1, 0)

    old_phase = getattr(var_mgr, f'PHASE_q{target}_{gate.replace(".", "_")}')
    setattr(var_mgr, f'PHASE_q{target}_{gate.replace(".", "_")}',
            round(phase, 3))

    print(
        f'calibrated phase for qubit {target}, ' +
        f'for gate {gate}. \n Old phase : {round(old_phase,2)} \n New Phase : {round(phase,2)} [{round(std_error[0],2)} : {round(std_error[1],2)}]\n'
    )

    return phase
def cphase_ZZ_calib(target, even=False, plot=False):
	'''
	Args:
		qubit_pair (str) : pair of qubits to calibrate cphase for.
	'''
	s = six_dot_sample(qc.Station.default.pulse)

	target = str(int(target))
	s.init(target[0], target[1])

	s.wait(100).add(s.manip)
	s.pre_pulse.add(s.manip)
	s.wait(100).add(s.manip)

	sweep = lp.linspace(-0.2*np.pi,4*np.pi, 100, 'angle', 'rad', 0)/2

	getattr(s,f'q{target[0]}').X90.add(s.manip)
	getattr(s,f'q{target}').cphase.add(s.manip, cphase_angle=sweep, padding = 30, phase_corrections={})
	getattr(s,f'q{target[0]}').X180.add(s.manip)
	getattr(s,f'q{target[1]}').X180.add(s.manip)
	getattr(s,f'q{target}').cphase.add(s.manip, cphase_angle=sweep, padding = 30, phase_corrections={})
	getattr(s,f'q{target[0]}').X90.add(s.manip)

	s.wait(100).add(s.manip)

	s.read(target[0], target[1])

	sequence, minstr, name = run_qubit_exp(f'cphase cal :: {target}', s.segments(), s.measurement_manager)
	ds = scan_generic(sequence, minstr, name=name).run()


	target_ds = target[0]
	input_phases = ds(f'read{target_ds}').x()
	amplitude = ds(f'read{target_ds}').y()

	# get rid of the first part due to heating
	input_phases = input_phases[10:]
	amplitude = amplitude[10:]

	phase, std_error = fit_phase(input_phases, amplitude, plot=plot)

	if even == True:
		cphase_angle = (3*np.pi - phase)/2
	else:
		cphase_angle = (2*np.pi + phase)/2

	var_mgr = variable_mgr()
	setattr(var_mgr, f'J_pi_{target}', cphase_angle)
	
	if not hasattr(var_mgr,f'J_pi_{target}'):
		var_mgr.add_variable(f'cphase{target}',f'J_pi_{target}','rad',0.1,0)

	old_phase = getattr(var_mgr,f'J_pi_{target}')
	setattr(var_mgr,f'J_pi_{target}', round(phase,3))
def calib_J_V_off(target, plot=False):
	'''
	calibrates a single qubit phase for a target qubit

	Args:
		target (int) : qubit pair to target
	'''
	var_mgr = variable_mgr()
	s = six_dot_sample(qc.Station.default.pulse)

	target = str(int(target))
	s.init(target[0], target[1])

	s.wait(100).add(s.manip)
	s.pre_pulse.add(s.manip)
	s.wait(100).add(s.manip)

	gates = globals()[f'J{target}'].gates
	voltages =globals()[f'J{target}'].voltages_gates
	gate_time = lp.linspace(0,getattr(var_mgr, f'time_{target}')*8, 100, axis=0, name='time', unit='ns')
	
	getattr(s,f'q{target[0]}').X90.add(s.manip)
	cphase_basic(s.manip, gates, tuple([0]*len(gates)), voltages, t_gate= gate_time/2, t_ramp=100)
	getattr(s,f'q{target[0]}').X180.add(s.manip)
	getattr(s,f'q{target[1]}').X180.add(s.manip)
	cphase_basic(s.manip, gates, tuple([0]*len(gates)), voltages, t_gate= gate_time/2, t_ramp=100)
	getattr(s,f'q{target[0]}').X90.add(s.manip)

	s.wait(100).add(s.manip)

	s.read(target[0], target[1])

	sequence, minstr, name = run_qubit_exp(f'J_V_off cal :: {target}', s.segments(), s.measurement_manager)
	ds = scan_generic(sequence, minstr, name=name).run()

	time = ds(f'read{target[0]}').x()*1e-9
	probabilities = ds(f'read{target[0]}').y()
	time = time[5:]
	probabilities = probabilities[5:]
	Pi_time = fit_ramsey(time, probabilities, plot=plot)
	J_max = 1/(Pi_time*2)*1e9
	
	J_max_voltage = J_to_voltage(J_max, 0, globals()[f'J{target}'].J_max, globals()[f'J{target}'].alpha)
	J_off = J_max_voltage - 1

	if not hasattr(var_mgr,f'J_V_off{target}'):
		var_mgr.add_variable(f'cphase{target}',f'J_V_off{target}', 'mV',0.1,0)

	old_phase = getattr(var_mgr,f'J_V_off{target}')
	setattr(var_mgr,f'J_V_off{target}', round(J_off,3))

	return J_off
def cphase_ZI_IZ_cal(pair, target, even=True, plot=False):
	'''
	calibrate single qubit phases.

	args:
		pair   : pair of qubit to calibrate
		target : qubit to target with the cnot
		even   : if initial state is even Flase, else True
	'''

	s = six_dot_sample(qc.Station.default.pulse)

	pair = str(int(pair))
	s.init(pair[0], pair[1])

	s.wait(100).add(s.manip)
	s.pre_pulse.add(s.manip)
	s.wait(100).add(s.manip)

	getattr(s, f'q{target}').X90.add(s.manip)
	getattr(s, f'q{pair}').cphase.add(s.manip, padding = 30, phase_corrections={})
	getattr(s, f'q{target}').X90.add(s.manip, phase = lp.linspace(-1,4*np.pi, 80, 'angle', 'rad', 0))

	s.wait(100).add(s.manip)

	s.read(pair[0], pair[1])

	sequence, minstr, name = run_qubit_exp(f'cphase single qubit phase cal :: q{target}', s.segments(), s.measurement_manager)
	ds = scan_generic(sequence, minstr, name=name).run()

	input_phases = ds(f'read{target}').x()
	amplitude = ds(f'read{target}').y()

	# get rid of the first part due to heating
	input_phases = input_phases[10:]
	amplitude = amplitude[10:]

	phase, std_error = fit_phase(input_phases, amplitude, plot=plot)

	phase = -phase
	if even == True:
		phase += np.pi

	var_mgr = variable_mgr()

	if not hasattr(var_mgr, f'PHASE_q{target}_q{pair}_cphase'):
		var_mgr.add_variable(f'cphase{pair}',f'PHASE_q{target}_q{pair}_cphase','rad',0.1,0)

	old_phase = getattr(var_mgr, f'PHASE_q{target}_q{pair}_cphase')
	setattr(var_mgr, f'PHASE_q{target}_q{pair}_cphase', round(phase,3))

	print('setting ' + f'PHASE_q{target}_q{pair}_cphase to {phase}')
def res_calib(target, plot=False):
    '''
	calibrates a single qubit phase for a target qubit

	Args:
		target (int) : qubit number to target (1-6)
		ancillary (list) : qubit that need to be initialized to make this work
	'''
    s = six_dot_sample(qc.Station.default.pulse)
    var_mgr = variable_mgr()

    s.init(target)

    s.wait(100).add(s.manip)
    s.pre_pulse.add(s.manip)
    s.wait(100).add(s.manip)

    gate_set = getattr(s, f'q{target}')
    old_freq = getattr(var_mgr, f'frequency_q{target}')
    gate_set.X180.add(s.manip,
                      f_qubit=linspace(old_freq * 1e9 - 10e6,
                                       old_freq * 1e9 + 10e6,
                                       100,
                                       axis=0,
                                       name='freq',
                                       unit='Hz'))
    s.wait(100).add(s.manip)
    s.read(target)

    sequence, minstr, name = run_qubit_exp(f'frequency_cal_q{target}',
                                           s.segments(), s.measurement_manager)
    ds = scan_generic(sequence, minstr, name=name).run()

    frequency = ds(f'read{target}').x()
    probabilities = ds(f'read{target}').y()
    resonance = fit_resonance(frequency, probabilities, plot=plot)
    var_mgr = variable_mgr()

    old_res = getattr(var_mgr, f'frequency_q{target}')
    setattr(var_mgr, f'frequency_q{target}', round(resonance * 1e-9, 6))

    print(
        f'calibrated resonance for qubit {target}, ' +
        f'Old resonance : {round(old_res,6)} \n New resonance : {round(resonance*1e-9,6)} \n'
    )
def _allXY_(qubit, plot=False):
	s = six_dot_sample(qc.Station.default.pulse)

	s.init(qubit)

	s.wait(500).add(s.manip)
	s.pre_pulse.add(s.manip)

	s.wait(1000).add(s.manip)
	generate_all_XY(s.manip, getattr(s, f'q{qubit}'), repeat=NREP)
	s.wait(1000).add(s.manip)

	s.read(qubit)

	sequence, minstr, name = run_qubit_exp(f'allXY qubit {qubit}', s.segments(), s.measurement_manager)
	ds = scan_generic(sequence, minstr, name=name).run()
	amplitude = np.average(np.reshape(ds(f'read{qubit}').y(), (NREP,21)), axis=0)

	var_mgr = variable_mgr()
	pulse_length_increment, off_resonance_error = fit_allXY(amplitude, getattr(var_mgr, f'pi_q{qubit}_m3dbm')*1e-9, plot=plot)
	return pulse_length_increment, off_resonance_error
Beispiel #8
0
def Pi_calib(target, plot=False):
	'''
	calibrates a single qubit phase for a target qubit

	Args:
		target (int) : qubit number to target (1-6)
		ancillary (list) : qubit that need to be initialized to make this work
	'''
	s = six_dot_sample(qc.Station.default.pulse)
	var_mgr = variable_mgr()

	s.init(target)

	s.wait(100).add(s.manip)
	s.pre_pulse.add(s.manip)
	s.wait(100).add(s.manip)

	gate_set = getattr(s, f'q{target}')
	old_pi = getattr(var_mgr, f'pi_q{target}_m3dbm')
	gate_set.X90.add(s.manip, t_pulse = linspace(0,old_pi*4, 60, 'time', 'ns', 0))
	s.wait(100).add(s.manip)
	s.read(target)

	sequence, minstr, name = run_qubit_exp(f'Pi_cal_q{target}', s.segments(), s.measurement_manager)
	ds = scan_generic(sequence, minstr, name=name).run()

	time = ds(f'read{target}').x()*1e-9
	probabilities = ds(f'read{target}').y()
	time = time[5:]
	probabilities = probabilities[5:]
	Pi_time = fit_ramsey(time, probabilities, plot=plot)
	var_mgr = variable_mgr()

	old_Pi = getattr(var_mgr, f'pi_q{target}_m3dbm')
	setattr(var_mgr, f'pi_q{target}_m3dbm', round(Pi_time,6))

	print(f'calibrated resonance for qubit {target}, '+
		f'Old resonance : {round(old_Pi,6)} \n New resonance : {round(Pi_time,6)} \n')
def PSB56_calibration(station, plot=False, verbose=False):
    gates, _311113, ST_anti_12, ST_anti_12_tc_high, ST_anti_56, vSD1_threshold, vSD2_threshold = variables(
    )
    var_mgr = variable_mgr()
    anticrossing = ST_anti_56

    s = six_dot_sample(qc.Station.default.pulse)
    s.init56.add(sweep_range=1)
    s.manip.qubit6_MW.add_chirp(0, 50e3, var_mgr.frequency_q6 * 1e9 - 5e6,
                                var_mgr.frequency_q6 * 1e9 + 5e6, 300)
    s.read56.add(sweep_range=1)
    s.measurement_manager.n_rep = 500
    sequence, minstr, name = run_qubit_exp(f'PSB56_calibration', s.segments(),
                                           s.measurement_manager)

    station.MW_source.on()
    ds_on = scan_generic(sequence, minstr, name=name).run()
    station.MW_source.off()
    ds_off = scan_generic(sequence, minstr, name=name).run()

    x = ds_on('read56').x()
    y = ds_on('read56').y()
    contrast = ds_on('read56')() - ds_off('read56')()

    contrast = sp.ndimage.filters.gaussian_filter(contrast, [2, 2],
                                                  mode='constant')
    if plot:
        plt.imshow(contrast)

    var_mgr.PSB_56_P5 = round(x[np.where(contrast == contrast.max())[0][0]], 2)
    var_mgr.PSB_56_P6 = round(y[np.where(contrast == contrast.max())[1][0]], 2)
    print(
        f"Selected point\n\tvP5 :: {var_mgr.PSB_56_P5}\n\tvP6 :: {var_mgr.PSB_56_P6}"
    )

    station.MW_source.on()
    return None
def calib_symm_point(target, even=False, plot=False):
    '''
	Args:
		qubit_pair (str) : pair of qubits to calibrate cphase for.
	'''
    s = six_dot_sample(qc.Station.default.pulse)
    var_mgr = variable_mgr()
    J_off_volt = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)

    time = getattr(var_mgr, f'time_{target}')
    target = str(int(target))
    s.init(target[0], target[1])
    gates = globals()[f'J{target}'].gates
    voltages_gates = globals()[f'J{target}'].voltages_gates
    voltages_gates = list(voltages_gates)
    sweep_gate = lp.linspace(-6,
                             6,
                             51,
                             axis=0,
                             name=f'vP{target[0]}',
                             unit='mV')
    step_gate = lp.linspace(-6,
                            6,
                            51,
                            axis=1,
                            name=f'vP{target[1]}',
                            unit='mV')
    voltages_gates[2 * (int(target[0]) - 1) + 1] = sweep_gate
    voltages_gates[2 * (int(target[1]) - 1) + 1] = step_gate
    voltages_gates = tuple(voltages_gates)
    cphase = two_qubit_gate_generic(
        cphase_basic, {
            'gates': gates,
            'v_exchange_pulse_off': J_off_volt,
            'v_exchange_pulse_on': voltages_gates,
            't_gate': time,
            't_ramp': 20
        }, {})

    s.wait(100).add(s.manip)
    s.pre_pulse.add(s.manip)
    s.wait(100).add(s.manip)

    getattr(s, f'q{target[0]}').X90.add(s.manip)
    cphase.add(s.manip)
    getattr(s, f'q{target[0]}').X180.add(s.manip)
    getattr(s, f'q{target[1]}').X180.add(s.manip)
    cphase.add(s.manip)
    getattr(s, f'q{target[0]}').X90.add(s.manip)

    s.wait(100).add(s.manip)

    s.read(target[0])

    sequence, minstr, name = run_qubit_exp(f'symm cal :: {target}',
                                           s.segments(), s.measurement_manager)
    ds = scan_generic(sequence, minstr, name=name).run()

    x_axis = ds(f'read{target[0]}').x()
    y_axis = ds(f'read{target[0]}').y()
    probabilities = ds(f'read{target[0]}').z()
    fit_symmetry(x_axis, y_axis, probabilities, plot)
def calib_J_alpha(target, plot=False):
    '''
	calibrates a single qubit phase for a target qubit

	Args:
		target (int) : qubit pair to target
	'''
    var_mgr = variable_mgr()
    s = six_dot_sample(qc.Station.default.pulse)

    target = str(int(target))
    s.init(target[0], target[1])

    s.wait(100).add(s.manip)
    s.pre_pulse.add(s.manip)
    s.wait(100).add(s.manip)

    gates = globals()[f'J{target}'].gates
    N_J = 5
    voltages_gates = globals()[f'J{target}'].voltages_gates
    voltages_gates = list(voltages_gates)
    sweep_gate = lp.linspace(voltages_gates[2 * (int(target[0]))] / 2,
                             voltages_gates[2 * (int(target[0]))],
                             N_J,
                             axis=1,
                             name=f'vB{target[0]}',
                             unit='mV')
    voltages_gates[2 * (int(target[0]))] = sweep_gate
    voltages_gates = tuple(voltages_gates)

    gate_time = lp.linspace(0,
                            getattr(var_mgr, f'time_{target}') * 10,
                            80,
                            axis=0,
                            name='time',
                            unit='ns')

    getattr(s, f'q{target[0]}').X90.add(s.manip)
    cphase_basic(s.manip,
                 gates,
                 tuple([0] * len(gates)),
                 voltages_gates,
                 t_gate=gate_time / 2,
                 t_ramp=100)
    getattr(s, f'q{target[0]}').X180.add(s.manip)
    getattr(s, f'q{target[1]}').X180.add(s.manip)
    cphase_basic(s.manip,
                 gates,
                 tuple([0] * len(gates)),
                 voltages_gates,
                 t_gate=gate_time / 2,
                 t_ramp=100)
    getattr(s, f'q{target[0]}').X90.add(s.manip)

    s.wait(100).add(s.manip)

    s.read(target[0], target[1])

    sequence, minstr, name = run_qubit_exp(f'J_V cal :: {target}',
                                           s.segments(), s.measurement_manager)
    ds = scan_generic(sequence, minstr, name=name).run()

    time = ds(f'read{target[0]}').y() * 1e-9
    probabilities = ds(f'read{target[0]}').z()
    J_meas = []
    for i in range(N_J):
        time_fit = time[5:]
        probabilities_fit = probabilities[i][5:]
        J_meas += [
            1 / (fit_ramsey(time_fit, probabilities_fit, plot=plot) * 2) * 1e9
        ]
    barrier_percentage = sweep_gate.data / sweep_gate.data.max()
    J_V_off, J_max, alpha = fit_J(barrier_percentage,
                                  np.array(J_meas),
                                  plot=plot)

    if not hasattr(var_mgr, f'J_V_off{target}'):
        var_mgr.add_variable(f'cphase{target}', f'J_V_off{target}', 'mV', 0.1,
                             0)
    if not hasattr(var_mgr, f'J_max{target}'):
        var_mgr.add_variable(f'cphase{target}', f'J_max{target}', 'mV', 0.1, 0)
    if not hasattr(var_mgr, f'J_alpha{target}'):
        var_mgr.add_variable(f'cphase{target}', f'J_alpha{target}', 'mV', 0.1,
                             0)
    setattr(var_mgr, f'J_V_off{target}', round(J_V_off, 3))
    setattr(var_mgr, f'J_max{target}', round(J_max, 3))
    setattr(var_mgr, f'J_alpha{target}', round(alpha, 3))