Note
This is the documentation for the current state of the development branch of Qiskit Experiments. The documentation or APIs here can change prior to being released.
T2 Hahn Characterization¶
The purpose of the
In this experiment, we would like to get a more precise estimate of the qubit’s decay
time. T2Ramsey
,
The difference between the Hahn Echo and CPMG sequence is that in the Hahn Echo experiment, there is only one echo sequence while in CPMG there are multiple echo sequences.
Decoherence Time¶
The decoherence time is the time taken for off-diagonal components of the
density matrix to fall to approximately 37% (
Since the qubit is exposed to other types of noise (like T1), we are
using
import qiskit
from qiskit_experiments.library.characterization.t2hahn import T2Hahn
The circuit used for an experiment with
gate times echo sequence: gate gate gate
gate (sign depends on the number of echoes)Measurement gate
The user provides as input a series of delays in seconds. During the
delay, we expect the qubit to precess about the z-axis. Because of the
echo gate (
qubit = 0
conversion_factor = 1e-6 # our delay will be in micro-sec
delays = list(range(0, 51, 5) )
# Round so that the delay gates in the circuit display does not have trailing 9999's
delays = [round(float(_) * conversion_factor, ndigits=6) for _ in delays]
number_of_echoes = 1
# Create a T2Hahn experiment. Print the first circuit as an example
exp1 = T2Hahn(physical_qubits=(qubit,), delays=delays, num_echoes=number_of_echoes)
print(exp1.circuits()[1])
┌─────────┐┌───────────────────┐┌───────┐┌───────────────────┐┌─────────┐»
q: ┤ Rx(π/2) ├┤ Delay(2.5e-06[s]) ├┤ Rx(π) ├┤ Delay(2.5e-06[s]) ├┤ Rx(π/2) ├»
└─────────┘└───────────────────┘└───────┘└───────────────────┘└─────────┘»
c: 1/═════════════════════════════════════════════════════════════════════════»
»
« ┌─┐
« q: ┤M├
« └╥┘
«c: 1/═╩═
« 0
We run the experiment on a simple simulated backend tailored specifically for this experiment.
from qiskit_experiments.test.t2hahn_backend import T2HahnBackend
estimated_t2hahn = 20 * conversion_factor
# The behavior of the backend is determined by the following parameters
backend = T2HahnBackend(
t2hahn=[estimated_t2hahn],
frequency=[100100],
initialization_error=[0.0],
readout0to1=[0.02],
readout1to0=[0.02],
)
The resulting graph will have the form:
exp1.analysis.set_options(p0=None, plot=True)
expdata1 = exp1.run(backend=backend, shots=2000, seed_simulator=101)
expdata1.block_for_results() # Wait for job/analysis to finish.
# Display the figure
display(expdata1.figure(0))

# Print results
display(expdata1.analysis_results(dataframe=True))
name | experiment | components | value | quality | backend | run_time | chisq | unit | |
---|---|---|---|---|---|---|---|---|---|
8d0f44dd | T2 | T2Hahn | [Q0] | (2.11+/-0.16)e-05 | good | T2Hahn_simulator | None | 1.062618 | s |
Providing initial user estimates¶
The user can provide initial estimates for the parameters to help the
analysis process. In the initial guess, the keys {amp, tau, base}
correspond to the parameters {A, T_2, B}
respectively. Because the
curve is expected to decay toward 1
is t2hahn
is the parameter of interest. A good estimate for it is the
value computed in previous experiments on this qubit or a similar value
computed for other qubits.
exp_with_p0 = T2Hahn(physical_qubits=(qubit,), delays=delays, num_echoes=number_of_echoes)
exp_with_p0.analysis.set_options(p0={"amp": 0.5, "tau": estimated_t2hahn, "base": 0.5})
expdata_with_p0 = exp_with_p0.run(backend=backend, shots=2000, seed_simulator=101)
expdata_with_p0.block_for_results()
# Display fit figure
display(expdata_with_p0.figure(0))

# Print results
display(expdata_with_p0.analysis_results(dataframe=True))
name | experiment | components | value | quality | backend | run_time | chisq | unit | |
---|---|---|---|---|---|---|---|---|---|
ad1e02c8 | T2 | T2Hahn | [Q0] | (2.11+/-0.16)e-05 | good | T2Hahn_simulator | None | 1.062618 | s |
Number of echoes¶
The user can provide the number of echoes that the circuit will perform.
This will determine the amount of delay and echo gates.
The echoes
decrease the effects of 0
echoes and 1
echo. The analysis should
fail for the circuit with 0
echoes. In order to see it, we will add
frequency to the qubit and see how it affect the estimated
import numpy as np
qubit2 = 0
num_echoes = 1
estimated_t2hahn2 = 30e-6
# Create a T2Hahn experiment with 0 echoes
exp2_0echoes = T2Hahn((qubit2,), delays, num_echoes=0)
exp2_0echoes.analysis.set_options(p0={"amp": 0.5, "tau": estimated_t2hahn2, "base": 0.5})
print("The second circuit of hahn echo experiment with 0 echoes:")
print(exp2_0echoes.circuits()[1])
# Create a T2Hahn experiment with 1 echo. Print the first circuit as an example
exp2_1echoes = T2Hahn((qubit2,), delays, num_echoes=num_echoes)
exp2_1echoes.analysis.set_options(p0={"amp": 0.5, "tau": estimated_t2hahn2, "base": 0.5})
print("The second circuit of hahn echo experiment with 1 echo:")
print(exp2_1echoes.circuits()[1])
The second circuit of hahn echo experiment with 0 echoes:
┌─────────┐┌─────────────────┐┌──────────┐┌─┐
q: ┤ Rx(π/2) ├┤ Delay(5e-06[s]) ├┤ Rx(-π/2) ├┤M├
└─────────┘└─────────────────┘└──────────┘└╥┘
c: 1/═══════════════════════════════════════════╩═
0
The second circuit of hahn echo experiment with 1 echo:
┌─────────┐┌───────────────────┐┌───────┐┌───────────────────┐┌─────────┐»
q: ┤ Rx(π/2) ├┤ Delay(2.5e-06[s]) ├┤ Rx(π) ├┤ Delay(2.5e-06[s]) ├┤ Rx(π/2) ├»
└─────────┘└───────────────────┘└───────┘└───────────────────┘└─────────┘»
c: 1/═════════════════════════════════════════════════════════════════════════»
»
« ┌─┐
« q: ┤M├
« └╥┘
«c: 1/═╩═
« 0
from qiskit_experiments.test.t2hahn_backend import T2HahnBackend
detuning_frequency = 2 * np.pi * 10000
# The behavior of the backend is determined by the following parameters
backend2 = T2HahnBackend(
t2hahn=[estimated_t2hahn2],
frequency=[detuning_frequency],
initialization_error=[0.0],
readout0to1=[0.02],
readout1to0=[0.02],)
# Analysis for Hahn Echo experiment with 0 echoes.
expdata2_0echoes = exp2_0echoes.run(backend=backend2, shots=2000, seed_simulator=101)
expdata2_0echoes.block_for_results() # Wait for job/analysis to finish.
# Analysis for Hahn Echo experiment with 1 echo
expdata2_1echoes = exp2_1echoes.run(backend=backend2, shots=2000, seed_simulator=101)
expdata2_1echoes.block_for_results() # Wait for job/analysis to finish.
# Display the figure
print("Hahn Echo with 0 echoes:")
display(expdata2_0echoes.figure(0))
print("Hahn Echo with 1 echo:")
display(expdata2_1echoes.figure(0))
Hahn Echo with 0 echoes:

Hahn Echo with 1 echo:

We see that the estimate
See also¶
API documentation:
T2Hahn