def test_Swap(self): q = QubitFactory('q1') mq = QubitFactory('q2') qr = QRegister(q) mqr = QRegister(mq) delays = np.linspace(0, 5e-6, 11) expectedseq = [] for d in delays: expectedseq += [ qwait(channels=(q, mq)), X(q), X(mq), Id(mq, length=d), Barrier(q, mq), MEAS(q), MEAS(mq) ] # Add calibration cal_seqs = get_cal_seqs_2qubits(q, mq, 2) expectedseq += cal_seqs expectedseq = testable_sequence(expectedseq) resFunction = compile_function( "src/python/qgl2/basic_sequences/Rabi.py", "Swap", (qr, delays, mqr)) seqs = resFunction() seqs = testable_sequence(seqs) assertPulseSequenceEqual(self, seqs, expectedseq)
def test_RabiAmp_NQubits(self): q1 = QubitFactory('q1') q2 = QubitFactory('q2') qr = QRegister(q1, q2) amps = np.linspace(0, 5e-6, 11) p = 0 docals = False calRepeats = 2 expectedseq = [] for a in amps: expectedseq += [ qwait(channels=(q1, q2)), Utheta(q1, amp=a, phase=p), Utheta(q2, amp=a, phase=p), Barrier(q1, q2), MEAS(q1), MEAS(q2) ] if docals: # Add calibration cal_seqs = get_cal_seqs_2qubits(q1, q2, calRepeats) expectedseq += cal_seqs expectedseq = testable_sequence(expectedseq) resFunction = compile_function( "src/python/qgl2/basic_sequences/Rabi.py", "RabiAmp_NQubits", (qr, amps, p, None, docals, calRepeats)) seqs = resFunction() seqs = testable_sequence(seqs) assertPulseSequenceEqual(self, seqs, expectedseq)
def test_PiRabi(self): controlQ = QubitFactory('q1') targetQ = QubitFactory('q2') controlQR = QRegister('q1') targetQR = QRegister('q2') qr = QRegister('q1', 'q2') edge = EdgeFactory(controlQ, targetQ) lengths = np.linspace(0, 4e-6, 11) riseFall = 40e-9 amp = 1 phase = 0 calRepeats = 2 expected_seq = [] # Seq1 for l in lengths: expected_seq += [ qwait(channels=(controlQ, targetQ)), Id(controlQ), flat_top_gaussian(edge, riseFall, length=l, amp=amp, phase=phase), Barrier(controlQ, targetQ), MEAS(controlQ), MEAS(targetQ) ] # Seq2 for l in lengths: expected_seq += [ qwait(channels=(controlQ, targetQ)), X(controlQ), flat_top_gaussian(edge, riseFall, length=l, amp=amp, phase=phase), X(controlQ), Barrier(controlQ, targetQ), MEAS(controlQ), MEAS(targetQ) ] # Add calibration calseq = get_cal_seqs_2qubits(controlQ, targetQ, calRepeats) expected_seq += calseq expected_seq = testable_sequence(expected_seq) resFunction = compile_function( "src/python/qgl2/basic_sequences/CR.py", "PiRabi", (controlQR, targetQR, lengths, riseFall, amp, phase, calRepeats)) seqs = resFunction() seqs = testable_sequence(seqs) self.maxDiff = None assertPulseSequenceEqual(self, seqs, expected_seq)
def test_EchoCRPhase(self): controlQ = QubitFactory('q1') targetQ = QubitFactory('q2') cR = QRegister('q1') tR = QRegister('q2') phases = np.linspace(0, pi / 2, 11) riseFall = 40e-9 amp = 1 length = 100e-9 calRepeats = 2 canc_amp = 0 canc_phase = np.pi / 2 expected_seq = [] # Seq1 for p in phases: expected_seq += [ qwait(channels=(controlQ, targetQ)), Id(controlQ), echoCR(controlQ, targetQ, length=length, phase=p, amp=amp, riseFall=riseFall, canc_amp=canc_amp, canc_phase=canc_phase), Barrier(controlQ, targetQ), X90(targetQ), Id(controlQ), Barrier(controlQ, targetQ), MEAS(controlQ), MEAS(targetQ) ] # Seq2 for p in phases: expected_seq += [ qwait(channels=(controlQ, targetQ)), X(controlQ), echoCR(controlQ, targetQ, length=length, phase=p, amp=amp, riseFall=riseFall, canc_amp=canc_amp, canc_phase=canc_phase), Barrier(controlQ, targetQ), X90(targetQ), X(controlQ), Barrier(controlQ, targetQ), MEAS(controlQ), MEAS(targetQ) ] # Add calibration cal_seqs = get_cal_seqs_2qubits(controlQ, targetQ, calRepeats) expected_seq += cal_seqs expected_seq = testable_sequence(expected_seq) resFunction = compile_function("src/python/qgl2/basic_sequences/CR.py", "EchoCRPhase", (cR, tR, phases, riseFall, amp, length, calRepeats, canc_amp, canc_phase)) seqs = resFunction() seqs = testable_sequence(seqs) self.maxDiff = None assertPulseSequenceEqual(self, seqs, expected_seq)
def test_EchoCRLen(self): controlQ = QubitFactory('q1') targetQ = QubitFactory('q2') cR = QRegister('q1') # Equivalent to QRegister(controlQ) tR = QRegister('q2') # FIXME: Better values!? lengths = np.linspace(0, 2e-6, 11) riseFall = 40e-9 amp = 1 phase = 0 calRepeats = 2 canc_amp = 0 canc_phase = np.pi / 2 expected_seq = [] # Seq1 for l in lengths: expected_seq += [ qwait(channels=(controlQ, targetQ)), Id(controlQ), echoCR(controlQ, targetQ, length=l, phase=phase, amp=amp, riseFall=riseFall, canc_amp=canc_amp, canc_phase=canc_phase), Id(controlQ), Barrier(controlQ, targetQ), MEAS(controlQ), MEAS(targetQ) ] # Seq2 for l in lengths: expected_seq += [ qwait(channels=(controlQ, targetQ)), X(controlQ), echoCR(controlQ, targetQ, length=l, phase=phase, amp=amp, riseFall=riseFall, canc_amp=canc_amp, canc_phase=canc_phase), X(controlQ), Barrier(controlQ, targetQ), MEAS(controlQ), MEAS(targetQ) ] # Add calibration cal_seqs = get_cal_seqs_2qubits(controlQ, targetQ, calRepeats) expected_seq += cal_seqs expected_seq = testable_sequence(expected_seq) resFunction = compile_function("src/python/qgl2/basic_sequences/CR.py", "EchoCRLen", (cR, tR, lengths, riseFall, amp, phase, calRepeats, canc_amp, canc_phase)) seqs = resFunction() seqs = testable_sequence(seqs) self.maxDiff = None assertPulseSequenceEqual(self, seqs, expected_seq)