Skip to content

Feedback and support

Join us in our QUA Discord server discord. You are welcome to ask questions, suggest features and share your experience!

Serializing QUA Programs

Generating a serialized version of a QUA program can be very helpful in debugging your code and control flow. Serialization will resolve Python control flow, make parametrization explicit, and transform your program into a standardized format.

It is possible to serialize a QUA program and a config file using these commands:

from qm import generate_qua_script

qmm = QuantumMachinesManager(...)  # Optional - Used for config validation

config = {}

with program() as prog:
    ...

sourceFile = open('debug.py', 'w')
print(generate_qua_script(prog, config), file=sourceFile) 
sourceFile.close()

This code will create a file, debug.py, which is a standalone runnable serialized QUA program.