Skip to content

Results are limited to the current section : Qoolqit

Error handling

At compilation several error might occur. In this notebook we describe the most common ones, show what are the typical error messages and how to interpret them and explain how to handle them.

# Or use built-in graph patterns
from qoolqit import DataGraph, Register
graph = DataGraph.square(m=2, n=2)
register = Register.from_graph(graph) # 2x2 square lattice
graph.draw()
from qoolqit import Drive
from qoolqit.waveforms import Interpolated, Ramp
# Interpolated waveform: smooth curve through specified values
omega_wf = Interpolated(duration=50, values=[0, 1, 0])
# Ramp waveform
delta_wf = Ramp(duration=50, initial_value=-2, final_value=2)
# Combine into a Drivejupyter kernelspec list
drive = Drive(
amplitude=omega_wf,
detuning=delta_wf
)
drive.draw()
from qoolqit import AnalogDevice, QuantumProgram
program = QuantumProgram(
register=register,
drive=drive
)
device=AnalogDevice()
program.compile_to(device)
program.draw()
program.compiled_sequence.draw()
# Or use built-in graph patterns
from qoolqit import DataGraph, Drive, QuantumProgram, Register
from qoolqit.waveforms import Interpolated, Ramp
def create_program(L,amp,det):
graph = DataGraph.square(m=L, n=L)
register = Register.from_graph(graph) # LxL square lattice
omega_wf = Interpolated(duration=50, values=[0, amp, 0])
delta_wf = Ramp(duration=50, initial_value=-det, final_value=det)
drive = Drive(amplitude=omega_wf, detuning=delta_wf)
return QuantumProgram(register=register,drive=drive)

In this case the compilation routine will try to rescale the register in such a way to maintain the same relative amplitudes of the drive. If the amplitude of the drive is too large, the register may become too large, leading to an overflow error.

from qoolqit.exceptions import CompilationError
L=4
amp=100
det=2
program=create_program(L,amp,det)
try:
compiled_sequence = program.compile_to(device)
except CompilationError as err:
print(err)

We selected an amplitude that is 100 times larger than the maximum atomic pair-wise interaction. The compilation routine automatically attempted to employ the maximum allowed amplitude and rescale the register accordingly: that is in such a way to have the a value of interaction at nearest neighobr that matches the value of the amplitude. In doing so, the register size increased, leading to an overflow error.

L=4
amp=1
det=20
program=create_program(L,amp,det)
try:
compiled_sequence = program.compile_to(device)
except CompilationError as err:
print(err)

We selected a detuning that is 20 times larger than the maximum atomic pair-wise interaction. The compilation routine automatically rescales the amplitude to the maximum allowed value and all the other quantities accordingly. Hence, it rescaled the register and the detuning. This time the register is fitting the device but the detuning value goes beyond the allowed bounds.

L=2
amp=10
det=1
program=create_program(L,amp,det)
try:
compiled_sequence = program.compile_to(device)
except CompilationError as err:
print(err)

The compilation routine automatically rescales the amplitude to the maximum allowed value and all the other quantities accordingly. This means that also the time is rescaled. In particular, as explained in Adimensionalization, when the amplitude is too large to fit the device and it has to be decreased and everything rescaled accordingly, then time is increased. In this case the total duration ended up being longer than the allowed value.