QGL2 RabiPulsedSpec


Compiling a QGL2 Rabi PulsedSpec and plotting the output

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

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

To turn on debug output, uncomment the next 4 lines


In [ ]:
#from pyqgl2.ast_util import NodeError
#from pyqgl2.debugmsg import DebugMsg

#DebugMsg.set_level(1)
#NodeError.MUTE_ERR_LEVEL = NodeError.NODE_ERROR_NONE

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
qgl1MainFunc = compile_function("../src/python/qgl2/basic_sequences/Rabi.py", "PulsedSpec", (q, True))

Generate pulse sequences


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

Compile to machine instructions


In [ ]:
metaFileName = qgl2_compile_to_hardware(seqs, "Spec/Spec")
print(f"Generated sequence details in '{metaFileName}'")

Plot the sequences


In [ ]:
display(plot_pulse_files(metaFileName))