Exemplo n.º 1
0
 def testT1Recovery(self):
     '''
     Test a simple T1 recovery without any pulses.  Start in the first excited state and watch recovery down to ground state.
     '''
     self.systemParams.dissipators = [Dissipator(self.qubit.T1Dissipator)]
     
     #Just setup a series of delays
     delays = np.linspace(0,5e-6,40)
     pulseSeqs = []
     for tmpDelay in delays:
         tmpPulseSeq = PulseSequence()
         tmpPulseSeq.add_control_line()
         tmpPulseSeq.controlAmps = np.array([[0]])
         tmpPulseSeq.timeSteps = np.array([tmpDelay])
         tmpPulseSeq.maxTimeStep = tmpDelay
         tmpPulseSeq.H_int = None
         
         pulseSeqs.append(tmpPulseSeq)
     
     results = simulate_sequence_stack(pulseSeqs, self.systemParams, np.array([[0,0],[0,1]], dtype=np.complex128), simType='lindblad')[0]
     expectedResults = 1-2*np.exp(-delays/self.qubit.T1)
     if plotResults:
         plt.figure()
         plt.plot(1e6*delays,results)
         plt.plot(1e6*delays, expectedResults, color='r', linestyle='--', linewidth=2)
         plt.xlabel(r'Recovery Time ($\mu$s)')
         plt.ylabel(r'Expectation Value of $\sigma_z$')
         plt.title(r'$T_1$ Recovery to the Ground State')
         plt.legend(('Simulated Results', 'Exponential T1 Recovery'))
         plt.show()
     
     np.testing.assert_allclose(results, expectedResults, atol=1e-4)
Exemplo n.º 2
0
    def testRabiRotatingFrame(self):
        '''
        Test Rabi oscillations in the rotating frame, i.e. with zero drift Hamiltonian drive frequency of zero.
        '''
        
        #Setup the pulseSequences
        pulseSeqs = []
        for pulseLength in self.pulseLengths:
            tmpPulseSeq = PulseSequence()
            tmpPulseSeq.add_control_line(freq=0e9, phase=0)
            tmpPulseSeq.controlAmps = self.rabiFreq*np.array([[1]], dtype=np.float64)
            tmpPulseSeq.timeSteps = np.array([pulseLength])
            tmpPulseSeq.maxTimeStep = pulseLength
            tmpPulseSeq.H_int = None
            
            pulseSeqs.append(tmpPulseSeq)
        
        results = simulate_sequence_stack(pulseSeqs, self.systemParams, self.rhoIn, simType='unitary')[0]
        expectedResults = np.cos(2*pi*self.rabiFreq*self.pulseLengths)
        if plotResults:
            plt.figure()
            plt.plot(self.pulseLengths,results)
            plt.plot(self.pulseLengths, expectedResults, color='r', linestyle='--', linewidth=2)
            plt.title('10MHz Rabi Oscillations in Rotating Frame')
            plt.xlabel('Pulse Length')
            plt.ylabel(r'$\sigma_z$')
            plt.legend(('Simulated Results', '10MHz Cosine'))
            plt.show()

        np.testing.assert_allclose(results, expectedResults , atol = 1e-4)
Exemplo n.º 3
0
    def testTwoPhoton(self):
        
        '''
        Test spectroscopy and the two photon transition from the ground to the second excited state.
        '''
        
        freqSweep = 1e9*np.linspace(4.9, 5.1, 1000)
        rabiFreq = 1e6
        
        #Setup the pulseSequences as a series of 10us low-power pulses
        pulseSeqs = []
        for freq in freqSweep:
            tmpPulseSeq = PulseSequence()
            tmpPulseSeq.add_control_line(freq=freq, phase=0)
            tmpPulseSeq.controlAmps = np.array([[rabiFreq]], dtype=np.float64)
            tmpPulseSeq.timeSteps = np.array([10e-6])
            tmpPulseSeq.maxTimeStep = np.Inf
            tmpPulseSeq.H_int = Hamiltonian(np.diag(freq*np.arange(3, dtype=np.complex128)))
            
            pulseSeqs.append(tmpPulseSeq)
        
        results = simulate_sequence_stack(pulseSeqs, self.systemParams, self.rhoIn, simType='lindblad')[0]

        if plotResults:        
            plt.figure()
            plt.plot(freqSweep/1e9,results)
            plt.xlabel('Frequency')
            plt.ylabel(r'$\sigma_z$')
            plt.title('Qutrit Spectroscopy')
            plt.show()
Exemplo n.º 4
0
    def testTwoPhoton(self):
        '''
        Test spectroscopy and the two photon transition from the ground to the second excited state.
        '''

        freqSweep = 1e9 * np.linspace(4.9, 5.1, 1000)
        rabiFreq = 1e6

        #Setup the pulseSequences as a series of 10us low-power pulses
        pulseSeqs = []
        for freq in freqSweep:
            tmpPulseSeq = PulseSequence()
            tmpPulseSeq.add_control_line(freq=freq, phase=0)
            tmpPulseSeq.controlAmps = np.array([[rabiFreq]], dtype=np.float64)
            tmpPulseSeq.timeSteps = np.array([10e-6])
            tmpPulseSeq.maxTimeStep = np.Inf
            tmpPulseSeq.H_int = Hamiltonian(
                np.diag(freq * np.arange(3, dtype=np.complex128)))

            pulseSeqs.append(tmpPulseSeq)

        results = simulate_sequence_stack(pulseSeqs,
                                          self.systemParams,
                                          self.rhoIn,
                                          simType='lindblad')[0]

        if plotResults:
            plt.figure()
            plt.plot(freqSweep / 1e9, results)
            plt.xlabel('Frequency')
            plt.ylabel(r'$\sigma_z$')
            plt.title('Qutrit Spectroscopy')
            plt.show()
Exemplo n.º 5
0
    def testRabiInteractionFrame(self):
        '''
        Test Rabi oscillations after moving into an interaction frame that is different to the pulsing frame and with an irrational timestep for good measure.
        '''
        
        #Setup the system
        self.systemParams.subSystems[0] = SCQubit(2,5e9, 'Q1')
        self.systemParams.create_full_Ham()
        
        #Setup the pulseSequences
        pulseSeqs = []
        for pulseLength in self.pulseLengths:
        
            tmpPulseSeq = PulseSequence()
            tmpPulseSeq.add_control_line(freq=-5.0e9, phase=0)
            tmpPulseSeq.controlAmps = self.rabiFreq*np.array([[1]], dtype=np.float64)
            tmpPulseSeq.timeSteps = np.array([pulseLength])
            tmpPulseSeq.maxTimeStep = pi/2*1e-10
            tmpPulseSeq.H_int = Hamiltonian(np.array([[0,0], [0, 5.005e9]], dtype = np.complex128))
            
            pulseSeqs.append(tmpPulseSeq)
            
        results = simulate_sequence_stack(pulseSeqs, self.systemParams, self.rhoIn, simType='unitary')[0]
        expectedResults = np.cos(2*pi*self.rabiFreq*self.pulseLengths)
        if plotResults:
            plt.figure()
            plt.plot(self.pulseLengths,results)
            plt.plot(self.pulseLengths, expectedResults, color='r', linestyle='--', linewidth=2)
            plt.title('10MHz Rabi Oscillations in Interaction Frame')
            plt.xlabel('Pulse Length')
            plt.ylabel(r'$\sigma_z$')
            plt.legend(('Simulated Results', '10MHz Cosine'))
            plt.show()

        np.testing.assert_allclose(results, expectedResults , atol = 1e-4)
Exemplo n.º 6
0
    def testZZGate(self):
        '''Test whether the ZZ interaction performs as expected'''

        #Take the bare Hamiltonian as the interaction Hamiltonian
        H_int = Hamiltonian(self.systemParams.Hnat.matrix)

        #First add a 2MHz ZZ interaction and add it to the system
        self.systemParams.add_interaction('Q1', 'Q2', 'ZZ', 2e6)
        self.systemParams.create_full_Ham()

        #Setup the pulseSequences
        delays = np.linspace(0, 4e-6, 100)
        pulseSeqs = []
        for delay in delays:
            tmpPulseSeq = PulseSequence()
            tmpPulseSeq.add_control_line(freq=-5.0e9, phase=0)
            tmpPulseSeq.add_control_line(freq=-6.0e9, phase=0)
            tmpPulseSeq.controlAmps = self.rabiFreq * np.array(
                [[1, 0], [0, 0]], dtype=np.float64)
            tmpPulseSeq.timeSteps = np.array([25e-9, delay])
            tmpPulseSeq.maxTimeStep = np.Inf
            tmpPulseSeq.H_int = H_int

            pulseSeqs.append(tmpPulseSeq)

        self.systemParams.measurement = np.kron(self.Q1.pauliX, self.Q2.pauliZ)
        resultsXZ = simulate_sequence_stack(pulseSeqs,
                                            self.systemParams,
                                            self.rhoIn,
                                            simType='unitary')[0]
        self.systemParams.measurement = np.kron(self.Q1.pauliY, self.Q2.pauliZ)
        resultsYZ = simulate_sequence_stack(pulseSeqs,
                                            self.systemParams,
                                            self.rhoIn,
                                            simType='unitary')[0]

        if plotResults:
            plt.figure()
            plt.plot(delays * 1e6, resultsXZ)
            plt.plot(delays * 1e6, resultsYZ, 'g')
            plt.legend(('XZ', 'YZ'))
            plt.xlabel('Coupling Time')
            plt.ylabel('Operator Expectation Value')
            plt.title('ZZ Coupling Evolution After a X90 on Q1')
            plt.show()
Exemplo n.º 7
0
    def testYPhase(self):
        '''
        Make sure the frame-handedness matches what we expect: i.e. if the qubit frequency is 
        greater than the driver frequency this corresponds to a positive rotation.
        '''
        #Setup the system
        self.systemParams.subSystems[0] = SCQubit(2, 5e9, 'Q1')
        self.systemParams.create_full_Ham()

        #Add a Y control Hamiltonian
        self.systemParams.add_control_ham(
            inphase=Hamiltonian(0.5 * self.qubit.pauliX),
            quadrature=Hamiltonian(0.5 * self.qubit.pauliY))

        #Setup the pulseSequences
        delays = np.linspace(0, 8e-6, 200)
        t90 = 0.25 * (1 / self.rabiFreq)
        offRes = 1.2345e6
        pulseSeqs = []
        for delay in delays:

            tmpPulseSeq = PulseSequence()
            #Shift the pulsing frequency down by offRes
            tmpPulseSeq.add_control_line(freq=-(5.0e9 - offRes), phase=0)
            tmpPulseSeq.add_control_line(freq=-(5.0e9 - offRes), phase=-pi / 2)
            #Pulse sequence is X90, delay, Y90
            tmpPulseSeq.controlAmps = self.rabiFreq * np.array(
                [[1, 0, 0], [0, 0, 1]], dtype=np.float64)
            tmpPulseSeq.timeSteps = np.array([t90, delay, t90])
            #Interaction frame with some odd frequency
            tmpPulseSeq.H_int = Hamiltonian(
                np.array([[0, 0], [0, 5.00e9]], dtype=np.complex128))

            pulseSeqs.append(tmpPulseSeq)

        results = simulate_sequence_stack(pulseSeqs,
                                          self.systemParams,
                                          self.rhoIn,
                                          simType='lindblad')[0]
        expectedResults = -np.sin(2 * pi * offRes * (delays + t90))
        if plotResults:
            plt.figure()
            plt.plot(1e6 * delays, results)
            plt.plot(1e6 * delays,
                     expectedResults,
                     color='r',
                     linestyle='--',
                     linewidth=2)
            plt.title('Ramsey Fringes {0:.2f} MHz Off-Resonance'.format(
                offRes / 1e6))
            plt.xlabel('Pulse Spacing (us)')
            plt.ylabel(r'$\sigma_z$')
            plt.legend(('Simulated Results',
                        ' {0:.2f} MHz -Sin.'.format(offRes / 1e6)))
            plt.show()
Exemplo n.º 8
0
    def testRamsey(self):
        '''
        Just look at Ramsey decay to make sure we get the off-resonance right.
        '''

        #Setup the system
        self.systemParams.subSystems[0] = SCQubit(2, 5e9, 'Q1')
        self.systemParams.create_full_Ham()
        self.systemParams.dissipators = [Dissipator(self.qubit.T1Dissipator)]

        #Setup the pulseSequences
        delays = np.linspace(0, 8e-6, 200)
        t90 = 0.25 * (1 / self.rabiFreq)
        offRes = 0.56789e6
        pulseSeqs = []
        for delay in delays:

            tmpPulseSeq = PulseSequence()
            #Shift the pulsing frequency down by offRes
            tmpPulseSeq.add_control_line(freq=-(5.0e9 - offRes), phase=0)
            #Pulse sequence is X90, delay, X90
            tmpPulseSeq.controlAmps = self.rabiFreq * np.array(
                [[1, 0, 1]], dtype=np.float64)
            tmpPulseSeq.timeSteps = np.array([t90, delay, t90])
            #Interaction frame with some odd frequency
            tmpPulseSeq.H_int = Hamiltonian(
                np.array([[0, 0], [0, 5.00e9]], dtype=np.complex128))

            pulseSeqs.append(tmpPulseSeq)

        results = simulate_sequence_stack(pulseSeqs,
                                          self.systemParams,
                                          self.rhoIn,
                                          simType='lindblad')[0]
        expectedResults = -np.cos(2 * pi * offRes *
                                  (delays + t90)) * np.exp(-delays /
                                                           (2 * self.qubit.T1))
        if plotResults:
            plt.figure()
            plt.plot(1e6 * delays, results)
            plt.plot(1e6 * delays,
                     expectedResults,
                     color='r',
                     linestyle='--',
                     linewidth=2)
            plt.title('Ramsey Fringes 0.56789MHz Off-Resonance')
            plt.xlabel('Pulse Spacing (us)')
            plt.ylabel(r'$\sigma_z$')
            plt.legend(
                ('Simulated Results', '0.57MHz Cosine with T1 limited decay.'))
            plt.show()
Exemplo n.º 9
0
    def testZZGate(self):
        '''Test whether the ZZ interaction performs as expected'''
        
        #Take the bare Hamiltonian as the interaction Hamiltonian
        H_int = Hamiltonian(self.systemParams.Hnat.matrix)
        
        #First add a 2MHz ZZ interaction and add it to the system
        self.systemParams.add_interaction('Q1', 'Q2', 'ZZ', 2e6)
        self.systemParams.create_full_Ham()
        
        #Setup the pulseSequences
        delays = np.linspace(0,4e-6,100)
        pulseSeqs = []
        for delay in delays:
            tmpPulseSeq = PulseSequence()
            tmpPulseSeq.add_control_line(freq=-5.0e9, phase=0)
            tmpPulseSeq.add_control_line(freq=-6.0e9, phase=0)
            tmpPulseSeq.controlAmps = self.rabiFreq*np.array([[1, 0], [0,0]], dtype=np.float64)
            tmpPulseSeq.timeSteps = np.array([25e-9, delay])
            tmpPulseSeq.maxTimeStep = np.Inf
            tmpPulseSeq.H_int = H_int
 
            pulseSeqs.append(tmpPulseSeq)
        
        self.systemParams.measurement = np.kron(self.Q1.pauliX, self.Q2.pauliZ)
        resultsXZ = simulate_sequence_stack(pulseSeqs, self.systemParams, self.rhoIn, simType='unitary')[0]
        self.systemParams.measurement = np.kron(self.Q1.pauliY, self.Q2.pauliZ)
        resultsYZ = simulate_sequence_stack(pulseSeqs, self.systemParams, self.rhoIn, simType='unitary')[0]

        if plotResults:
            plt.figure()
            plt.plot(delays*1e6, resultsXZ)
            plt.plot(delays*1e6, resultsYZ, 'g')
            plt.legend(('XZ','YZ'))
            plt.xlabel('Coupling Time')
            plt.ylabel('Operator Expectation Value')
            plt.title('ZZ Coupling Evolution After a X90 on Q1')
            plt.show()
Exemplo n.º 10
0
    def testRabiInteractionFrame(self):
        '''
        Test Rabi oscillations after moving into an interaction frame that is different to the pulsing frame and with an irrational timestep for good measure.
        '''

        #Setup the system
        self.systemParams.subSystems[0] = SCQubit(2, 5e9, 'Q1')
        self.systemParams.create_full_Ham()

        #Setup the pulseSequences
        pulseSeqs = []
        for pulseLength in self.pulseLengths:

            tmpPulseSeq = PulseSequence()
            tmpPulseSeq.add_control_line(freq=-5.0e9, phase=0)
            tmpPulseSeq.controlAmps = self.rabiFreq * np.array(
                [[1]], dtype=np.float64)
            tmpPulseSeq.timeSteps = np.array([pulseLength])
            tmpPulseSeq.maxTimeStep = pi / 2 * 1e-10
            tmpPulseSeq.H_int = Hamiltonian(
                np.array([[0, 0], [0, 5.005e9]], dtype=np.complex128))

            pulseSeqs.append(tmpPulseSeq)

        results = simulate_sequence_stack(pulseSeqs,
                                          self.systemParams,
                                          self.rhoIn,
                                          simType='unitary')[0]
        expectedResults = np.cos(2 * pi * self.rabiFreq * self.pulseLengths)
        if plotResults:
            plt.figure()
            plt.plot(self.pulseLengths, results)
            plt.plot(self.pulseLengths,
                     expectedResults,
                     color='r',
                     linestyle='--',
                     linewidth=2)
            plt.title('10MHz Rabi Oscillations in Interaction Frame')
            plt.xlabel('Pulse Length')
            plt.ylabel(r'$\sigma_z$')
            plt.legend(('Simulated Results', '10MHz Cosine'))
            plt.show()

        np.testing.assert_allclose(results, expectedResults, atol=1e-4)
Exemplo n.º 11
0
 def testYPhase(self):
     
     '''
     Make sure the frame-handedness matches what we expect: i.e. if the qubit frequency is 
     greater than the driver frequency this corresponds to a positive rotation.
     '''        
     #Setup the system
     self.systemParams.subSystems[0] = SCQubit(2,5e9, 'Q1')
     self.systemParams.create_full_Ham()
     
     #Add a Y control Hamiltonian 
     self.systemParams.add_control_ham(inphase = Hamiltonian(0.5*self.qubit.pauliX), quadrature = Hamiltonian(0.5*self.qubit.pauliY))
     
     #Setup the pulseSequences
     delays = np.linspace(0,8e-6,200)
     t90 = 0.25*(1/self.rabiFreq)
     offRes = 1.2345e6
     pulseSeqs = []
     for delay in delays:
     
         tmpPulseSeq = PulseSequence()
         #Shift the pulsing frequency down by offRes
         tmpPulseSeq.add_control_line(freq=-(5.0e9-offRes), phase=0)
         tmpPulseSeq.add_control_line(freq=-(5.0e9-offRes), phase=-pi/2)
         #Pulse sequence is X90, delay, Y90
         tmpPulseSeq.controlAmps = self.rabiFreq*np.array([[1, 0, 0],[0,0,1]], dtype=np.float64)
         tmpPulseSeq.timeSteps = np.array([t90, delay, t90])
         #Interaction frame with some odd frequency
         tmpPulseSeq.H_int = Hamiltonian(np.array([[0,0], [0, 5.00e9]], dtype = np.complex128))
         
         pulseSeqs.append(tmpPulseSeq)
         
     results = simulate_sequence_stack(pulseSeqs, self.systemParams, self.rhoIn, simType='lindblad')[0]
     expectedResults = -np.sin(2*pi*offRes*(delays+t90))
     if plotResults:
         plt.figure()
         plt.plot(1e6*delays,results)
         plt.plot(1e6*delays, expectedResults, color='r', linestyle='--', linewidth=2)
         plt.title('Ramsey Fringes {0:.2f} MHz Off-Resonance'.format(offRes/1e6))
         plt.xlabel('Pulse Spacing (us)')
         plt.ylabel(r'$\sigma_z$')
         plt.legend(('Simulated Results', ' {0:.2f} MHz -Sin.'.format(offRes/1e6) ))
         plt.show()
Exemplo n.º 12
0
    def testT1Recovery(self):
        '''
        Test a simple T1 recovery without any pulses.  Start in the first excited state and watch recovery down to ground state.
        '''
        self.systemParams.dissipators = [Dissipator(self.qubit.T1Dissipator)]

        #Just setup a series of delays
        delays = np.linspace(0, 5e-6, 40)
        pulseSeqs = []
        for tmpDelay in delays:
            tmpPulseSeq = PulseSequence()
            tmpPulseSeq.add_control_line()
            tmpPulseSeq.controlAmps = np.array([[0]])
            tmpPulseSeq.timeSteps = np.array([tmpDelay])
            tmpPulseSeq.maxTimeStep = tmpDelay
            tmpPulseSeq.H_int = None

            pulseSeqs.append(tmpPulseSeq)

        results = simulate_sequence_stack(pulseSeqs,
                                          self.systemParams,
                                          np.array([[0, 0], [0, 1]],
                                                   dtype=np.complex128),
                                          simType='lindblad')[0]
        expectedResults = 1 - 2 * np.exp(-delays / self.qubit.T1)
        if plotResults:
            plt.figure()
            plt.plot(1e6 * delays, results)
            plt.plot(1e6 * delays,
                     expectedResults,
                     color='r',
                     linestyle='--',
                     linewidth=2)
            plt.xlabel(r'Recovery Time ($\mu$s)')
            plt.ylabel(r'Expectation Value of $\sigma_z$')
            plt.title(r'$T_1$ Recovery to the Ground State')
            plt.legend(('Simulated Results', 'Exponential T1 Recovery'))
            plt.show()

        np.testing.assert_allclose(results, expectedResults, atol=1e-4)
Exemplo n.º 13
0
 def testRamsey(self):
     '''
     Just look at Ramsey decay to make sure we get the off-resonance right.
     '''
     
     #Setup the system
     self.systemParams.subSystems[0] = SCQubit(2,5e9, 'Q1')
     self.systemParams.create_full_Ham()
     self.systemParams.dissipators = [Dissipator(self.qubit.T1Dissipator)]
     
     #Setup the pulseSequences
     delays = np.linspace(0,8e-6,200)
     t90 = 0.25*(1/self.rabiFreq)
     offRes = 0.56789e6
     pulseSeqs = []
     for delay in delays:
     
         tmpPulseSeq = PulseSequence()
         #Shift the pulsing frequency down by offRes
         tmpPulseSeq.add_control_line(freq=-(5.0e9-offRes), phase=0)
         #Pulse sequence is X90, delay, X90
         tmpPulseSeq.controlAmps = self.rabiFreq*np.array([[1, 0, 1]], dtype=np.float64)
         tmpPulseSeq.timeSteps = np.array([t90, delay, t90])
         #Interaction frame with some odd frequency
         tmpPulseSeq.H_int = Hamiltonian(np.array([[0,0], [0, 5.00e9]], dtype = np.complex128))
         
         pulseSeqs.append(tmpPulseSeq)
         
     results = simulate_sequence_stack(pulseSeqs, self.systemParams, self.rhoIn, simType='lindblad')[0]
     expectedResults = -np.cos(2*pi*offRes*(delays+t90))*np.exp(-delays/(2*self.qubit.T1))
     if plotResults:
         plt.figure()
         plt.plot(1e6*delays,results)
         plt.plot(1e6*delays, expectedResults, color='r', linestyle='--', linewidth=2)
         plt.title('Ramsey Fringes 0.56789MHz Off-Resonance')
         plt.xlabel('Pulse Spacing (us)')
         plt.ylabel(r'$\sigma_z$')
         plt.legend(('Simulated Results', '0.57MHz Cosine with T1 limited decay.'))
         plt.show()
Exemplo n.º 14
0
    def testRabiRotatingFrame(self):
        '''
        Test Rabi oscillations in the rotating frame, i.e. with zero drift Hamiltonian drive frequency of zero.
        '''

        #Setup the pulseSequences
        pulseSeqs = []
        for pulseLength in self.pulseLengths:
            tmpPulseSeq = PulseSequence()
            tmpPulseSeq.add_control_line(freq=0e9, phase=0)
            tmpPulseSeq.controlAmps = self.rabiFreq * np.array(
                [[1]], dtype=np.float64)
            tmpPulseSeq.timeSteps = np.array([pulseLength])
            tmpPulseSeq.maxTimeStep = pulseLength
            tmpPulseSeq.H_int = None

            pulseSeqs.append(tmpPulseSeq)

        results = simulate_sequence_stack(pulseSeqs,
                                          self.systemParams,
                                          self.rhoIn,
                                          simType='unitary')[0]
        expectedResults = np.cos(2 * pi * self.rabiFreq * self.pulseLengths)
        if plotResults:
            plt.figure()
            plt.plot(self.pulseLengths, results)
            plt.plot(self.pulseLengths,
                     expectedResults,
                     color='r',
                     linestyle='--',
                     linewidth=2)
            plt.title('10MHz Rabi Oscillations in Rotating Frame')
            plt.xlabel('Pulse Length')
            plt.ylabel(r'$\sigma_z$')
            plt.legend(('Simulated Results', '10MHz Cosine'))
            plt.show()

        np.testing.assert_allclose(results, expectedResults, atol=1e-4)
Exemplo n.º 15
0
pulseSeqs = []
pulseTimes = 1e-9*np.arange(4,100, 2)
rhoIn = qubit.levelProjector(0)
for pulseTime in pulseTimes:
    tmpPulseSeq = PulseSequence()
    tmpPulseSeq.add_control_line(freq=0e9, phase=0)
    tmpPulseSeq.add_control_line(freq=0e9, phase=-pi/2)
    pulseAmp = 0.5/pulseTime
    tmpPulseSeq.controlAmps = np.vstack((pulseAmp*np.array([[1]], dtype=np.float64), np.zeros(1)))
    tmpPulseSeq.timeSteps = pulseTime*np.ones(1)
    tmpPulseSeq.H_int = None
    
    pulseSeqs.append(tmpPulseSeq)

SquareResults = simulate_sequence_stack(pulseSeqs, systemParams, rhoIn, simType='lindblad')[0]

plt.figure()
plt.plot(pulseTimes*1e9,SquareResults)


'''
Gaussian Pulse
'''
xPts = np.linspace(-2.5,2.5,100)
gaussPulse = np.exp(-0.5*(xPts**2)) - np.exp(-0.5*2.5**2)
gaussPulse.resize((1,gaussPulse.size))
pulseInt = np.sum(gaussPulse)
pulseSeqs = []
for ct,pulseTime in enumerate(pulseTimes):
    tmpPulseSeq = PulseSequence()
Exemplo n.º 16
0
pulseTimes = 1e-9 * np.arange(4, 100, 2)
rhoIn = qubit.levelProjector(0)
for pulseTime in pulseTimes:
    tmpPulseSeq = PulseSequence()
    tmpPulseSeq.add_control_line(freq=0e9, phase=0)
    tmpPulseSeq.add_control_line(freq=0e9, phase=-pi / 2)
    pulseAmp = 0.5 / pulseTime
    tmpPulseSeq.controlAmps = np.vstack(
        (pulseAmp * np.array([[1]], dtype=np.float64), np.zeros(1)))
    tmpPulseSeq.timeSteps = pulseTime * np.ones(1)
    tmpPulseSeq.H_int = None

    pulseSeqs.append(tmpPulseSeq)

SquareResults = simulate_sequence_stack(pulseSeqs,
                                        systemParams,
                                        rhoIn,
                                        simType='lindblad')[0]

plt.figure()
plt.plot(pulseTimes * 1e9, SquareResults)
'''
Gaussian Pulse
'''
xPts = np.linspace(-2.5, 2.5, 100)
gaussPulse = np.exp(-0.5 * (xPts**2)) - np.exp(-0.5 * 2.5**2)
gaussPulse.resize((1, gaussPulse.size))
pulseInt = np.sum(gaussPulse)
pulseSeqs = []
for ct, pulseTime in enumerate(pulseTimes):
    tmpPulseSeq = PulseSequence()
    tmpPulseSeq.add_control_line(freq=0e9, phase=0)
#    pulseAmps = np.ones((1,1))
#    ampSweep = [0.1]
    
    rabiFreq = 100e6
    
    #Setup the pulseSequences as a series of 10us low-power pulses at different frequencies
    pulseSeqs = []
    for freq in freqSweep:
        for controlAmp in ampSweep:
            tmpPulseSeq = PulseSequence()
            tmpPulseSeq.add_control_line(freq=-freq, phase=0)
            tmpPulseSeq.controlAmps = rabiFreq*controlAmp*pulseAmps
            tmpPulseSeq.timeSteps = 5e-9*np.ones(x.size)
            tmpMat = freq*Q1.numberOp
            tmpPulseSeq.H_int = Hamiltonian(systemParams.expand_operator('Q1', tmpMat) + systemParams.expand_operator('Q2', tmpMat))
        
            pulseSeqs.append(tmpPulseSeq)
    
    results = simulate_sequence_stack(pulseSeqs, systemParams, rhoIn, simType='lindblad')[0]
    results.resize((freqSweep.size, ampSweep.size))
#    plt.plot(freqSweep,results)
#    plt.show()
#    plt.figure()
##    plt.plot(ampSweep, results)
##    plt.xlabel('Frequency')
##    plt.ylabel('Measurement Voltage')
##    plt.title('Two Qubit Bell-Rabi Spectroscopy')
#    plt.imshow(results, extent = [-1, 1, freqSweep[-1], freqSweep[0]], aspect='auto')
#    plt.show()

Exemplo n.º 18
0
    phaseSteps = 2*pi*calScale*timeStep*gaussPulse
    #Optional Z DRAG correction
    # phaseSteps += 1*-0.5*(1/2/pi/qubit.delta)*timeStep*(2*pi*calScale*gaussPulse)**2   

    phaseRamp = np.cumsum(phaseSteps) - phaseSteps/2

    phaseCorrArr.append(np.sum(phaseSteps))
    complexPulse = calScale*(gaussPulse+1j*DRAGPulse)*np.exp(-1j*phaseRamp)
    tmpPulseSeq.controlAmps = np.vstack((complexPulse.real, complexPulse.imag))
    tmpPulseSeq.timeSteps = timeStep*np.ones(numSteps)
    
    pulseSeqs.append(tmpPulseSeq)


results = simulate_sequence_stack(pulseSeqs, systemParams, rhoIn, simType='unitary')



#Single qubit paulis
X = np.array([[0, 1],[1, 0]])
Y = np.array([[0, -1j],[1j, 0]])
Z = np.array([[1, 0],[0, -1]]);
I = np.eye(2)

UgoalQ = expm(-1j*(pi/2)*(1/np.sqrt(2))*(X+Z))
Ugoal = np.zeros((qubit.dim,qubit.dim), dtype=np.complex128)
Ugoal[0:2,0:2] = UgoalQ
#Ugoal = qubit.pauliX

#phaseCorr = pi/np.sqrt(2)
'''


#Setup the pulseSequences to calibrate the cross-resonance gate
pulseSeqs = []

pulseLengths = np.arange(10e-9,500e-9,50e-9)

for pulseLength in pulseLengths:
    tmpPulseSeq = deepcopy(baseSeq)
    tmpPulseSeq.controlAmps = np.hstack((CRGaussOnBlock, CRBlock, CRGaussOffBlock)).copy(order='C')
    tmpPulseSeq.timeSteps = timeStep*np.ones(tmpPulseSeq.controlAmps.shape[1])
    tmpPulseSeq.timeSteps[48] = pulseLength
    pulseSeqs.append(tmpPulseSeq)


for pulseLength in pulseLengths:
    tmpPulseSeq = deepcopy(baseSeq)
    tmpPulseSeq.controlAmps = np.hstack((Q2X180Block, CRGaussOnBlock, CRBlock, CRGaussOffBlock, Q2X180Block)).copy(order='C')
    tmpPulseSeq.timeSteps = timeStep*np.ones(tmpPulseSeq.controlAmps.shape[1])
    tmpPulseSeq.timeSteps[92] = pulseLength
    pulseSeqs.append(tmpPulseSeq)


#result = simulate_sequence(pulseSeqs[0], systemParams, rhoIn, simType='unitary')
results = simulate_sequence_stack(pulseSeqs, systemParams, rhoIn, simType='unitary')