Skip to main content


The CPMG sequence is a dynamical decoupling scripts (see [1]) .

We follow the pulse sequence outlined in [2] and implement a macro for this pulse sequence.

def CPMG(tau):
half_tau = tau / 2
wait(half_tau, "qe1")
play("Y", "qe1")
wait(tau, "qe1")
play("Y", "qe1")
wait(half_tau, "qe1")


The system implements one control quantum element qe1 and one readout quantum element rr


We nest an averaging loop and a delay loop which goes over tau values.

with for_(n, 0, n < NAVG, n + 1):
with for_each_(tau, tau_vec):
align("qe1", "rr")
demod.full("integW1", I),
demod.full("integW2", Q))
save(I, out_str)
with if_(I > th):
save(s1, out_str)
with else_():
save(s0, out_str)
wait(10 * t1, "qe1")

Post processing#



download script


[1] Wang, Z. H., De Lange, G., Ristè, D., Hanson, R., & Dobrovitski, V. V. (2012). Comparison of dynamical decoupling protocols for a nitrogen-vacancy center in diamond. Physical Review B - Condensed Matter and Materials Physics, 85(15), 1–16.[2] Ali Ahmed, M. A., Álvarez, G. A., & Suter, D. (2013). Robustness of dynamical decoupling sequences. Physical Review A - Atomic, Molecular, and Optical Physics, 87(4), 1–6.