Skip to content

Commit

Permalink
Fix tutorial code
Browse files Browse the repository at this point in the history
  • Loading branch information
nkanazawa1989 committed Jan 10, 2024
1 parent e0129d2 commit dcedd4f
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions docs/manuals/characterization/t1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,10 @@ that is close to a logical value '0'.
mu = 1e-6

# qubit properties
t1 = [45 * mu, 45 * mu]
t2 = [value/2 for value in t1]
t1 = 45 * mu

# we will guess that our guess is 10% off the exact value of t1 for qubit 0.
t1_estimated_shift = t1[0]/10
t1_estimated_shift = t1/10

# We use log space for the delays because of the noise properties
delays = np.logspace(1, 11, num=23, base=np.exp(1))
Expand All @@ -111,25 +110,28 @@ that is close to a logical value '0'.
# Adding circuits with delay=0 and long delays so the centers in the IQ plane won't be misplaced.
# Without this, the fitting can provide wrong results.
delays = np.insert(delays, 0, 0)
delays = np.append(delays, [t1[0]*3])
delays = np.append(delays, [t1*3])

num_qubits = 2
num_shots = 2048

backend = MockIQBackend(
MockIQT1Helper(t1=t1, iq_cluster_centers=[((-5.0, -4.0), (-5.0, 4.0)), ((3.0, 1.0), (5.0, -3.0))]
, iq_cluster_width=[1.0, 2.0])
MockIQT1Helper(
t1=t1,
iq_cluster_centers=[((-5.0, -4.0), (-5.0, 4.0)), ((3.0, 1.0), (5.0, -3.0))],
iq_cluster_width=[1.0, 2.0],
)
)

# Creating a T1 experiment
expT1_kerneled = T1((0,), delays)
expT1_kerneled.analysis = T1KerneledAnalysis()
expT1_kerneled.analysis.set_options(p0={"amp": 1, "tau": t1[0] + t1_estimated_shift, "base": 0})
expT1_kerneled.analysis.set_options(p0={"amp": 1, "tau": t1 + t1_estimated_shift, "base": 0})

# Running the experiment
expdataT1_kerneled = expT1_kerneled.run(backend=backend, meas_return="avg",
meas_level=MeasLevel.KERNELED,
shots=num_shots).block_for_results()
expdataT1_kerneled = expT1_kerneled.run(
backend=backend, meas_return="avg", meas_level=MeasLevel.KERNELED, shots=num_shots
).block_for_results()

# Displaying results
display(expdataT1_kerneled.figure(0))
Expand Down

0 comments on commit dcedd4f

Please sign in to comment.