Visualization API#
Plotting needs matplotlib, from the [viz] extra:
pip install "cudaq-pulse[viz]". ScheduledKernel.timeline(figsize=, title=)
calls plot_schedule on a compiled module.
- cudaq_pulse.viz.plot_schedule(schedule, figsize=(14, 4), title=None)[source]#
Plot a pulse schedule timeline, one row per drive or readout line.
The links of classical calls get rows of their own, below the lines: a bar while a request is sent and a marker where its answer is taken.
- Parameters:
schedule (ScheduledKernel | Sequence[ScheduledEvent]) – A compiled kernel call (
kernel.lower(...)) or itsschedule.figsize (tuple[float, float]) – Figure size (width, height).
title (str | None) – Optional figure title.
- Returns:
matplotlib Figure.
- Return type:
Figure
- cudaq_pulse.viz.save_schedule(schedule, path, *, figsize=(14, 4), title=None)[source]#
Plot a schedule as
plot_scheduledoes and save it to a file.The extension of path picks the format (
.png,.svg,.pdfand the others matplotlib writes). The file is written at 150 dpi, and the figure is closed afterwards.- Parameters:
schedule (ScheduledKernel | Sequence[ScheduledEvent]) – A compiled kernel call (
kernel.lower(...)) or itsschedule.path (str | os.PathLike[str]) – The file to write.
figsize (tuple[float, float]) – Figure size (width, height).
title (str | None) – Optional figure title.
- Return type:
None