Tutorial: Schedules and Pulses

See also

The complete source code of this tutorial can be found in

Schedules and Pulses.ipynb

The Schedule

The main data structure that describes an experiment in the quantify_scheduler is the Schedule. We will show how the Schedule works through an example.

from quantify_scheduler import Schedule

sched = Schedule("Hello quantum world!")

sched
Schedule "Hello quantum world!" containing (0) 0  (unique) operations.

As we can see, our newly created schedule is still empty. We need to manually add operations to it. In quantify_scheduler there are three types of operations: pulses, acquisitions and gates. All of these have explicit timing control. In this tutorial we will only cover pulses. The goal will not be to make a schedule that is physically meaningful, but to demonstrate the control over the scheduling to its fullest.

While it is possible to define a pulse completely from scratch, we will be using some of the pulse definitions provided with the quantify_scheduler. These pulses are described in the quantify_scheduler.operations.pulse_library submodule. It’s worth noting that no sampling of the data yet occurs at this stage, but the pulse is kept in a parameterized form.

We will add a square pulse from the pulse library to the schedule.

from quantify_scheduler.operations import pulse_library

square_pulse = sched.add(
    pulse_library.SquarePulse(amp=1, duration=1e-6, port="q0:res", clock="q0.ro")
)

sched
Schedule "Hello quantum world!" containing (1) 1  (unique) operations.

You may have noticed that we passed a port and a clock to the pulse. The port specifies the physical location on the quantum chip to which we are sending the pulses, whilst the clock tracks the frequency of the signal (see Ports and clocks). This clock frequency has not yet been defined, so prior to any compilation step this clock needs to be added to the schedule as a resource.

from quantify_scheduler.resources import ClockResource

readout_clock = ClockResource(name="q0.ro", freq=7e9)
sched.add_resource(readout_clock)

sched
Schedule "Hello quantum world!" containing (1) 1  (unique) operations.

quantify_scheduler provides several visualization tools to show a visual representation of the schedule we made. First, however, we need to instruct the scheduler to calculate the pulse timings. We can accomplish this using the determine_absolute_timing() function. In the cell below we call this function and draw the schedule.

Note that these plots are interactive and modulation is not shown by default.

from quantify_scheduler import compilation
from quantify_scheduler.visualization.pulse_diagram import pulse_diagram_plotly

compilation.determine_absolute_timing(sched)
pulse_diagram_plotly(sched)