Add method to sample Schedule

Explanation of changes

Add method to sample a Schedule. A minimal example is:

    from quantify_scheduler.types import Schedule
    from quantify_scheduler.pulse_library import SquarePulse
    from quantify_scheduler.compilation import determine_absolute_timing
    import matplotlib.pyplot as plt

    schedule = Schedule("test")
    r = SquarePulse(amp=0.2, duration=20e-9, port="SDP")
    schedule.add(r)
    rm = SquarePulse(amp=-0.2, duration=20e-9, port="T")
    schedule.add(rm, ref_pt="start")
    r = SquarePulse(amp=0.3, duration=20e-9, port="SDP")
    schedule.add(r)
    schedule.add(r)
    determine_absolute_timing(schedule=schedule)

    timestamps, waveforms = sample_schedule(schedule, sampling_rate=0.5e9)

    plt.figure(10)
    plt.clf()
    for port in waveforms:
        plt.plot(timestamps, waveforms[port], ".-", label=port)
    plt.legend()

image

@caenrigen @AdriaanRol

Motivation of changes

This is a refactor of the plotly visualization code. There are several corner cases to handle (overlapping waveforms, waveforms not aligned to samplerate, floating point errors in selection of timestamps), but these are hard to decide since I have no formal definition of a Schedule (and it's properties).


Merge checklist

See also merge request guidelines

  • Merge request has been reviewed and approved by a project maintainer.
  • Merge request contains a clear description of the proposed changes and the issue it addresses.
  • Merge request made onto appropriate branch (develop for most MRs).
  • New code is fully tested.
  • New code is documented and docstrings use numpydoc format.
  • CHANGELOG.rst and AUTHORS.rst have been updated (when applicable).
  • CI pipelines pass
    • black code-formatting passes (gitlab-ci),
    • test suite passes (gitlab-ci),
    • no degradation in code-coverage (codacy),
    • no (serious) new pylint code quality issues introduced (codacy),
    • documentation builds successfully (CI and readthedocs),
    • windows tests pass (manually triggered by maintainers before merging).

For reference, the issues workflow is described in the contribution guidelines.

Edited by Luis Miguens Fernandez

Merge request reports

Loading