Skip to content

Commit

Permalink
🎨 format all files with
Browse files Browse the repository at this point in the history
  • Loading branch information
caryan committed Jul 10, 2016
1 parent 3970877 commit d7b4501
Show file tree
Hide file tree
Showing 37 changed files with 4,182 additions and 3,161 deletions.
25 changes: 16 additions & 9 deletions QGL/BasicSequences/AllXY.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@
import QGL.PulseShapes
from .helpers import create_cal_seqs

def AllXY(q, showPlot = False):
firstPulses = [Id(q)] + 2*[X(q), Y(q)] + 3*[X90(q), Y90(q)] + [X(q), Y(q), X90(q), X(q), Y90(q), Y(q), X(q), Y(q), X90(q), Y90(q)]
secondPulses = [Id(q), X(q), Y(q), Y(q), X(q), Id(q), Id(q), Y90(q), X90(q), Y(q), X(q), Y90(q), X90(q), X(q), X90(q), Y(q), Y90(q), Id(q), Id(q), X90(q), Y90(q)]
seqs=[]
seqs += [[firstPulses[int(np.floor(ind/2))], secondPulses[int(np.floor(ind/2))], MEAS(q)] for ind in range(42)]

filenames = compile_to_hardware(seqs, 'AllXY/AllXY')
print(filenames)
def AllXY(q, showPlot=False):
firstPulses = [Id(q)] + 2 * [X(q), Y(q)] + 3 * [X90(q), Y90(q)] + [
X(q), Y(q), X90(q), X(q), Y90(q), Y(q), X(q), Y(q), X90(q), Y90(q)
]
secondPulses = [Id(q), X(q), Y(q), Y(q), X(q), Id(q), Id(q), Y90(q),
X90(q), Y(q), X(q), Y90(q), X90(q), X(q), X90(q), Y(q),
Y90(q), Id(q), Id(q), X90(q), Y90(q)]
seqs = []
seqs += [[firstPulses[int(np.floor(ind / 2))],
secondPulses[int(np.floor(ind / 2))], MEAS(q)]
for ind in range(42)]

if showPlot:
plot_pulse_files(filenames)
filenames = compile_to_hardware(seqs, 'AllXY/AllXY')
print(filenames)

if showPlot:
plot_pulse_files(filenames)
23 changes: 12 additions & 11 deletions QGL/BasicSequences/BlankingSweeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from ..PulsePrimitives import *
from ..Compiler import compile_to_hardware


def sweep_gateDelay(qubit, sweepPts):
"""
Sweep the gate delay associated with a qubit channel using a simple Id, Id, X90, X90
Expand All @@ -14,20 +15,20 @@ def sweep_gateDelay(qubit, sweepPts):
qubit : logical qubit to create sequences for
sweepPts : iterable to sweep the gate delay over.
"""



generator = qubit.physChan.generator
oldDelay = generator.gateDelay

for ct, delay in enumerate(sweepPts):
seqs = [[Id(qubit, length=120e-9), Id(qubit), MEAS(qubit)],
[Id(qubit, length=120e-9), MEAS(qubit)],
[Id(qubit, length=120e-9), X90(qubit), MEAS(qubit)],
[Id(qubit, length=120e-9), X90(qubit), MEAS(qubit)]]
[Id(qubit, length=120e-9), MEAS(qubit)],
[Id(qubit, length=120e-9), X90(qubit), MEAS(qubit)],
[Id(qubit, length=120e-9), X90(qubit), MEAS(qubit)]]

generator.gateDelay = delay

compile_to_hardware(seqs, 'BlankingSweeps/GateDelay', suffix='_{}'.format(ct+1))

generator.gateDelay = oldDelay

compile_to_hardware(seqs,
'BlankingSweeps/GateDelay',
suffix='_{}'.format(ct + 1))

generator.gateDelay = oldDelay
136 changes: 83 additions & 53 deletions QGL/BasicSequences/CR.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@
from ..PulseSequencePlotter import plot_pulse_files
from .helpers import create_cal_seqs

def PiRabi(controlQ, targetQ, lengths, riseFall=40e-9, amp=1, phase=0, calRepeats=2, showPlot=False):
"""

def PiRabi(controlQ,
targetQ,
lengths,
riseFall=40e-9,
amp=1,
phase=0,
calRepeats=2,
showPlot=False):
"""
Variable length CX experiment.
Parameters
Expand All @@ -19,25 +27,32 @@ def PiRabi(controlQ, targetQ, lengths, riseFall=40e-9, amp=1, phase=0, calRepeat
showPlot : whether to plot (boolean)
"""

CRchan = EdgeFactory(controlQ, targetQ)
seqs = [[Id(controlQ),
flat_top_gaussian(CRchan, riseFall, amp=amp, phase=phase, length=l),
MEAS(targetQ)*MEAS(controlQ)] for l in lengths] + \
[[X(controlQ),
flat_top_gaussian(CRchan, riseFall, amp=amp, phase=phase, length=l),
X(controlQ),
MEAS(targetQ)*MEAS(controlQ)] for l in lengths] + \
create_cal_seqs([targetQ,controlQ], calRepeats, measChans=(targetQ,controlQ))

fileNames = compile_to_hardware(seqs, 'PiRabi/PiRabi')
print(fileNames)

if showPlot:
plot_pulse_files(fileNames)


def EchoCRLen(controlQ, targetQ, lengths, riseFall=40e-9, amp=1, phase=0, calRepeats=2, showPlot=False):
"""
CRchan = EdgeFactory(controlQ, targetQ)
seqs = [[Id(controlQ),
flat_top_gaussian(CRchan, riseFall, amp=amp, phase=phase, length=l),
MEAS(targetQ)*MEAS(controlQ)] for l in lengths] + \
[[X(controlQ),
flat_top_gaussian(CRchan, riseFall, amp=amp, phase=phase, length=l),
X(controlQ),
MEAS(targetQ)*MEAS(controlQ)] for l in lengths] + \
create_cal_seqs([targetQ,controlQ], calRepeats, measChans=(targetQ,controlQ))

fileNames = compile_to_hardware(seqs, 'PiRabi/PiRabi')
print(fileNames)

if showPlot:
plot_pulse_files(fileNames)


def EchoCRLen(controlQ,
targetQ,
lengths,
riseFall=40e-9,
amp=1,
phase=0,
calRepeats=2,
showPlot=False):
"""
Variable length CX experiment, with echo pulse sandwiched between two CR opposite-phase pulses.
Parameters
Expand All @@ -51,19 +66,26 @@ def EchoCRLen(controlQ, targetQ, lengths, riseFall=40e-9, amp=1, phase=0, calRep
calRepeats : number of repetitions of readout calibrations for each 2-qubit state
showPlot : whether to plot (boolean)
"""
seqs = [[Id(controlQ)] + echoCR(controlQ, targetQ, length=l, phase=phase, riseFall=riseFall) + [Id(controlQ), MEAS(targetQ)*MEAS(controlQ)]\
for l in lengths]+ [[X(controlQ)] + echoCR(controlQ, targetQ, length=l, phase= phase, riseFall=riseFall) + [X(controlQ), MEAS(targetQ)*MEAS(controlQ)]\
for l in lengths] + create_cal_seqs((targetQ,controlQ), calRepeats, measChans=(targetQ,controlQ))

fileNames = compile_to_hardware(seqs, 'EchoCR/EchoCR')
print(fileNames)

if showPlot:
plot_pulse_files(fileNames)


def EchoCRPhase(controlQ, targetQ, phases, riseFall=40e-9, amp=1, length=100e-9, calRepeats=2, showPlot=False):
"""
seqs = [[Id(controlQ)] + echoCR(controlQ, targetQ, length=l, phase=phase, riseFall=riseFall) + [Id(controlQ), MEAS(targetQ)*MEAS(controlQ)]\
for l in lengths]+ [[X(controlQ)] + echoCR(controlQ, targetQ, length=l, phase= phase, riseFall=riseFall) + [X(controlQ), MEAS(targetQ)*MEAS(controlQ)]\
for l in lengths] + create_cal_seqs((targetQ,controlQ), calRepeats, measChans=(targetQ,controlQ))

fileNames = compile_to_hardware(seqs, 'EchoCR/EchoCR')
print(fileNames)

if showPlot:
plot_pulse_files(fileNames)


def EchoCRPhase(controlQ,
targetQ,
phases,
riseFall=40e-9,
amp=1,
length=100e-9,
calRepeats=2,
showPlot=False):
"""
Variable phase CX experiment, with echo pulse sandwiched between two CR opposite-phase pulses.
Parameters
Expand All @@ -77,18 +99,26 @@ def EchoCRPhase(controlQ, targetQ, phases, riseFall=40e-9, amp=1, length=100e-9,
calRepeats : number of repetitions of readout calibrations for each 2-qubit state
showPlot : whether to plot (boolean)
"""
seqs = [[Id(controlQ)] + echoCR(controlQ, targetQ, length=length, phase=ph, riseFall=riseFall) + [X90(targetQ)*Id(controlQ), MEAS(targetQ)*MEAS(controlQ)] \
for ph in phases]+[[X(controlQ)] + echoCR(controlQ, targetQ, length=length, phase= ph, riseFall = riseFall) + [X90(targetQ)*X(controlQ), MEAS(targetQ)*MEAS(controlQ)]\
for ph in phases]+create_cal_seqs((targetQ,controlQ), calRepeats, measChans=(targetQ,controlQ))

fileNames = compile_to_hardware(seqs, 'EchoCR/EchoCR')
print(fileNames)

if showPlot:
plot_pulse_files(fileNames)

def EchoCRAmp(controlQ, targetQ, amps, riseFall=40e-9, length=50e-9, phase=0, calRepeats=2, showPlot=False):
"""
seqs = [[Id(controlQ)] + echoCR(controlQ, targetQ, length=length, phase=ph, riseFall=riseFall) + [X90(targetQ)*Id(controlQ), MEAS(targetQ)*MEAS(controlQ)] \
for ph in phases]+[[X(controlQ)] + echoCR(controlQ, targetQ, length=length, phase= ph, riseFall = riseFall) + [X90(targetQ)*X(controlQ), MEAS(targetQ)*MEAS(controlQ)]\
for ph in phases]+create_cal_seqs((targetQ,controlQ), calRepeats, measChans=(targetQ,controlQ))

fileNames = compile_to_hardware(seqs, 'EchoCR/EchoCR')
print(fileNames)

if showPlot:
plot_pulse_files(fileNames)


def EchoCRAmp(controlQ,
targetQ,
amps,
riseFall=40e-9,
length=50e-9,
phase=0,
calRepeats=2,
showPlot=False):
"""
Variable amplitude CX experiment, with echo pulse sandwiched between two CR opposite-phase pulses.
Parameters
Expand All @@ -102,12 +132,12 @@ def EchoCRAmp(controlQ, targetQ, amps, riseFall=40e-9, length=50e-9, phase=0, ca
calRepeats : number of repetitions of readout calibrations for each 2-qubit state
showPlot : whether to plot (boolean)
"""
seqs = [[Id(controlQ)] + echoCR(controlQ, targetQ, length=length, phase=phase, riseFall=riseFall,amp=a) + [Id(controlQ), MEAS(targetQ)*MEAS(controlQ)]\
for a in amps]+ [[X(controlQ)] + echoCR(controlQ, targetQ, length=length, phase= phase, riseFall=riseFall,amp=a) + [X(controlQ), MEAS(targetQ)*MEAS(controlQ)]\
for a in amps] + create_cal_seqs((targetQ,controlQ), calRepeats, measChans=(targetQ,controlQ))
seqs = [[Id(controlQ)] + echoCR(controlQ, targetQ, length=length, phase=phase, riseFall=riseFall,amp=a) + [Id(controlQ), MEAS(targetQ)*MEAS(controlQ)]\
for a in amps]+ [[X(controlQ)] + echoCR(controlQ, targetQ, length=length, phase= phase, riseFall=riseFall,amp=a) + [X(controlQ), MEAS(targetQ)*MEAS(controlQ)]\
for a in amps] + create_cal_seqs((targetQ,controlQ), calRepeats, measChans=(targetQ,controlQ))

fileNames = compile_to_hardware(seqs, 'EchoCR/EchoCR')
print(fileNames)
fileNames = compile_to_hardware(seqs, 'EchoCR/EchoCR')
print(fileNames)

if showPlot:
plot_pulse_files(fileNames)
if showPlot:
plot_pulse_files(fileNames)
50 changes: 26 additions & 24 deletions QGL/BasicSequences/Decoupling.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
from ..PulseSequencePlotter import plot_pulse_files
from .helpers import create_cal_seqs

def HahnEcho(qubit, pulseSpacings, periods = 0, calRepeats=2, showPlot=False):
"""

def HahnEcho(qubit, pulseSpacings, periods=0, calRepeats=2, showPlot=False):
"""
A single pulse Hahn echo with variable phase of second pi/2 pulse.
Parameters
Expand All @@ -19,23 +20,23 @@ def HahnEcho(qubit, pulseSpacings, periods = 0, calRepeats=2, showPlot=False):
-------
plotHandle : handle to plot window to prevent destruction
"""
seqs=[];
for k in range(len(pulseSpacings)):
seqs.append([X90(qubit), Id(qubit, pulseSpacings[k]), Y(qubit), Id(qubit,pulseSpacings[k]), \
U90(qubit,phase=2*pi*periods/len(pulseSpacings)*k), MEAS(qubit)])
seqs = []
for k in range(len(pulseSpacings)):
seqs.append([X90(qubit), Id(qubit, pulseSpacings[k]), Y(qubit), Id(qubit,pulseSpacings[k]), \
U90(qubit,phase=2*pi*periods/len(pulseSpacings)*k), MEAS(qubit)])

#Tack on the calibration scalings
seqs += create_cal_seqs((qubit,), calRepeats)
#Tack on the calibration scalings
seqs += create_cal_seqs((qubit, ), calRepeats)

fileNames = compile_to_hardware(seqs, 'Echo/Echo')
print(fileNames)
fileNames = compile_to_hardware(seqs, 'Echo/Echo')
print(fileNames)

if showPlot:
plot_pulse_files(fileNames)
if showPlot:
plot_pulse_files(fileNames)


def CPMG(qubit, numPulses, pulseSpacing, calRepeats=2, showPlot=False):
"""
"""
CPMG pulse train with fixed pulse spacing. Note this pulse spacing is centre to centre,
i.e. it accounts for the pulse width
Expand All @@ -51,18 +52,19 @@ def CPMG(qubit, numPulses, pulseSpacing, calRepeats=2, showPlot=False):
-------
plotHandle : handle to plot window to prevent destruction
"""
#First setup the t-180-t block
CPMGBlock = [Id(qubit, (pulseSpacing-qubit.pulseParams['length'])/2),
Y(qubit), Id(qubit, (pulseSpacing-qubit.pulseParams['length'])/2)]

seqs = [[X90(qubit)] + CPMGBlock*rep + [X90(qubit), MEAS(qubit)] for rep in numPulses]
#First setup the t-180-t block
CPMGBlock = [Id(qubit, (pulseSpacing - qubit.pulseParams['length']) / 2),
Y(qubit),
Id(qubit, (pulseSpacing - qubit.pulseParams['length']) / 2)]

#Tack on the calibration scalings
seqs += create_cal_seqs((qubit,), calRepeats)
seqs = [[X90(qubit)] + CPMGBlock * rep + [X90(qubit), MEAS(qubit)]
for rep in numPulses]

fileNames = compile_to_hardware(seqs, 'CPMG/CPMG')
print(fileNames)
#Tack on the calibration scalings
seqs += create_cal_seqs((qubit, ), calRepeats)

if showPlot:
plot_pulse_files(fileNames)
fileNames = compile_to_hardware(seqs, 'CPMG/CPMG')
print(fileNames)

if showPlot:
plot_pulse_files(fileNames)
Loading

0 comments on commit d7b4501

Please sign in to comment.