Commit f7475e73 authored by Adriaan's avatar Adriaan
Browse files

Merge branch '102_schedule_modified' into 'develop'

Prevent schedule from being modified when using qcompile

See merge request !178
parents 8451e342 a2f22450
Loading
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -5,6 +5,10 @@ Changelog
Unreleased
----------





Breaking changes
~~~~~~~~~~~~~~~~
* Mixer corrections in Qblox backend are broken because of the switch to real-time modulation. The support of mixer corrections in the Qblox firmware is under development.
@@ -13,6 +17,10 @@ Merged branches and closed issues
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Docs - Added bibliography with sphinxcontrib-bibtex extension (!171)
* Qblox Backend - Added support for qblox_instruments version 0.4.0 (new acquisition path). (!143)
* Docs - Fixed missing files in API reference (!176)
* InstrumentCoordinator - CompiledSchedule class added to specify interfaces of InstrumentCoordinator and compilation functions (#174, !177)
* Compilation - qcompile no longer modifies schedules (#102, !178)


0.4.0 InstrumentCoordinator and improvements to backends (2021-08-06)
---------------------------------------------------------------------
+4 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
from __future__ import annotations
import importlib
import logging
from copy import deepcopy
from typing_extensions import Literal

import jsonschema
@@ -390,6 +391,9 @@ def qcompile(

        Add a schema for the hardware config.
    """
    # to prevent the original input schedule from being modified.
    schedule = deepcopy(schedule)

    schedule = device_compile(schedule=schedule, device_cfg=device_cfg)
    schedule = determine_absolute_timing(schedule=schedule, time_unit="physical")

+3 −3
Original line number Diff line number Diff line
@@ -424,9 +424,9 @@ class ScheduleBase(JSONSchemaValMixin, UserDict, ABC):
        The time can be specified with respect to a reference point (:code:`"ref_pt"')
        on the reference operation (:code:`"ref_op"`) and a reference point on the next
        added operation (:code:`"ref_pt_new"').
        A reference point can be either the "start", "center", or "end" of an operations.
        The reference operation (:code:`"ref_op"`) is specified using its label
        property.
        A reference point can be either the "start", "center", or "end" of an
        operation. The reference operation (:code:`"ref_op"`) is specified using its
        label property.

        Each item in the list represents a timing constraint and is a dictionary with
        the following keys:
+21 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ import inspect
import json
import os

from copy import deepcopy
import numpy as np
import pytest
import quantify_scheduler.schemas.examples as examples
@@ -207,3 +208,23 @@ def test_resource_resolution():

    sched.add_resources([qcm0_s0, qrm0_s0])
    sched = qcompile(sched, DEVICE_CFG)


def test_schedule_modified():
    q0, q1 = ("q0", "q1")

    ref_label_1 = "my_label"
    sched = Schedule("Test experiment")
    sched.add(Reset(q0, q1))
    sched.add(Rxy(90, 0, qubit=q0), label=ref_label_1)
    sched.add(Rxy(theta=90, phi=0, qubit=q0))
    sched.add(Measure(q0, q1), label="M0")

    copy_of_sched = deepcopy(sched)
    # to verify equality of schedule object works
    assert copy_of_sched == sched

    _ = qcompile(sched, DEVICE_CFG)

    # Fails if schedule is modified
    assert copy_of_sched == sched