diff --git a/QGL/BasicSequences/CR.py b/QGL/BasicSequences/CR.py index ee90c55d..80a27510 100644 --- a/QGL/BasicSequences/CR.py +++ b/QGL/BasicSequences/CR.py @@ -2,7 +2,7 @@ from ..Compiler import compile_to_hardware from ..ChannelLibrary import EdgeFactory from ..PulseSequencePlotter import plot_pulse_files -from .helpers import create_cal_seqs, time_descriptor +from .helpers import create_cal_seqs, time_descriptor, cal_descriptor def PiRabi(controlQ, @@ -38,7 +38,8 @@ def PiRabi(controlQ, create_cal_seqs([targetQ,controlQ], calRepeats, measChans=(targetQ,controlQ)) fileNames = compile_to_hardware(seqs, 'PiRabi/PiRabi', - axis_descriptor=time_descriptor(lengths)) + axis_descriptor=time_descriptor(lengths), + cal_descriptor=cal_descriptor((controlQ, targetQ), calRepeats, len(lengths)+1)) print(fileNames) if showPlot: @@ -72,7 +73,8 @@ def EchoCRLen(controlQ, for l in lengths] + create_cal_seqs((targetQ,controlQ), calRepeats, measChans=(targetQ,controlQ)) fileNames = compile_to_hardware(seqs, 'EchoCR/EchoCR', - axis_descriptor=time_descriptor(lengths)) + axis_descriptor=time_descriptor(lengths), + cal_descriptor=cal_descriptor((controlQ, targetQ), calRepeats, len(lengths)+1)) print(fileNames) if showPlot: @@ -111,7 +113,9 @@ def EchoCRPhase(controlQ, 'points': list(phases) } - fileNames = compile_to_hardware(seqs, 'EchoCR/EchoCR', axis_descriptor=axis_descriptor) + fileNames = compile_to_hardware(seqs, 'EchoCR/EchoCR', + axis_descriptor=axis_descriptor, + cal_descriptor=cal_descriptor((controlQ, targetQ), calRepeats, len(phases)+1)) print(fileNames) if showPlot: @@ -150,7 +154,9 @@ def EchoCRAmp(controlQ, 'points': list(amps) } - fileNames = compile_to_hardware(seqs, 'EchoCR/EchoCR', axis_descriptor=axis_descriptor) + fileNames = compile_to_hardware(seqs, 'EchoCR/EchoCR', + axis_descriptor=axis_descriptor, + cal_descriptor=cal_descriptor((controlQ, targetQ), calRepeats, len(amps)+1)) print(fileNames) if showPlot: diff --git a/QGL/BasicSequences/Decoupling.py b/QGL/BasicSequences/Decoupling.py index 91d4e8f1..a3714314 100644 --- a/QGL/BasicSequences/Decoupling.py +++ b/QGL/BasicSequences/Decoupling.py @@ -1,7 +1,7 @@ from ..PulsePrimitives import * from ..Compiler import compile_to_hardware from ..PulseSequencePlotter import plot_pulse_files -from .helpers import create_cal_seqs, time_descriptor +from .helpers import create_cal_seqs, time_descriptor, cal_descriptor def HahnEcho(qubit, pulseSpacings, periods=0, calRepeats=2, showPlot=False): @@ -29,7 +29,8 @@ def HahnEcho(qubit, pulseSpacings, periods=0, calRepeats=2, showPlot=False): seqs += create_cal_seqs((qubit, ), calRepeats) fileNames = compile_to_hardware(seqs, 'Echo/Echo', - axis_descriptor=time_descriptor(2 * pulseSpacings)) + axis_descriptor=time_descriptor(2 * pulseSpacings), + cal_descriptor=cal_descriptor((qubit,), calRepeats, len(pulseSpacings)+1)) print(fileNames) if showPlot: @@ -65,7 +66,8 @@ def CPMG(qubit, numPulses, pulseSpacing, calRepeats=2, showPlot=False): seqs += create_cal_seqs((qubit, ), calRepeats) fileNames = compile_to_hardware(seqs, 'CPMG/CPMG', - axis_descriptor=time_descriptor(pulseSpacing * numPulses)) + axis_descriptor=time_descriptor(pulseSpacing * numPulses), + cal_descriptor=cal_descriptor((qubit,), calRepeats, len(numPulses)+1)) print(fileNames) if showPlot: diff --git a/QGL/BasicSequences/Rabi.py b/QGL/BasicSequences/Rabi.py index 4fb2dd27..b4dce3ad 100644 --- a/QGL/BasicSequences/Rabi.py +++ b/QGL/BasicSequences/Rabi.py @@ -2,7 +2,7 @@ from ..Compiler import compile_to_hardware from ..PulseSequencePlotter import plot_pulse_files import QGL.PulseShapes -from .helpers import create_cal_seqs, time_descriptor +from .helpers import create_cal_seqs, time_descriptor, cal_descriptor from functools import reduce @@ -114,7 +114,9 @@ def RabiAmp_NQubits(qubits, 'points': list(amps) } - fileNames = compile_to_hardware(seqs, 'Rabi/Rabi', axis_descriptor=axis_descriptor) + fileNames = compile_to_hardware(seqs, 'Rabi/Rabi', + axis_descriptor=axis_descriptor, + cal_descriptor=cal_descriptor(qubits, calRepeats, len(amps)+1) print(fileNames) if showPlot: @@ -208,7 +210,8 @@ def Swap(qubit, mqubit, delays, showPlot=False): measChans=(mqubit, qubit)) fileNames = compile_to_hardware(seqs, 'Rabi/Rabi', - time_descriptor=time_descriptor(delays)) + time_descriptor=time_descriptor(delays), + cal_descriptor=cal_descriptor((mqubit, qubit), 2, len(delays)+1) print(fileNames) if showPlot: diff --git a/QGL/BasicSequences/T1T2.py b/QGL/BasicSequences/T1T2.py index df687c43..e9f1a558 100644 --- a/QGL/BasicSequences/T1T2.py +++ b/QGL/BasicSequences/T1T2.py @@ -2,7 +2,7 @@ from ..Compiler import compile_to_hardware from ..PulseSequencePlotter import plot_pulse_files from scipy.constants import pi -from .helpers import create_cal_seqs, time_descriptor +from .helpers import create_cal_seqs, time_descriptor, cal_descriptor def InversionRecovery(qubit, @@ -31,10 +31,10 @@ def InversionRecovery(qubit, #Tack on the calibration scalings seqs += create_cal_seqs((qubit, ), calRepeats) - fileNames = compile_to_hardware(seqs, 'T1' + - ('_' + qubit.label) * suffix + '/T1' + - ('_' + qubit.label) * suffix, - axis_descriptor=time_descriptor(delays)) + fileNames = compile_to_hardware(seqs, + 'T1' + ('_' + qubit.label) * suffix + '/T1' + ('_' + qubit.label) * suffix, + axis_descriptor=time_descriptor(delays), + cal_descriptor=cal_descriptor((qubit,), calRepeats, len(delays)+1)) print(fileNames) if showPlot: @@ -73,10 +73,10 @@ def Ramsey(qubit, #Tack on the calibration scalings seqs += create_cal_seqs((qubit, ), calRepeats) - fileNames = compile_to_hardware(seqs, 'Ramsey' + - ('_' + qubit.label) * suffix + '/Ramsey' + - ('_' + qubit.label) * suffix, - axis_descriptor=time_descriptor(pulseSpacings)) + fileNames = compile_to_hardware(seqs, + 'Ramsey' + ('_' + qubit.label) * suffix + '/Ramsey' + ('_' + qubit.label) * suffix, + axis_descriptor=time_descriptor(pulseSpacings), + cal_descriptor=cal_descriptor((qubit,), calRepeats, len(pulseSpacings)+1)) print(fileNames) if showPlot: diff --git a/QGL/BasicSequences/helpers.py b/QGL/BasicSequences/helpers.py index 3f117343..aaab37c7 100644 --- a/QGL/BasicSequences/helpers.py +++ b/QGL/BasicSequences/helpers.py @@ -29,6 +29,12 @@ def create_cal_seqs(qubits, numRepeats, measChans=None, waitcmp=False): return [[seq, measBlock, qwait('CMP')] if waitcmp else [seq, measBlock] for seq in calSeqs] +def cal_descriptor(qubits, numRepeats, startIdx): + states = ['0', '1'] + state_set = [reduce(operator.add, s) for s in product(states, repeat=len(qubits))] + descriptor = {state: startIdx + (ct * numRepeats) for ct, state in enumerate(state_set)} + return descriptor + def time_descriptor(times, desired_units="us"): if desired_units == "s": scale = 1