-
Notifications
You must be signed in to change notification settings - Fork 12
/
CR.py
173 lines (151 loc) · 6.37 KB
/
CR.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
from ..PulsePrimitives import *
from ..Compiler import compile_to_hardware
from ..ChannelLibrary import EdgeFactory
from ..PulseSequencePlotter import plot_pulse_files
from .helpers import create_cal_seqs, time_descriptor, cal_descriptor
import numpy as np
def PiRabi(controlQ,
targetQ,
lengths,
riseFall=40e-9,
amp=1,
phase=0,
calRepeats=2,
showPlot=False):
"""
Variable length CX experiment.
Parameters
----------
controlQ : logical channel for the control qubit (LogicalChannel)
targetQ: logical channel for the target qubit (LogicalChannel)
lengths : pulse lengths of the CR pulse to sweep over (iterable)
riseFall : rise/fall time of the CR pulse (s)
amp : amplitude of the CR pulse
phase : phase of the CR pulse (rad)
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',
axis_descriptor=[
time_descriptor(np.concatenate((lengths, lengths))),
cal_descriptor((controlQ, targetQ), calRepeats)
])
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
----------
controlQ : logical channel for the control qubit (LogicalChannel)
targetQ: logical channel for the target qubit (LogicalChannel)
lengths : pulse lengths of the CR pulse to sweep over (iterable)
riseFall : rise/fall time of the CR pulse (s)
amp : amplitude of the CR pulse
phase : phase of the CR pulse (rad)
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, amp=amp, riseFall=riseFall) + [Id(controlQ), MEAS(targetQ)*MEAS(controlQ)]\
for l in lengths]+ [[X(controlQ)] + echoCR(controlQ, targetQ, length=l, phase= phase, amp=amp, 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',
axis_descriptor=[
time_descriptor(np.concatenate((lengths, lengths))),
cal_descriptor((controlQ, targetQ), calRepeats)
])
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
----------
controlQ : logical channel for the control qubit (LogicalChannel)
CRchan: logical channel for the cross-resonance pulse (LogicalChannel)
phases : pulse phases of the CR pulse to sweep over (iterable)
riseFall : rise/fall time of the CR pulse (s)
amp : amplitude of the CR pulse
length : duration of each of the two flat parts of the CR pulse (s)
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, amp=amp, riseFall=riseFall) + [X90(targetQ)*Id(controlQ), MEAS(targetQ)*MEAS(controlQ)] \
for ph in phases]+[[X(controlQ)] + echoCR(controlQ, targetQ, length=length, phase= ph, amp=amp, riseFall = riseFall) + [X90(targetQ)*X(controlQ), MEAS(targetQ)*MEAS(controlQ)]\
for ph in phases]+create_cal_seqs((targetQ,controlQ), calRepeats, measChans=(targetQ,controlQ))
axis_descriptor = [
{
'name': 'phase',
'unit': 'radians',
'points': list(phases)+list(phases),
'partition': 1
},
cal_descriptor((controlQ, targetQ), calRepeats)
]
fileNames = compile_to_hardware(seqs, 'EchoCR/EchoCR',
axis_descriptor=axis_descriptor)
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
----------
controlQ : logical channel for the control qubit (LogicalChannel)
targetQ: logical channel for the target qubit (LogicalChannel)
amps : pulse amplitudes of the CR pulse to sweep over (iterable)
riseFall : rise/fall time of the CR pulse (s)
length : duration of each of the two flat parts of the CR pulse (s)
phase : phase of the CR pulse (rad)
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))
axis_descriptor = [
{
'name': 'amplitude',
'unit': None,
'points': list(amps)+list(amps),
'partition': 1
},
cal_descriptor((controlQ, targetQ), calRepeats)
]
fileNames = compile_to_hardware(seqs, 'EchoCR/EchoCR',
axis_descriptor=axis_descriptor)
print(fileNames)
if showPlot:
plot_pulse_files(fileNames)