Convert stitched pulse to numerical (QAE-1037)
Explanation of changes
The function convert_op_with_offsets_to_numerical_pulse has been added, which can be used to convert StitchedPulse to NumericalPulse.
In addition, this function is called in the pulse_diagram plotting functions and the zhinst backend to allow resp. plotting and compiling of StitchedPulse.
There is also a small edit to _replace_long_square_pulses, which was needed because in some cases it wasn't possible to call str() on a converted square pulse anymore. Essentially it's very similar to https://gitlab.com/quantify-os/quantify-scheduler/-/blob/main/quantify_scheduler/backends/corrections.py#L271.
Motivation of changes
The StitchedPulse introduced in !588 (merged) could not be plotted in pulse diagrams, nor compiled for the zhinst backend. This MR fixes that by converting these operations to NumericalPulses.
Merge checklist
See also merge request guidelines
-
Merge request has been reviewed (in-depth by a knowledgeable contributor), and is approved by a project maintainer. -
New code is covered by unit tests (or N/A). -
New code is documented and docstrings use numpydoc format (or N/A). -
New functionality: considered making private instead of extending public API (or N/A). -
Public API changed: added @deprecated(or N/A). -
Tested on hardware (or N/A). -
CHANGELOG.mdandAUTHORS.mdhave been updated (or N/A). -
Windows tests in CI pipeline pass (manually triggered by maintainers before merging).
For reference, the issues workflow is described in the contribution guidelines.