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()
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()
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)
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)
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)
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()
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()
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()
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)
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()
def sim_setup_cython(Hnat, controlHams, controlFields, controlFreqs): systemParams = SystemParams() systemParams.Hnat = Hamiltonian(Hnat) pulseSeq = PulseSequence() pulseSeq.controlAmps = controlFields for ct in range(len(controlHams)): systemParams.add_control_ham(inphase=Hamiltonian(controlHams[ct])) pulseSeq.add_control_line(freq = controlFreqs[ct], phase=0, controlType='sinusoidal') for ct in range(np.int(np.log2(Hnat.shape[0]))): systemParams.add_sub_system(SCQubit(2,0e9, name='Q1', T1=1e-6)) pulseSeq.timeSteps = 0.01*np.ones(controlFields.shape[1]) pulseSeq.maxTimeStep = 1e6 return systemParams, pulseSeq
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)
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)
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()
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()
#Add the T1 dissipator systemParams.dissipators = [Dissipator(qubit.T1Dissipator)] ''' Simple Rabi Driving We'll vary the Rabi power (but always keep the time to a calibrated pi pulse. We expect to see a maximum at some intermediate regime where we have a balance between selectivity and T1 decay ''' 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)
dragCorrection = -0.08*(1.0/Q2.delta)*(4.0/(64.0/1.2e9))*(-xPts*np.exp(-0.5*(xPts**2))) #Calibrates to 21.58MHz Q2Cal = 0.5/(np.sum(gaussPulse)*timeStep) Q2PiBlock = np.zeros((4,numPoints+2*bufferPts)) Q2PiBlock[2,2:-2] = gaussPulse Q2PiBlock[3,2:-2] = dragCorrection Q2PiBlock *= Q2Cal #Setup the pulseSequences to calibrate the optimal control pulse pulseSeqs = [] nutFreqs = np.linspace(0,100e6,50) for nutFreq in nutFreqs: tmpPulseSeq = PulseSequence() tmpPulseSeq.add_control_line(freq=-drive1Freq, initialPhase=0) tmpPulseSeq.add_control_line(freq=-drive1Freq, initialPhase=-pi/2) tmpPulseSeq.add_control_line(freq=-drive2Freq, initialPhase=0) tmpPulseSeq.add_control_line(freq=-drive2Freq, initialPhase=-pi/2) # tmpPulseSeq.controlAmps = np.hstack((Q2PiBlock, nutFreq*jayPulseBlock, Q2PiBlock)) tmpPulseSeq.controlAmps = nutFreq*jayPulseBlock tmpPulseSeq.timeSteps = timeStep*np.ones(tmpPulseSeq.controlAmps.shape[1]) tmpPulseSeq.maxTimeStep = timeStep/4 tmpPulseSeq.H_int = Hamiltonian(systemParams.expand_operator('Q1', drive1Freq*Q1.numberOp) + systemParams.expand_operator('Q2', drive2Freq*Q2.numberOp)) pulseSeqs.append(tmpPulseSeq) results = simulate_sequence_stack(pulseSeqs, systemParams, rhoIn, simType='unitary') #Calibrates to 9.51MHz as expected
#Some parameters for the pulse timeStep = 1/1.2e9 pulseAmps = 250e6*np.linspace(-1,1,81) freqs = np.linspace(4.3e9, 4.9e9,450) numSteps = 160 xPts = np.linspace(-2,2,numSteps) gaussPulse = np.exp(-0.5*(xPts**2)) - np.exp(-0.5*2**2) pulseSeqs = [] for tmpFreq in freqs: for pulseAmp in pulseAmps: tmpPulseSeq = PulseSequence() tmpPulseSeq.add_control_line(freq=-tmpFreq, phase=0) tmpPulseSeq.H_int = Hamiltonian(tmpFreq*qubit.numberOp) tmpPulseSeq.timeSteps = timeStep*np.ones(numSteps) tmpPulseSeq.controlAmps = pulseAmp*gaussPulse pulseSeqs.append(tmpPulseSeq) allResults = simulate_sequence_stack(pulseSeqs, systemParams, rhoIn, simType='unitary') measResults = np.reshape(allResults[0], (pulseAmps.size, freqs.size), order='F') measResults -= np.tile(np.mean(measResults, axis=0), (pulseAmps.size,1)) plt.imshow(measResults, cmap=cm.gray, aspect='auto', interpolation='none', extent=[freqs[0]/1e9, freqs[1]/1e9, pulseAmps[-1], pulseAmps[0]], vmin=-0.02, vmax=0.02) plt.xlabel('Drive Frequency (GHz)') plt.ylabel('Drive Amplitude')
#Define the initial state as the ground state rhoIn = qubit.levelProjector(0) #Some parameters for the pulse timeStep = 1 / 1.2e9 pulseAmps = 250e6 * np.linspace(-1, 1, 81) freqs = np.linspace(4.3e9, 4.9e9, 450) numSteps = 160 xPts = np.linspace(-2, 2, numSteps) gaussPulse = np.exp(-0.5 * (xPts**2)) - np.exp(-0.5 * 2**2) pulseSeqs = [] for tmpFreq in freqs: for pulseAmp in pulseAmps: tmpPulseSeq = PulseSequence() tmpPulseSeq.add_control_line(freq=-tmpFreq, phase=0) tmpPulseSeq.H_int = Hamiltonian(tmpFreq * qubit.numberOp) tmpPulseSeq.timeSteps = timeStep * np.ones(numSteps) tmpPulseSeq.controlAmps = pulseAmp * gaussPulse pulseSeqs.append(tmpPulseSeq) allResults = simulate_sequence_stack(pulseSeqs, systemParams, rhoIn, simType='unitary') measResults = np.reshape(allResults[0], (pulseAmps.size, freqs.size), order='F') measResults -= np.tile(np.mean(measResults, axis=0), (pulseAmps.size, 1))
#Setup the system systemParams = SystemParams() qubit = SCQubit(2, 0e9, delta=200e6, name='Q1', T1=1e-6) systemParams.add_sub_system(qubit) systemParams.add_control_ham(inphase = Hamiltonian(0.5*(qubit.loweringOp + qubit.raisingOp)), quadrature = Hamiltonian(0.5*(-1j*qubit.loweringOp + 1j*qubit.raisingOp))) systemParams.add_control_ham(inphase = Hamiltonian(0.5*(qubit.loweringOp + qubit.raisingOp)), quadrature = Hamiltonian(0.5*(-1j*qubit.loweringOp + 1j*qubit.raisingOp))) systemParams.measurement = qubit.pauliZ systemParams.create_full_Ham() #Define the initial state as the ground state rhoIn = qubit.levelProjector(0) #First the basic sequence basePulseSeq = PulseSequence() basePulseSeq.add_control_line(freq=0e9, phase=0) basePulseSeq.add_control_line(freq=0e9, phase=pi/2) basePulseSeq.H_int = None #Some parameters for the pulse timeStep = 1.0/1.2e9 #How many discrete timesteps to break it up into stepsArray = np.arange(12,61) # stepsArray = np.arange(24,121) ''' Test a square Hadamard pulse. '''
numPoints = 48 xPts = np.linspace(0,3,numPoints) CRAmp = 200e6 halfGauss = CRAmp*np.exp(-0.5*xPts**2) CRGaussOnBlock = np.zeros((2*numChannels,numPoints)); CRGaussOnBlock[4] = halfGauss[-1::-1] CRGaussOffBlock = np.zeros((2*numChannels,numPoints)); CRGaussOffBlock[4] = halfGauss CRBlock = np.array([0,0,0,0,1,0]).reshape(2*numChannels,1) CRBlock *= CRAmp; baseSeq = PulseSequence() baseSeq.add_control_line(freq=-drive1Freq, phase=0) baseSeq.add_control_line(freq=-drive1Freq, phase=-pi/2) baseSeq.add_control_line(freq=-drive2Freq, phase=0) baseSeq.add_control_line(freq=-drive2Freq, phase=-pi/2) baseSeq.add_control_line(freq=-drive1Freq, phase=0) baseSeq.add_control_line(freq=-drive1Freq, phase=-pi/2) baseSeq.maxTimeStep = timeStep/4 baseSeq.H_int = Hamiltonian(systemParams.expand_operator('Q1', drive1Freq*Q1.numberOp) + systemParams.expand_operator('Q2', drive2Freq*Q2.numberOp)) ''' #Look at the all XY set of experiments pulseSeqs = []
dragCorrection = -0.08 * (1.0 / Q2.delta) * (4.0 / (64.0 / 1.2e9)) * ( -xPts * np.exp(-0.5 * (xPts**2))) #Calibrates to 21.58MHz Q2Cal = 0.5 / (np.sum(gaussPulse) * timeStep) Q2PiBlock = np.zeros((4, numPoints + 2 * bufferPts)) Q2PiBlock[2, 2:-2] = gaussPulse Q2PiBlock[3, 2:-2] = dragCorrection Q2PiBlock *= Q2Cal #Setup the pulseSequences to calibrate the optimal control pulse pulseSeqs = [] nutFreqs = np.linspace(0, 100e6, 50) for nutFreq in nutFreqs: tmpPulseSeq = PulseSequence() tmpPulseSeq.add_control_line(freq=-drive1Freq, initialPhase=0) tmpPulseSeq.add_control_line(freq=-drive1Freq, initialPhase=-pi / 2) tmpPulseSeq.add_control_line(freq=-drive2Freq, initialPhase=0) tmpPulseSeq.add_control_line(freq=-drive2Freq, initialPhase=-pi / 2) # tmpPulseSeq.controlAmps = np.hstack((Q2PiBlock, nutFreq*jayPulseBlock, Q2PiBlock)) tmpPulseSeq.controlAmps = nutFreq * jayPulseBlock tmpPulseSeq.timeSteps = timeStep * np.ones( tmpPulseSeq.controlAmps.shape[1]) tmpPulseSeq.maxTimeStep = timeStep / 4 tmpPulseSeq.H_int = Hamiltonian( systemParams.expand_operator('Q1', drive1Freq * Q1.numberOp) + systemParams.expand_operator('Q2', drive2Freq * Q2.numberOp)) pulseSeqs.append(tmpPulseSeq) results = simulate_sequence_stack(pulseSeqs,
systemParams.create_full_Ham() #Add the T1 dissipator systemParams.dissipators = [Dissipator(qubit.T1Dissipator)] ''' Simple Rabi Driving We'll vary the Rabi power (but always keep the time to a calibrated pi pulse. We expect to see a maximum at some intermediate regime where we have a balance between selectivity and T1 decay ''' 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]
#First run 1D spectroscopy around the Bell-Rabi drive frequency freqSweep = 1e9*np.linspace(5.02, 5.040, 20) # freqSweep = [5.023e9] ampSweep = np.linspace(-1,1,80) x = np.linspace(-2,2,100) pulseAmps = (np.exp(-x**2)).reshape((1,x.size)) # 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')
systemParams.add_control_ham( inphase=Hamiltonian(0.5 * (qubit.loweringOp + qubit.raisingOp)), quadrature=Hamiltonian(0.5 * (-1j * qubit.loweringOp + 1j * qubit.raisingOp))) systemParams.add_control_ham( inphase=Hamiltonian(0.5 * (qubit.loweringOp + qubit.raisingOp)), quadrature=Hamiltonian(0.5 * (-1j * qubit.loweringOp + 1j * qubit.raisingOp))) systemParams.measurement = qubit.pauliZ systemParams.create_full_Ham() #Define the initial state as the ground state rhoIn = qubit.levelProjector(0) #First the basic sequence basePulseSeq = PulseSequence() basePulseSeq.add_control_line(freq=0e9, phase=0) basePulseSeq.add_control_line(freq=0e9, phase=pi / 2) basePulseSeq.H_int = None #Some parameters for the pulse timeStep = 1.0 / 1.2e9 #How many discrete timesteps to break it up into stepsArray = np.arange(12, 61) # stepsArray = np.arange(24,121) ''' Test a square Hadamard pulse. ''' #Setup the pulseSequences #pulseSeqs = []