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
def SD1_calibration(verbose=False):
    gates, _311113, ST_anti_12, ST_anti_12_tc_high, ST_anti_56, vSD1_threshold, vSD2_threshold = variables(
    )
    anticrossing = ST_anti_12

    pulse = qc.Station.default.pulse
    TRIG = mk_TRIG()
    EMPTY = pulse.mk_segment()
    var_mgr = variable_mgr()

    anticrossing = list(anticrossing)
    anticrossing[1] = lp.linspace(anticrossing[1] - 1,
                                  anticrossing[1] + 1,
                                  2,
                                  axis=1,
                                  name='vP1',
                                  unit='mV')
    anticrossing[12] = lp.linspace(anticrossing[12] - 3,
                                   anticrossing[12] + 3,
                                   80,
                                   axis=0,
                                   name='vSD1',
                                   unit='mV')
    anticrossing = tuple(anticrossing)

    PSB_read_multi_12(EMPTY, gates, 10, 2e3, _311113, anticrossing, 1)

    seq = [TRIG, EMPTY]

    raw_trace = False
    t_meas = 2e3
    n_qubit = 1
    n_rep = 500

    sequence, minstr, name = run_PSB_exp(
        'SD1_calibration',
        seq,
        t_meas,
        n_rep,
        n_qubit,
        raw_trace,
        phase=[var_mgr.RF_readout_phase, var_mgr.RF_readout_phase_SD2],
        order=[1])
    ds = scan_generic(sequence, minstr, name=name).run()
    data = ds.m1a()
    y = ds.m1.y()
    SD1_winner = 0
    contrast = 0
    threshold = 0
    for x in range(50):
        if data[1][x] - data[0][x] > contrast:
            contrast = data[1][x] - data[0][x]
            threshold = (data[1][x] + data[0][x]) / 2
            SD1_winner = y[x]
    print(SD1_winner)
    var_mgr.SD1_P_on_11 = SD1_winner
    print(contrast)
    print(threshold)
    var_mgr.vSD1_threshold = threshold
    return None
Esempio n. 3
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 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 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 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 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
Esempio n. 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 CROT_calib(pair, target, ancilla, 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
	'''
	var_mgr = variable_mgr()
	pair = str(int(pair))

	old_crot = getattr(var_mgr, f'crot{pair[target-1]}{pair[ancilla-1]}')
	old_z_crot = getattr(var_mgr, f'z_crot{pair[target-1]}{pair[ancilla-1]}')
	crot_time = getattr(var_mgr, f'pi_crot{pair[target-1]}_m3dbm')
	z_crot_time = getattr(var_mgr, f'pi_z_crot{pair[target-1]}_m3dbm')

	gate_time= min(crot_time,z_crot_time)	

	sequence, minstr, name = CROT_cali_meas(pair, target, ancilla, old_crot, gate_time, 0)
	ds_one = scan_generic(sequence, minstr, name=name).run()
	sequence, minstr, name = CROT_cali_meas(pair, target, ancilla, old_z_crot, gate_time, 1)
	ds_two = scan_generic(sequence, minstr, name=name).run()

	frequency_one = ds_one(f'read{pair[target-1]}').x()
	probabilities_one = ds_one(f'read{pair[target-1]}').y()
	fit_freq_one = fit_resonance(frequency_one, probabilities_one, plot=plot)
	
	frequency_two = ds_two(f'read{pair[target-1]}').x()
	probabilities_two = ds_two(f'read{pair[target-1]}').y()
	fit_freq_two = fit_resonance(frequency_two, probabilities_two, plot=plot)

	z_crot_res = min(fit_freq_one, fit_freq_two)
	crot_res = max(fit_freq_one, fit_freq_two)

	old_z_crot = getattr(var_mgr, f'z_crot{pair[target-1]}{pair[ancilla-1]}')
	setattr(var_mgr, f'z_crot{pair[target-1]}{pair[ancilla-1]}', round(z_crot_res*1e-9,6))
	old_crot = getattr(var_mgr, f'crot{pair[target-1]}{pair[ancilla-1]}')
	setattr(var_mgr, f'crot{pair[target-1]}{pair[ancilla-1]}', round(crot_res*1e-9,6))
	print(f'calibrated z_crot_res for qubit pair {pair}, target {pair[target-1]} '+
		f'Old z_crot_res : {round(old_z_crot,6)} \n New z_crot_res : {round(z_crot_res*1e-9,6)} \n')
	print(f'calibrated crot_res for qubit pair {pair}, target {pair[target-1]} '+
		f'Old crot_res : {round(old_crot,6)} \n New z_crot_res : {round(crot_res*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
def allXY(qubit, plot=False, nth_iter=0):
	'''
	calibrates a single qubit phase for a qubit

	Args:
		qubit (int) : qubit number to target (1-6)
		plot (bool) : plot the allXY fitting
		nth_iter (int) : nth itheration this script is called
	'''
	if nth_iter > 5:
		raise ValueError(f'failed to reach convergence on the allXX of qubit {qubit}')

	pulse_length_increment, off_resonance_error = _allXY_(qubit, plot)

	var_mgr = variable_mgr()
	setattr(var_mgr, f'pi_q{qubit}_m3dbm', round(getattr(var_mgr, f'pi_q{qubit}_m3dbm')*(1+pulse_length_increment), 1))
	freq = getattr(var_mgr, f'frequency_q{qubit}') + off_resonance_error*1e-9
	setattr(var_mgr, f'frequency_q{qubit}', freq)
	
	if abs(off_resonance_error) < 100e3 and abs(pulse_length_increment) < 0.005:
		return None
	else:
		return allXY(qubit, plot, nth_iter+1)
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
Esempio n. 13
0
from good_morning.fittings.J_versus_voltage import fit_J, J_to_voltage
from core_tools.utility.variable_mgr.var_mgr import variable_mgr

gates = ('vB0', 'vP1', 'vB1', 'vP2', 'vB2', 'vP3', 'vB3', 'vP4', 'vB4', 'vP5',
         'vB5', 'vP6')
voltages_gates = (-80, 0, -80, 0,
                  -120, variable_mgr().symm34_P3, variable_mgr().B3_34,
                  variable_mgr().symm34_P4, -120, 0, -80, 0)

J_off = -0.02003706650354627
J_max = 91207.33465174529
alpha = 2.408349090428599


def return_scalled_barier(voltage):
    def barrier(J):
        return voltage * J_to_voltage(J,
                                      variable_mgr().J_V_off34,
                                      variable_mgr().J_max34,
                                      variable_mgr().J_alpha34)

    return barrier


def gen_J_to_voltage():
    barriers = []
    for gate, voltage in zip(gates, voltages_gates):
        barriers += [return_scalled_barier(voltage)]
    return barriers

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)
Esempio n. 15
0
def CROT_pi_calib(pair, target, ancilla, 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
	'''
    var_mgr = variable_mgr()
    pair = str(int(pair))

    old_crot = getattr(var_mgr, f'crot{pair[target-1]}{pair[ancilla-1]}')
    old_z_crot = getattr(var_mgr, f'z_crot{pair[target-1]}{pair[ancilla-1]}')
    crot_time = getattr(var_mgr, f'pi_crot{pair[target-1]}_m3dbm')
    z_crot_time = getattr(var_mgr, f'pi_z_crot{pair[target-1]}_m3dbm')

    gate_time = max(crot_time, z_crot_time)

    sequence, minstr, name = CROT_cali_pi_meas(pair, target, ancilla,
                                               [old_z_crot, old_crot],
                                               gate_time, 0)
    ds_one = scan_generic(sequence, minstr, name=name).run()
    sequence, minstr, name = CROT_cali_pi_meas(pair, target, ancilla,
                                               [old_z_crot, old_crot],
                                               gate_time, 1)
    ds_two = scan_generic(sequence, minstr, name=name).run()

    frequency_one = ds_one(f'read{pair[target-1]}').x()
    time_one = ds_one(f'read{pair[target-1]}').y() * 1e-9
    probabilities_one = ds_one(f'read{pair[target-1]}').z()
    index_one = np.argmax(
        [[np.std(probabilities_one[0]),
          np.std(probabilities_one[1])]])
    Pi_time_one = fit_ramsey(time_one[5:],
                             probabilities_one[index_one][5:],
                             plot=plot)

    frequency_two = ds_two(f'read{pair[target-1]}').x()
    time_two = ds_two(f'read{pair[target-1]}').y() * 1e-9
    probabilities_two = ds_two(f'read{pair[target-1]}').z()
    index_two = np.argmax(
        [[np.std(probabilities_two[0]),
          np.std(probabilities_two[1])]])
    Pi_time_two = fit_ramsey(time_two, probabilities_two[index_two], plot=plot)

    if index_one > index_two:
        pi_crot = [Pi_time_two, Pi_time_one]
    else:
        pi_crot = [Pi_time_one, Pi_time_two]
    old_z_crot = getattr(var_mgr, f'pi_z_crot{pair[target-1]}_m3dbm')
    setattr(var_mgr, f'pi_z_crot{pair[target-1]}_m3dbm', round(pi_crot[0]))
    old_crot = getattr(var_mgr, f'pi_crot{pair[target-1]}_m3dbm')
    setattr(var_mgr, f'pi_crot{pair[target-1]}_m3dbm', round(pi_crot[1]))

    print(
        f'calibrated z_crot_pi for qubit pair {pair}, target {pair[target-1]} '
        +
        f'Old z_crot_pi : {round(old_z_crot,6)} \n New z_crot_pi : {round(pi_crot[0])} \n'
    )
    print(
        f'calibrated crot_pi for qubit pair {pair}, target {pair[target-1]} ' +
        f'Old crot_pi : {round(old_crot,6)} \n New crot_pi : {round(pi_crot[1])} \n'
    )
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))
Esempio n. 17
0
 def barrier(J):
     return voltage * J_to_voltage(J,
                                   variable_mgr().J_V_off45,
                                   variable_mgr().J_max45,
                                   variable_mgr().J_alpha45)
Esempio n. 18
0
 def barrier(J):
     return voltage * J_to_voltage(J,
                                   variable_mgr().J_V_off12,
                                   variable_mgr().J_max12,
                                   variable_mgr().J_alpha12)
Esempio n. 19
0
    def change_column_name(conn, old, new):
        statement = sql.SQL('ALTER TABLE {} RENAME COLUMN {} TO {};').format(sql.SQL(var_sql_queries.gen_table_content_name()), sql.Identifier(old), sql.Identifier(new))
        execute_statement(conn, statement)
        conn.commit()

    @staticmethod
    def gen_table_overview_name():
        return ('_'+sample_info.project+'_'+sample_info.set_up+'_'+sample_info.sample + "__variables_overview").replace(" ", "_").replace('-', '_')

    @staticmethod
    def gen_table_content_name():
        return ('_'+sample_info.project+'_'+sample_info.set_up+'_'+sample_info.sample + "__variables_content").replace(" ", "_").replace('-', '_')

if __name__ == '__main__':
    from core_tools.data.SQL.connect import set_up_local_storage, set_up_remote_storage
    from core_tools.utility.variable_mgr.var_mgr import variable_mgr
    set_up_local_storage('stephan', 'magicc', 'test', 'project', 'set_up', 'sample')
    set_up_local_storage("xld_user", "XLDspin001", "vandersypen_data", "6dot", "XLD", "SQ21-XX-X-XX-X")

    conn = variable_mgr().conn_local
    var_sql_queries.init_table(conn)

    # var_sql_queries.add_variable(conn, "SD1_P_on3execute_statement(conn, statement_1)", "mV", "SD voltages", 0.1)
    # var_sql_queries.add_variable(conn, "SD1_P_on", "mV", "SD voltages", 0.1)
    # var_sql_queries.update_val(conn, "SD1_P_on", 12)
    print(var_sql_queries.get_all_values(conn))
    print(var_sql_queries.get_all_specs(conn))
    var_sql_queries.remove_variable(conn, "PHASE_q2_q6_X")

Esempio n. 20
0
 def barrier(J):
     return voltage * J_to_voltage(J,
                                   variable_mgr().J_V_off56,
                                   variable_mgr().J_max56,
                                   variable_mgr().J_alpha56)
Esempio n. 21
0
from core_tools.data.SQL.connect import set_up_local_storage
set_up_local_storage("xld_user", "XLDspin001", "vandersypen_data", "6dot",
                     "XLD", "6D2S - SQ21-XX-X-XX-X")

from good_morning.fittings.J_versus_voltage import fit_J, J_to_voltage, voltage_to_J
from core_tools.utility.variable_mgr.var_mgr import variable_mgr

gates = ('vB0', 'vP1', 'vB1', 'vP2', 'vB2', 'vP3', 'vB3', 'vP4', 'vB4', 'vP5',
         'vB5', 'vP6')
voltages_gates = (-110, variable_mgr().symm12_P1, variable_mgr().B1_12,
                  variable_mgr().symm12_P2, -90, 0, -70, 0, -70, 0, -70, 0)

J_off = 0.019
J_max = 46213.051
alpha = 2.479


def _return_scalled_barier_(voltage):
    def barrier(J):
        return voltage * J_to_voltage(J,
                                      variable_mgr().J_V_off12,
                                      variable_mgr().J_max12,
                                      variable_mgr().J_alpha12)

    return barrier


def gen_J_to_voltage():
    barriers = []
    for gate, voltage in zip(gates, voltages_gates):
        barriers += [_return_scalled_barier_(voltage)]
Esempio n. 22
0
from good_morning.fittings.J_versus_voltage import fit_J, J_to_voltage
from core_tools.utility.variable_mgr.var_mgr import variable_mgr

gates = ('vB0', 'vP1', 'vB1', 'vP2', 'vB2', 'vP3', 'vB3', 'vP4', 'vB4', 'vP5',
         'vB5', 'vP6')
voltages_gates = (-80, 0, -80, 0, -80, 0, -80, 0,
                  -110, variable_mgr().symm56_P5, variable_mgr().B5_56,
                  variable_mgr().symm56_P6)

J_off = 0.0264355989289498
J_max = 39003.52887708517
alpha = 2.2928821036820044


def return_scalled_barier(voltage):
    def barrier(J):
        return voltage * J_to_voltage(J,
                                      variable_mgr().J_V_off56,
                                      variable_mgr().J_max56,
                                      variable_mgr().J_alpha56)

    return barrier


def gen_J_to_voltage():
    barriers = []
    for gate, voltage in zip(gates, voltages_gates):
        barriers += [return_scalled_barier(voltage)]
    return barriers

Esempio n. 23
0
 def barrier(J):
     return voltage * J_to_voltage(J,
                                   variable_mgr().J_V_off34,
                                   variable_mgr().J_max34,
                                   variable_mgr().J_alpha34)
Esempio n. 24
0
from good_morning.fittings.J_versus_voltage import fit_J, J_to_voltage
from core_tools.utility.variable_mgr.var_mgr import variable_mgr

gates = ('vB0', 'vP1', 'vB1', 'vP2', 'vB2', 'vP3', 'vB3', 'vP4', 'vB4', 'vP5',
         'vB5', 'vP6')
voltages_gates = (-80, 0, -80, 0, -80, 0, -100, variable_mgr().symm45_P4,
                  variable_mgr().B4_45, variable_mgr().symm45_P5, -100, 0)

J_off = 0.022917827490600135
J_max = 4306.648735663147
alpha = 3.7242883106110556


def return_scalled_barier(voltage):
    def barrier(J):
        return voltage * J_to_voltage(J,
                                      variable_mgr().J_V_off45,
                                      variable_mgr().J_max45,
                                      variable_mgr().J_alpha45)

    return barrier


def gen_J_to_voltage():
    barriers = []
    for gate, voltage in zip(gates, voltages_gates):
        barriers += [return_scalled_barier(voltage)]
    return barriers


if __name__ == '__main__':
Esempio n. 25
0
from good_morning.fittings.J_versus_voltage import fit_J, J_to_voltage, fit_delta_B_vs_J
from core_tools.utility.variable_mgr.var_mgr import variable_mgr
import numpy as np

gates = ('vB0', 'vP1', 'vB1', 'vP2', 'vB2', 'vP3', 'vB3', 'vP4', 'vB4', 'vP5',
         'vB5', 'vP6')
voltages_gates = (-80, 0, -80, variable_mgr().symm23_P2, variable_mgr().B2_23,
                  variable_mgr().symm23_P3, -80, 0, -80, 0, -80, 0)

J_off = -0.0023569391439328497
J_max = 280095.87977114564
alpha = 2.157771283116629

J_rel = np.array([0e6, 1e6, 2e6, 3e6, 4e6, 5e6, 6e6, 7e6, 8e6, 9e6, 10e6])
delta_B = np.array([
    61.81e6, 58.25e6, 55.76e6, 54.6e6, 53.8e6, 53.4e6, 53.27e6, 53.19e6,
    53.3e6, 53.5e6, 53.8e6
])


def _return_scalled_barier_(voltage):
    def barrier(J):
        return voltage * J_to_voltage(J,
                                      variable_mgr().J_V_off23,
                                      variable_mgr().J_max23,
                                      variable_mgr().J_alpha23)

    return barrier


def gen_J_to_voltage():
Esempio n. 26
0
 def barrier(J):
     return voltage * J_to_voltage(J,
                                   variable_mgr().J_V_off23,
                                   variable_mgr().J_max23,
                                   variable_mgr().J_alpha23)