Exemple #1
0
    def testInversion(self):
        '''
        Try a simple three level SC qubit system and see if can prepare the excited state. 
        '''

        #Setup a three level qubit and a 100MHz delta
        Q1 = SCQubit(3, 4.987456e9, -100e6, name='Q1')
        systemParams = SystemParams()
        systemParams.add_sub_system(Q1)
        systemParams.add_control_ham(
            inphase=Hamiltonian(0.5 * (Q1.loweringOp + Q1.raisingOp)),
            quadrature=Hamiltonian(0.5 *
                                   (-1j * Q1.loweringOp + 1j * Q1.raisingOp)))
        systemParams.create_full_Ham()
        systemParams.measurement = Q1.levelProjector(1)

        #Setup the pulse parameters for the optimization
        pulseParams = PulseParams()
        pulseParams.timeSteps = 1e-9 * np.ones(30)
        pulseParams.rhoStart = Q1.levelProjector(0)
        pulseParams.rhoGoal = Q1.levelProjector(1)
        pulseParams.add_control_line(freq=-Q1.omega)
        pulseParams.H_int = Hamiltonian(Q1.omega * np.diag(np.arange(Q1.dim)))
        pulseParams.optimType = 'state2state'

        #Call the optimization
        optimize_pulse(pulseParams, systemParams)

        #Now test the optimized pulse and make sure it puts all the population in the excited state
        result = simulate_sequence(pulseParams,
                                   systemParams,
                                   pulseParams.rhoStart,
                                   simType='unitary')[0]
        assert result > 0.99
Exemple #2
0
    def testInversion(self):
        '''
        Try a simple three level SC qubit system and see if can prepare the excited state. 
        '''
        
        #Setup a three level qubit and a 100MHz delta 
        Q1 = SCQubit(3, 4.987456e9, -100e6, name='Q1')
        systemParams = SystemParams()
        systemParams.add_sub_system(Q1)
        systemParams.add_control_ham(inphase = Hamiltonian(0.5*(Q1.loweringOp + Q1.raisingOp)), quadrature = Hamiltonian(0.5*(-1j*Q1.loweringOp + 1j*Q1.raisingOp)))
        systemParams.create_full_Ham()
        systemParams.measurement = Q1.levelProjector(1)
        
        
        #Setup the pulse parameters for the optimization
        pulseParams = PulseParams()
        pulseParams.timeSteps = 1e-9*np.ones(30)
        pulseParams.rhoStart = Q1.levelProjector(0)
        pulseParams.rhoGoal = Q1.levelProjector(1)
        pulseParams.add_control_line(freq=-Q1.omega)
        pulseParams.H_int = Hamiltonian(Q1.omega*np.diag(np.arange(Q1.dim)))
        pulseParams.optimType = 'state2state'
        
        #Call the optimization    
        optimize_pulse(pulseParams, systemParams)

        #Now test the optimized pulse and make sure it puts all the population in the excited state
        result = simulate_sequence(pulseParams, systemParams, pulseParams.rhoStart, simType='unitary')[0]
        assert result > 0.99
Exemple #3
0
    def testDRAG(self):
        '''
        Try a unitary inversion pulse on a three level SCQuibt and see if we get something close to DRAG
        '''
        #Setup a three level qubit and a 100MHz delta 
        Q1 = SCQubit(3, 4.987456e9, -150e6, name='Q1')
        systemParams = SystemParams()
        systemParams.add_sub_system(Q1)
        systemParams.add_control_ham(inphase = Hamiltonian(0.5*(Q1.loweringOp + Q1.raisingOp)), quadrature = Hamiltonian(0.5*(-1j*Q1.loweringOp + 1j*Q1.raisingOp)))
        systemParams.add_control_ham(inphase = Hamiltonian(0.5*(Q1.loweringOp + Q1.raisingOp)), quadrature = Hamiltonian(0.5*(-1j*Q1.loweringOp + 1j*Q1.raisingOp)))
        systemParams.create_full_Ham()
        systemParams.measurement = Q1.levelProjector(1)
        
        #Setup the pulse parameters for the optimization
        numPoints = 30
        pulseTime = 15e-9
        pulseParams = PulseParams()
        pulseParams.timeSteps = (pulseTime/numPoints)*np.ones(numPoints)
        pulseParams.rhoStart = Q1.levelProjector(0)
        pulseParams.rhoGoal = Q1.levelProjector(1)
        pulseParams.Ugoal = Q1.pauliX
        pulseParams.add_control_line(freq=-Q1.omega, bandwidth=300e6, maxAmp=200e6)
        pulseParams.add_control_line(freq=-Q1.omega, phase=-np.pi/2, bandwidth=300e6, maxAmp=200e6)
        pulseParams.H_int = Hamiltonian((Q1.omega)*np.diag(np.arange(Q1.dim)))
        pulseParams.optimType = 'unitary'
        pulseParams.derivType = 'finiteDiff'
        
        #Start with a Gaussian
        tmpGauss = np.exp(-np.linspace(-2,2,numPoints)**2)
        tmpScale = 0.5/(np.sum(pulseParams.timeSteps*tmpGauss))
        pulseParams.startControlAmps = np.vstack((tmpScale*tmpGauss, np.zeros(numPoints)))
        
        #Call the optimization    
        optimize_pulse(pulseParams, systemParams)
        
        if plotResults:
            plt.plot(np.cumsum(pulseParams.timeSteps)*1e9,pulseParams.controlAmps.T/1e6);
            plt.ylabel('Pulse Amplitude (MHz)')
            plt.xlabel('Time (ns)')
            plt.legend(('X Quadrature', 'Y Quadrature'))
            plt.title('DRAG Pulse from Optimal Control')
            plt.show()
            

        #Now test the optimized pulse and make sure it does give us the desired unitary
        result = simulate_sequence(pulseParams, systemParams, pulseParams.rhoStart, simType='unitary')
        assert np.abs(np.trace(np.dot(result[1].conj().T, pulseParams.Ugoal)))**2/np.abs(np.trace(np.dot(pulseParams.Ugoal.conj().T, pulseParams.Ugoal)))**2 > 0.99
Exemple #4
0
    def testDRAG(self):
        '''
        Try a unitary inversion pulse on a three level SCQuibt and see if we get something close to DRAG
        '''
        #Setup a three level qubit and a 100MHz delta
        Q1 = SCQubit(3, 4.987456e9, -150e6, name='Q1')
        systemParams = SystemParams()
        systemParams.add_sub_system(Q1)
        systemParams.add_control_ham(
            inphase=Hamiltonian(0.5 * (Q1.loweringOp + Q1.raisingOp)),
            quadrature=Hamiltonian(0.5 *
                                   (-1j * Q1.loweringOp + 1j * Q1.raisingOp)))
        systemParams.add_control_ham(
            inphase=Hamiltonian(0.5 * (Q1.loweringOp + Q1.raisingOp)),
            quadrature=Hamiltonian(0.5 *
                                   (-1j * Q1.loweringOp + 1j * Q1.raisingOp)))
        systemParams.create_full_Ham()
        systemParams.measurement = Q1.levelProjector(1)

        #Setup the pulse parameters for the optimization
        numPoints = 30
        pulseTime = 15e-9
        pulseParams = PulseParams()
        pulseParams.timeSteps = (pulseTime / numPoints) * np.ones(numPoints)
        pulseParams.rhoStart = Q1.levelProjector(0)
        pulseParams.rhoGoal = Q1.levelProjector(1)
        pulseParams.Ugoal = Q1.pauliX
        pulseParams.add_control_line(freq=-Q1.omega,
                                     bandwidth=300e6,
                                     maxAmp=200e6)
        pulseParams.add_control_line(freq=-Q1.omega,
                                     phase=-np.pi / 2,
                                     bandwidth=300e6,
                                     maxAmp=200e6)
        pulseParams.H_int = Hamiltonian(
            (Q1.omega) * np.diag(np.arange(Q1.dim)))
        pulseParams.optimType = 'unitary'
        pulseParams.derivType = 'finiteDiff'

        #Start with a Gaussian
        tmpGauss = np.exp(-np.linspace(-2, 2, numPoints)**2)
        tmpScale = 0.5 / (np.sum(pulseParams.timeSteps * tmpGauss))
        pulseParams.startControlAmps = np.vstack(
            (tmpScale * tmpGauss, np.zeros(numPoints)))

        #Call the optimization
        optimize_pulse(pulseParams, systemParams)

        if plotResults:
            plt.plot(
                np.cumsum(pulseParams.timeSteps) * 1e9,
                pulseParams.controlAmps.T / 1e6)
            plt.ylabel('Pulse Amplitude (MHz)')
            plt.xlabel('Time (ns)')
            plt.legend(('X Quadrature', 'Y Quadrature'))
            plt.title('DRAG Pulse from Optimal Control')
            plt.show()

        #Now test the optimized pulse and make sure it does give us the desired unitary
        result = simulate_sequence(pulseParams,
                                   systemParams,
                                   pulseParams.rhoStart,
                                   simType='unitary')
        assert np.abs(np.trace(np.dot(
            result[1].conj().T, pulseParams.Ugoal)))**2 / np.abs(
                np.trace(np.dot(pulseParams.Ugoal.conj().T,
                                pulseParams.Ugoal)))**2 > 0.99
Exemple #5
0
DRAGResults = simulate_sequence_stack(pulseSeqs,
                                      systemParams,
                                      rhoIn,
                                      simType='lindblad')[0]

plt.plot(pulseTimes * 1e9, DRAGResults)
'''State to State Optimal Control'''
numSteps = 100
pulseTimes = 1e-9 * np.arange(3, 25, 3)
results = np.zeros_like(pulseTimes)
for ct, pulseTime in enumerate(pulseTimes):
    pulseParams = PulseParams()
    pulseParams.timeSteps = (pulseTime / numSteps) * np.ones(numSteps)
    pulseParams.rhoStart = qubit.levelProjector(0)
    pulseParams.rhoGoal = qubit.levelProjector(1)
    pulseParams.add_control_line(freq=0, phase=0)
    pulseParams.add_control_line(freq=0, phase=-pi / 2)
    pulseParams.type = 'state2state'

    #Call the optimization
    optimize_pulse(pulseParams, systemParams)

    #Now test the optimized pulse and make sure it puts all the population in the excited state
    results[ct] = simulate_sequence(pulseParams,
                                    systemParams,
                                    pulseParams.rhoStart,
                                    simType='lindblad')[0]

plt.plot(pulseTimes * 1e9, results, '*')
plt.xlabel('Pulse Time (ns)')
plt.ylabel('Population in First Excited State')
#systemParams.dissipators.append(Dissipator(systemParams.expand_operator('Q2', Q2.T1Dissipator)))
#
##Setup the initial state as the ground state
#rhoIn = np.zeros((systemParams.dim, systemParams.dim))
#rhoIn[0,0] = 1

sampRate = 1.2e9
timeStep = 1.0 / sampRate

drive1Freq = Q1.omega - 1e6
drive2Freq = Q2.omega - 1e6

pulseParams = PulseParams()
pulseParams.timeSteps = timeStep * np.ones(144)
pulseParams.add_control_line(freq=-drive1Freq,
                             phase=0,
                             bandwidth=300e6,
                             maxAmp=100e6)
pulseParams.add_control_line(freq=-drive1Freq,
                             phase=-pi / 2,
                             bandwidth=300e6,
                             maxAmp=100e6)
#pulseParams.add_control_line(freq=-drive1Freq, phase=0)
#pulseParams.add_control_line(freq=-drive1Freq, phase=pi/2)
#pulseParams.add_control_line(freq=-drive2Freq, phase=0, bandwidth=300e6, maxAmp=100e6)
#pulseParams.add_control_line(freq=-drive2Freq, phase=-pi/2, bandwidth=300e6, maxAmp=100e6)
#pulseParams.H_int = Hamiltonian(systemParams.expand_operator('Q1', drive1Freq*Q1.numberOp) + systemParams.expand_operator('Q2', drive2Freq*Q2.numberOp))
pulseParams.optimType = 'unitary'

Q2Goal = np.eye(3, dtype=np.complex128)
Q2Goal[2, 2] = 0
pulseParams.Ugoal = np.kron(Q1.pauliX, Q2Goal)
DRAGResults = simulate_sequence_stack(pulseSeqs, systemParams, rhoIn, simType='lindblad')[0]

plt.plot(pulseTimes*1e9,DRAGResults)


'''State to State Optimal Control'''
numSteps = 100
pulseTimes = 1e-9*np.arange(3,25,3)
results = np.zeros_like(pulseTimes)
for ct, pulseTime in enumerate(pulseTimes): 
    pulseParams = PulseParams()
    pulseParams.timeSteps = (pulseTime/numSteps)*np.ones(numSteps)
    pulseParams.rhoStart = qubit.levelProjector(0)
    pulseParams.rhoGoal = qubit.levelProjector(1)
    pulseParams.add_control_line(freq=0, phase=0)
    pulseParams.add_control_line(freq=0, phase=-pi/2)
    pulseParams.type = 'state2state'

    #Call the optimization    
    optimize_pulse(pulseParams, systemParams)

    #Now test the optimized pulse and make sure it puts all the population in the excited state
    results[ct] = simulate_sequence(pulseParams, systemParams, pulseParams.rhoStart, simType='lindblad')[0]
    
plt.plot(pulseTimes*1e9,results,'*')    
plt.xlabel('Pulse Time (ns)')
plt.ylabel('Population in First Excited State')
plt.title('Excited State Preparation with T1 = {0:.0f}ns'.format(1e9*qubit.T1))
plt.legend(('Square','Gaussian','DRAG','Optimal Control'))
plt.show()