コード例 #1
0
ファイル: test_basic_mins.py プロジェクト: stjordanis/pyqgl2
    def test_Ramsey(self):
        q = QubitFactory('q1')
        qr = QRegister('q1')
        delays = np.arange(100e-9, 10e-6, 100e-9)
        TPPIFreq = 1e6
        calRepeats = 2
        expectedseq = []

        # Create the phases for the TPPI
        phases = 2 * pi * TPPIFreq * delays

        # Create the basic Ramsey sequence
        for d, phase in zip(delays, phases):
            expectedseq += [
                qwait(channels=(q, )),
                X90(q),
                Id(q, d),
                U90(q, phase=phase),
                MEAS(q)
            ]
        # Add calibration
        cal = get_cal_seqs_1qubit(q, calRepeats)
        expectedseq += cal

        expectedseq = testable_sequence(expectedseq)

        resFunction = compile_function(
            "src/python/qgl2/basic_sequences/T1T2.py", "Ramsey",
            (qr, delays, TPPIFreq, calRepeats))
        seqs = resFunction()
        seqs = testable_sequence(seqs)
        assertPulseSequenceEqual(self, seqs, expectedseq)
コード例 #2
0
ファイル: test_basic_mins.py プロジェクト: stjordanis/pyqgl2
    def test_HahnEcho(self):
        q = QubitFactory('q1')
        qr = QRegister('q1')
        steps = 11
        pulseSpacings = np.linspace(0, 5e-6, steps)
        periods = 0
        calRepeats = 2
        expectedseq = []
        for k in range(len(pulseSpacings)):
            expectedseq += [
                qwait(channels=(q, )),
                X90(q),
                Id(q, pulseSpacings[k]),
                Y(q),
                Id(q, pulseSpacings[k]),
                U90(q, phase=2 * pi * periods / len(pulseSpacings) * k),
                MEAS(q)
            ]

        # Add calibration
        cal = get_cal_seqs_1qubit(q, calRepeats)
        expectedseq += cal

        expectedseq = testable_sequence(expectedseq)

        resFunction = compile_function(
            "src/python/qgl2/basic_sequences/Decoupling.py", "HahnEcho",
            (qr, pulseSpacings, periods, calRepeats))
        seqs = resFunction()
        seqs = testable_sequence(seqs)
        # import ipdb; ipdb.set_trace()
        assertPulseSequenceEqual(self, seqs, expectedseq)
コード例 #3
0
ファイル: test_basic_mins.py プロジェクト: stjordanis/pyqgl2
    def test_InversionRecovery(self):
        q = QubitFactory('q1')
        qr = QRegister('q1')
        delays = np.linspace(0, 5e-6, 11)
        calRepeats = 2
        expectedseq = []
        for d in delays:
            expectedseq += [qwait(channels=(q, )), X(q), Id(q, d), MEAS(q)]

        # Add calibration
        cal = get_cal_seqs_1qubit(q, calRepeats)
        expectedseq += cal

        expectedseq = testable_sequence(expectedseq)

        resFunction = compile_function(
            "src/python/qgl2/basic_sequences/T1T2.py", "InversionRecovery",
            (qr, delays, calRepeats))
        seqs = resFunction()
        seqs = testable_sequence(seqs)
        assertPulseSequenceEqual(self, seqs, expectedseq)
コード例 #4
0
ファイル: test_basic_mins.py プロジェクト: stjordanis/pyqgl2
    def test_CPMG(self):
        q = QubitFactory('q1')
        qr = QRegister('q1')

        # Create numPulses sequences
        numPulses = [0, 2, 4, 6]
        pulseSpacing = 500e-9
        pulseSpacingDiff = pulseSpacing - q.pulse_params['length']
        calRepeats = 2

        def addt180t(q, pulseSpacingDiff, rep):
            t180t = []
            for _ in range(rep):
                t180t += [
                    Id(q, pulseSpacingDiff / 2),
                    Y(q),
                    Id(q, pulseSpacingDiff / 2)
                ]
            return t180t

        expectedseq = []
        for rep in numPulses:
            expectedseq += [qwait(channels=(q, )), X90(q)]
            expectedseq += addt180t(q, pulseSpacingDiff, rep)
            expectedseq += [X90(q), MEAS(q)]

        # Add calibration
        cal = get_cal_seqs_1qubit(q, calRepeats)
        expectedseq += cal

        expectedseq = testable_sequence(expectedseq)

        resFunction = compile_function(
            "src/python/qgl2/basic_sequences/Decoupling.py", "CPMG",
            (qr, numPulses, pulseSpacing, calRepeats))
        seqs = resFunction()
        seqs = testable_sequence(seqs)
        assertPulseSequenceEqual(self, seqs, expectedseq)