QGL2 Ramsey

Compiling a QGL2 Ramsey and plotting the output

In [ ]:
# Using pulseSpacings=np.arange(100e-9, 10e-6, 100e-9); 100ns to 10us step by 100ns
# TTPIFreq=1e6; 1Mhz


In [ ]:
from pyqgl2.main import compile_function, qgl2_compile_to_hardware
from pyqgl2.test_cl import create_default_channelLibrary
from pyqgl2.qreg import QRegister
from QGL import plot_pulse_files, ChannelLibrary
import numpy as np

Create a test ChannelLibrary

In [ ]:
create_default_channelLibrary(True, True)
# Alternatively could load an existing library, or create one here; see the 'AllXY' notebook

Create needed qubit(s)

In [ ]:
# For QGL2, use a QRegister, not a QGL Qubit
q = QRegister(1)

Compile QGL2 to QGL1

In [ ]:
# Insert proper path to QGL2 source and name of qgl2main if not so marked
# Here we compile the named function in the named file from QGL2 to QGL1 and return the new function
# True argument means save the QGL1 compiled function to a file

In [ ]:
rSpacings = np.linspace(0, 5e-6, 11)
tCalR = 2
qgl1MainFunc = compile_function("../src/python/qgl2/basic_sequences/T1T2.py", "Ramsey", 
                                (q,rSpacings, 0, tCalR), saveOutput=True)

Generate pulse sequences

In [ ]:
# Now run the QGL1 function, producing a list of sequences
seqs = qgl1MainFunc()

Compile to machine instructions

In [ ]:
from qgl2.basic_sequences.helpers import delay_descriptor, cal_descriptor
axis_desc = [            
    cal_descriptor(('qubit',), tCalR)
label = "Ramsey"
# Include the qbit name in the filename
label += "_q1"

metaFileName = qgl2_compile_to_hardware(seqs, filename=f"{label}/{label}", axis_descriptor=axis_desc)
print(f"Generated sequence details in '{metaFileName}'")

Plot the sequences

In [ ]: