Skip to content

Commit

Permalink
Remove labels from Barriers.
Browse files Browse the repository at this point in the history
  • Loading branch information
blakejohnson committed Apr 11, 2017
1 parent 66d23e7 commit dced4de
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 38 deletions.
12 changes: 6 additions & 6 deletions src/python/qgl2/basic_sequences/CRMin.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def doPiRabi():
init(qr)
Id(qr[0])
flat_top_gaussian_edge(qr[0], qr[1], riseFall, amp=amp, phase=phase, length=l)
Barrier("", (qr,))
Barrier((qr,))
MEAS(qr)

# Sequence 2: X(control), gaussian(l), X(control), measure both
Expand All @@ -34,7 +34,7 @@ def doPiRabi():
X(qr[0])
flat_top_gaussian_edge(qr[0], qr[1], riseFall, amp=amp, phase=phase, length=l)
X(qr[0])
Barrier("", (qr,))
Barrier((qr,))
MEAS(qr)

# Then do calRepeats calibration sequences
Expand All @@ -58,7 +58,7 @@ def doEchoCRLen():
echoCR(qr[0], qr[1], length=l, phase=phase,
riseFall=riseFall)
Id(qr[0])
Barrier("", (qr,))
Barrier((qr,))
MEAS(qr)

# Sequence 2
Expand All @@ -68,7 +68,7 @@ def doEchoCRLen():
echoCR(qr[0], qr[1], length=l, phase=phase,
riseFall=riseFall)
X(qr[0])
Barrier("", (qr,))
Barrier((qr,))
MEAS(qr)

# Then do calRepeats calibration sequences
Expand All @@ -93,7 +93,7 @@ def doEchoCRPhase():
riseFall=riseFall)
X90(qr[1])
Id(qr[0])
Barrier("", (qr,))
Barrier((qr,))
MEAS(qr)

# Sequence 2
Expand All @@ -104,7 +104,7 @@ def doEchoCRPhase():
riseFall=riseFall)
X90(qr[1])
X(qr[0])
Barrier("", (qr,))
Barrier((qr,))
MEAS(qr)

# Then do calRepeats calibration sequences
Expand Down
2 changes: 1 addition & 1 deletion src/python/qgl2/basic_sequences/RabiMin.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def doSwap(qr:qbit, delays):
init(qr)
X(qr)
Id(qr[1], length=d)
Barrier("", (qr,))
Barrier((qr,))
MEAS(qr)

create_cal_seqs(qr, 2)
2 changes: 1 addition & 1 deletion src/python/qgl2/basic_sequences/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ def create_cal_seqs(qubits: qbit, numRepeats):
init(qubits)
for pulse, qubit in zip(pulseSet, qubits):
pulse(qubit)
Barrier("", (qubits,))
Barrier((qubits,))
MEAS(qubits)
6 changes: 2 additions & 4 deletions src/python/qgl2/qgl1.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,9 @@ def Sync() -> control:

# This function is QGL1 but only for use by QGL2
@qgl2stub('qgl2.qgl1control')
def Barrier(ctr, chanlist) -> control:
# ctr - global counter of barriers to line them up
def Barrier(chanlist: qbit_list) -> control:
# chanlist is list of channels that are waiting here
# chanlist must be enough to produce some later wait on specific channels
print('Barrier(%s, %s)' % (ctr, chanlist))
print('Barrier(%s)' % (chanlist))

@qgl2stub('QGL.ControlFlow')
def Store(dest, source) -> control:
Expand Down
10 changes: 3 additions & 7 deletions src/python/qgl2/qgl1control.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,12 @@
# or a Sync then a Wait if the block is of indeterminate length.
class Barrier(ControlInstruction):
# chanlist is a list of Channel instances
# ctr is an opaque string, unique per channel
# (but appearing once for the program for each channel
# in chanlist)
def __init__(self, ctr, chanlist):
super(Barrier, self).__init__("BARRIER", value=ctr)
def __init__(self, chanlist):
super(Barrier, self).__init__("BARRIER")
# Consider adding a start/end marker,
# to help line up barriers across sequences.
self.chanlist = chanlist

def __str__(self):
base = super(Barrier, self).__str__()
base += " on Channels: %s" % str(self.chanlist)
base = "BARRIER({0})".format(self.chanlist)
return base
12 changes: 6 additions & 6 deletions test/code/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def multiQbitTest2():

Id(qs)
X(qs)
Barrier("", (qs,))
Barrier((qs,))
MEAS(qs)

@qgl2decl
Expand All @@ -36,7 +36,7 @@ def anotherMulti():
qs = QRegister(2)
Id(qs)
X(qs)
Barrier("", (qs,))
Barrier((qs,))
MEAS(qs)
Y(qs)

Expand All @@ -46,9 +46,9 @@ def anotherMulti2():
qsub = QRegister(qs[0], qs[1])
Id(qsub)
X(qs[0:2]) # equivalent to calling with qsub argument
Barrier("", (qs,))
Barrier((qs,))
MEAS(qsub)
Barrier("", (qs,))
Barrier((qs,))
Y(qs[0])
Y(qs[2])

Expand All @@ -59,8 +59,8 @@ def anotherMulti3():
qsub = QRegister(qs[0:2])
Id(qsub)
X(qsub)
Barrier("", (qs,))
Barrier((qs,))
MEAS(qsub)
Barrier("", (qs,))
Barrier((qs,))
Y(qs[0])
Y(qs[2])
4 changes: 2 additions & 2 deletions test/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def get_cal_seqs_1qubit(qubit, calRepeats=2):
calSeq += [
qwait(),
pulse(qubit),
Barrier("", (qubit,)),
Barrier((qubit,)),
MEAS(qubit)
]
return calSeq
Expand All @@ -324,7 +324,7 @@ def get_cal_seqs_2qubits(q1, q2, calRepeats=2):
qwait(),
pulseSet[0](q1),
pulseSet[1](q2),
Barrier("", (q1, q2)),
Barrier((q1, q2)),
MEAS(q1),
MEAS(q2)
]
Expand Down
14 changes: 7 additions & 7 deletions test/test_basic_mins.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def test_PiRabi(self):
qwait(),
Id(controlQ),
flat_top_gaussian(edge, riseFall, length=l, amp=amp, phase=phase),
Barrier("", (controlQ, targetQ)),
Barrier((controlQ, targetQ)),
MEAS(controlQ),
MEAS(targetQ)
]
Expand All @@ -147,7 +147,7 @@ def test_PiRabi(self):
X(controlQ),
flat_top_gaussian(edge, riseFall, length=l, amp=amp, phase=phase),
X(controlQ),
Barrier("", (controlQ, targetQ)),
Barrier((controlQ, targetQ)),
MEAS(controlQ),
MEAS(targetQ)
]
Expand Down Expand Up @@ -185,7 +185,7 @@ def test_EchoCRLen(self):
echoCR(controlQ, targetQ, length=l, phase=phase,
riseFall=riseFall),
Id(controlQ),
Barrier("", (controlQ, targetQ)),
Barrier((controlQ, targetQ)),
MEAS(controlQ),
MEAS(targetQ)
]
Expand All @@ -198,7 +198,7 @@ def test_EchoCRLen(self):
echoCR(controlQ, targetQ, length=l, phase=phase,
riseFall=riseFall),
X(controlQ),
Barrier("", (controlQ, targetQ)),
Barrier((controlQ, targetQ)),
MEAS(controlQ),
MEAS(targetQ)
]
Expand Down Expand Up @@ -236,7 +236,7 @@ def test_EchoCRPhase(self):
riseFall=riseFall),
X90(targetQ),
Id(controlQ),
Barrier("", (controlQ, targetQ)),
Barrier((controlQ, targetQ)),
MEAS(controlQ),
MEAS(targetQ)
]
Expand All @@ -251,7 +251,7 @@ def test_EchoCRPhase(self):
riseFall=riseFall),
X90(targetQ),
X(controlQ),
Barrier("", (controlQ, targetQ)),
Barrier((controlQ, targetQ)),
MEAS(controlQ),
MEAS(targetQ)
]
Expand Down Expand Up @@ -558,7 +558,7 @@ def test_Swap(self):
X(q),
X(mq),
Id(mq, length=d),
Barrier("", (q, mq)),
Barrier((q, mq)),
MEAS(q),
MEAS(mq)
]
Expand Down
8 changes: 4 additions & 4 deletions test/test_multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_multiQbitTest2(self):
Id(q2),
X(q1),
X(q2),
Barrier("", (q1, q2)),
Barrier((q1, q2)),
MEAS(q1),
MEAS(q2)
]
Expand Down Expand Up @@ -58,7 +58,7 @@ def test_anotherMulti(self):
Id(q2),
X(q1),
X(q2),
Barrier("", (q1, q2)),
Barrier((q1, q2)),
MEAS(q1),
MEAS(q2),
Y(q1),
Expand All @@ -84,10 +84,10 @@ def test_anotherMulti2(self):
Id(q2),
X(q1),
X(q2),
Barrier("", (q1, q2, q3)),
Barrier((q1, q2, q3)),
MEAS(q1),
MEAS(q2),
Barrier("", (q1, q2, q3)),
Barrier((q1, q2, q3)),
Y(q1),
Y(q3)
]
Expand Down

0 comments on commit dced4de

Please sign in to comment.