QGL2 RabiWidth


Compiling a QGL2 RabiWidth and plotting the output


In [ ]:
# Using phase=0, amp=0, shapeFun=tanh, length: 0 to 5e-6 in 11 steps

Imports


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 QGL.PulseShapes
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 compiled QGL1 to file
rWidthWidths = np.linspace(0, 5e-6, 11)
qgl1MainFunc = compile_function("../src/python/qgl2/basic_sequences/Rabi.py", "RabiWidth", 
                                (q, rWidthWidths, 1, 0, QGL.PulseShapes.tanh), 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
axis_desc = [delay_descriptor(rWidthWidths)]
label = "Rabi"

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 [ ]:
display(plot_pulse_files(metaFileName))