def main(): q1 = QubitFactory('q1') q2 = QubitFactory('q2') q3 = QubitFactory('q3') concurrently(q1, q2, q3)
def main(): q1 = QubitFactory('q1') q2 = QubitFactory('q2') X90(q1) Y90(q2)
def main(): x = QubitFactory("1") y = QubitFactory("2") z = QubitFactory("3") func_a(x, y, z)
def main(): q1 = QubitFactory('q1') q2 = QubitFactory('q2') q3 = QubitFactory('q3') loopy2(q1, q2, q3)
def main(): x = QubitFactory("1") y = QubitFactory("2") z = QubitFactory("3") setup(x, y, z)
def main(): q1 = QubitFactory('q1') q2 = QubitFactory('q2') q3 = QubitFactory('q3') with concur: sequential(q1, q2) sequential(q2, q3)
def main(): q1 = QubitFactory('q1') q2 = QubitFactory('q2') q3 = QubitFactory('q3') X90(q1) Y90(q2) Utheta(q3)
def main(): x = QubitFactory('1') y = QubitFactory('2') z = QubitFactory('3') for q in [x, y, z]: with concur: X(q) Y(q)
def main(): a = QubitFactory("1") b = QubitFactory("2") c = QubitFactory("3") with concur: t1.t1(a, b) t1.t1(b, c) t1.t1(c, a)
def main(): x0 = QubitFactory('q1') x1 = QubitFactory('q2') with concur: while not MEAS(x0): X(x0) while not MEAS(x1): X(x1)
def main(): q1 = QubitFactory("1") q2 = QubitFactory("2") with concur: reset(q1) reset(q2) with concur: X90(q1) X90(q2) with concur: MEAS(q1) MEAS(q2)
def main(): with concur: qbit1 = QubitFactory("1") qbit2 = QubitFactory("2") for nn in [1, 2]: zz(12) # Putting Qubit creation here inside the for loop # is an error, cause it looks like Qubit re-assignment # qbit1 = QubitFactory("1") # qbit2 = QubitFactory("2") x = yy(qbit1) t3(qbit1, qbit2) t3(qbit2, qbit1)
def main(): # Set up 2 qregs, following model in QGL/test/test_Sequences # FIXME: Cannot use these in current QGL2 compiler, because # a: QGL2 doesn't understand creating class instances, and # b: QGL2 currently only understands the fake Qbits # qg1 = LogicalMarkerChannel(label="q1-gate") # q1 = Qubit(label='q1', gate_chan=qg1) # q1.pulse_params['length'] = 30e-9 # q1.pulse_params['phase'] = pi/2 # sTrig = LogicalMarkerChannel(label='slaveTrig') # dTrig = LogicalMarkerChannel(label='digitizerTrig') # Mq1 = ''; # Mq1gate = LogicalMarkerChannel(label='M-q1-gate') # m = Measurement(label='M-q1', gate_chan = Mq1gate, trig_chan = dTrig) # ChannelLibraries.channelLib = ChannelLibraries.ChannelLibrary(blank=True) # ChannelLibraries.channelLib.channelDict = { # 'q1-gate': qg1, # 'q1': q1, # 'slaveTrig': sTrig, # 'digitizerTrig': dTrig, # 'M-q1': m, # 'M-q1-gate': Mq1gate # } # ChannelLibrary.channelLib.build_connectivity_graph() # Use stub Qubits, but comment this out when running directly. q1 = QubitFactory("q1") print("Run InversionRecovery") InversionRecovery(q1, np.linspace(0, 5e-6, 11)) print("Run Ramsey") Ramsey(q1, np.linspace(0, 5e-6, 11))
def bar(): q1 = QubitFactory("1") q2 = QubitFactory("2") with concur: while True: m1 = MEAS(q1) if m1: break else: X(q1) while True: m2 = MEAS(q2) if m2: break else: X(q2)
def main(): x = QubitFactory('q1') for i, j in [(1, 2), (3, 4)]: for k in range(j): if MEAS(x): Xtheta(x, i=i, j=j, k=k)
def main(): x = QubitFactory('q1') for i in range(4): for j in range(4): if i == j: break if MEAS(x): Xtheta(x, i=i, j=j)
def doRamsey(): q = QubitFactory('q1') TPPIFreq=1e6 # FIXME: QGL2 doesn't deal well with the call to np.arange pulseS = [ 1.00000000e-07, 2.00000000e-07, 3.00000000e-07, 4.00000000e-07, 5.00000000e-07, 6.00000000e-07, 7.00000000e-07, 8.00000000e-07, 9.00000000e-07, 1.00000000e-06, 1.10000000e-06, 1.20000000e-06, 1.30000000e-06, 1.40000000e-06, 1.50000000e-06, 1.60000000e-06, 1.70000000e-06, 1.80000000e-06, 1.90000000e-06, 2.00000000e-06, 2.10000000e-06, 2.20000000e-06, 2.30000000e-06, 2.40000000e-06, 2.50000000e-06, 2.60000000e-06, 2.70000000e-06, 2.80000000e-06, 2.90000000e-06, 3.00000000e-06, 3.10000000e-06, 3.20000000e-06, 3.30000000e-06, 3.40000000e-06, 3.50000000e-06, 3.60000000e-06, 3.70000000e-06, 3.80000000e-06, 3.90000000e-06, 4.00000000e-06, 4.10000000e-06, 4.20000000e-06, 4.30000000e-06, 4.40000000e-06, 4.50000000e-06, 4.60000000e-06, 4.70000000e-06, 4.80000000e-06, 4.90000000e-06, 5.00000000e-06, 5.10000000e-06, 5.20000000e-06, 5.30000000e-06, 5.40000000e-06, 5.50000000e-06, 5.60000000e-06, 5.70000000e-06, 5.80000000e-06, 5.90000000e-06, 6.00000000e-06, 6.10000000e-06, 6.20000000e-06, 6.30000000e-06, 6.40000000e-06, 6.50000000e-06, 6.60000000e-06, 6.70000000e-06, 6.80000000e-06, 6.90000000e-06, 7.00000000e-06, 7.10000000e-06, 7.20000000e-06, 7.30000000e-06, 7.40000000e-06, 7.50000000e-06, 7.60000000e-06, 7.70000000e-06, 7.80000000e-06, 7.90000000e-06, 8.00000000e-06, 8.10000000e-06, 8.20000000e-06, 8.30000000e-06, 8.40000000e-06, 8.50000000e-06, 8.60000000e-06, 8.70000000e-06, 8.80000000e-06, 8.90000000e-06, 9.00000000e-06, 9.10000000e-06, 9.20000000e-06, 9.30000000e-06, 9.40000000e-06, 9.50000000e-06, 9.60000000e-06, 9.70000000e-06, 9.80000000e-06, 9.90000000e-06] #pulseSpacings=np.arange(100e-9, 10e-6, 100e-9) # Create the phases for the TPPI phases = 2*pi*TPPIFreq*pulseS # Create the basic Ramsey sequence # FIXME: QGL2 doesn't deal well with this call to zip for d,phase in zip(pulseS, phases): init(q) X90(q) Id(q, d) U90(q, phase=phase) MEAS(q) # Tack on calibration create_cal_seqs((q,), calRepeats)
def main(): # Set up 1 qbit, following model in QGL/test/test_Sequences # FIXME: Cannot use these in current QGL2 compiler, because # a: QGL2 doesn't understand creating class instances, and # b: QGL2 currently only understands the fake Qbits # qg1 = LogicalMarkerChannel(label="q1-gate") # q1 = Qubit(label='q1', gate_chan=qg1) # q1.pulse_params['length'] = 30e-9 # q1.pulse_params['phase'] = pi/2 # Use stub Qubits, but comment this out when running directly. q1 = QubitFactory("q1") SPAM(q1, np.linspace(0, pi/2, 11))
def FlipFlopMin(): # FIXME: No args qubit = QubitFactory('q1') dragParamSweep = np.linspace(0, 5e-6, 11) # FIXME maxNumFFs = 10 # FIXME: cause qubit is a placeholder, can't access pulse_params # originalScaling = qubit.pulse_params['dragScaling'] for dragParam in dragParamSweep: init(qubit) Id(qubit) MEAS(qubit) # FIXME: Need original dragScaling? # FIXME: In original this was [[Id]] + flipflop - is this # right? flipflop_seqs(dragParam, maxNumFFs, qubit) # FIXME: cause qubit is a placeholder, can't access pulse_params # qubit.pulse_params['dragScaling'] = originalScaling # Add a final pi for reference init(qubit) X(qubit) MEAS(qubit)
def test_loops(a: qreg, b: qreg): x = QubitFactory("1") # Next line causes an error - qbit reassignment x = r # Next line is also an error - no d defined v1 = MEAS(d) with concur: while True: v1 = MEAS(d) # There's no qbit1 - another error X90(qbit1) if v1: break while True: v2 = MEAS(b) Y90(qbit2) if v2: break with concur: print('fred')
def main(): q1 = QubitFactory('q1') for _ in range(2): X90(q1)
def main(): q1 = QubitFactory("1") q2 = QubitFactory("2") initq(q1, q2) print("Completed QGL main")
def main(): # Set up 2 qbits, following model in QGL/test/test_Sequences # FIXME: Cannot use these in current QGL2 compiler, because # a: QGL2 doesn't understand creating class instances, and # b: QGL2 currently only understands the fake Qbits # qg1 = LogicalMarkerChannel(label="q1-gate") # q1 = Qubit(label='q1', gate_chan=qg1) # q1.pulse_params['length'] = 30e-9 # q1.pulse_params['phase'] = pi/2 # qg2 = LogicalMarkerChannel(label="q2-gate") # q2 = Qubit(label='q2', gate_chan=qg2) # q2.pulse_params['length'] = 30e-9 # q2.pulse_params['phase'] = pi/2 # sTrig = LogicalMarkerChannel(label='slaveTrig') # dTrig = LogicalMarkerChannel(label='digitizerTrig') # Mq1gate = LogicalMarkerChannel(label='M-q1-gate') # m1 = Measurement(label='M-q1', gate_chan = Mq1gate, trig_chan = dTrig) # Mq2gate = LogicalMarkerChannel(label='M-q2-gate') # m2 = Measurement(label='M-q2', gate_chan = Mq2gate, trig_chan = dTrig) # this block depends on the existence of q1 and q2 # crgate = LogicalMarkerChannel(label='cr-gate') # cr = Edge(label="cr", source = q1, target = q2, gate_chan = crgate ) # cr.pulse_params['length'] = 30e-9 # cr.pulse_params['phase'] = pi/4 # mq1q2g = LogicalMarkerChannel(label='M-q1q2-gate') # m12 = Measurement(label='M-q1q2', gate_chan = mq1q2g, trig_chan=dTrig) # ChannelLibraries.channelLib = ChannelLibraries.ChannelLibrary(blank=True) # ChannelLibraries.channelLib.channelDict = { # 'q1-gate': qg1, # 'q1': q1, # 'q2-gate': qg2, # 'q2': q2, # 'cr-gate': crgate, # 'cr': cr, # 'slaveTrig': sTrig, # 'digitizerTrig': dTrig, # 'M-q1': m1, # 'M-q1-gate': Mq1gate, # 'M-q2': m2, # 'M-q2-gate': Mq2gate, # 'M-q1q2-gate': mq1q2g, # 'M-q1q2': m12 # } # ChannelLibraries.channelLib.build_connectivity_graph() # Use stub Qubits, but comment this out when running directly. q1 = QubitFactory("q1") q2 = QubitFactory("q2") np.random.seed(20152606) # set seed for create_RB_seqs() random.seed(20152606) # set seed for random.choice() SingleQubitRB(q1, create_RB_seqs(1, 2**np.arange(1, 7))) # For some reason this only works if I reverse the 2 qubit args # q2 then q1. Why? # The original unit test had this commeent: """ Fails on APS1, APS2, and Tek7000 due to: File "QGL\PatternUtils.py", line 129, in add_gate_pulses if has_gate(chan) and not pulse.isZero and not (chan.gate_chan AttributeError: 'CompositePulse' object has no attribute 'isZero' """ np.random.seed(20152606) # set seed for create_RB_seqs() TwoQubitRB(q2, q1, create_RB_seqs(2, [2, 4, 8, 16, 32], repeats=16)) np.random.seed(20151709) # set seed for create_RB_seqs seqs1 = create_RB_seqs(1, 2**np.arange(1, 7)) seqs2 = create_RB_seqs(1, 2**np.arange(1, 7)) SimultaneousRB_AC((q1, q2), (seqs1, seqs2)) np.random.seed(20152606) # set seed for create_RB_seqs SingleQubitRB_AC(q1, create_RB_seqs(1, 2**np.arange(1, 7)))
def main(): q1 = QubitFactory('q1') q2 = QubitFactory('q2') loopy3(q1, q2)
def main(): q = QubitFactory("1") func_c(q)
def bar(chan: classical) -> qreg: # This next line gives an error # You can't create a qubit in a return statement # And you can't create a qubit using a variable for the label return QubitFactory(chan)
def runPerfTest(): qubit = QubitFactory('q1') fileName = "ah-1.csv" create_seqs(qubit, fileName)