Commit 8ef8a22d authored by Edgar Reehuis's avatar Edgar Reehuis
Browse files

Merge branch '368-replace-qcompile-with-serialcompiler-in-tests-and-documentation' into 'main'

Resolve "Replace qcompile with SerialCompiler in tests and documentation" (#368)

Closes #368

See merge request !529
parents db3fe485 08102ca1
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
- Compilation - Can optionally provide a `QuantumDevice` to `QuantifyCompiler`. This will be used as default `CompilationConfig` in `QuantifyCompiler.compile()` (!535)
- NV centers - Avoid python warning when parsing docstring in nv_element (!562)
- QuantumDevice - `BasicTransmonElement` can now be serialized to json string and deserialized via ``__getstate__/__init__`` (!510)
- Deprecation - Refactored tests to remove deprecated `qcompile`, refactored to `SerialCompiler` (!529, #368)

## 0.10.1 (2022-12-20)

+1 −342

File changed.

Preview size limit exceeded, changes collapsed.

+1 −342
Original line number Diff line number Diff line
{
    "program": "          \n          wait_sync     4                                                    \n          upd_param     4                                                    \n          set_mrk       15         # set markers to 15                       \n          move          0,R0       # Initialize acquisition bin_idx for ch0  \n          wait          4          # latency correction of 4 + 0 ns          \n          move          256,R1     # iterator for loop with label start      \n  start:                                                                     \n          reset_ph                                                           \n          upd_param     4                                                    \n          wait          65532      # auto generated wait (200000 ns)         \n          wait          65532      # auto generated wait (200000 ns)         \n          wait          65532      # auto generated wait (200000 ns)         \n          wait          3404       # auto generated wait (200000 ns)         \n          reset_ph                                                           \n          set_awg_gain  16383,0    # setting gain for Measure q0             \n          play          0,1,4      # play Measure q0 (160 ns)                \n          wait          116        # auto generated wait (116 ns)            \n                                                                             \n          acquire       0,R0,4                                               \n          add           R0,1,R0    # Increment bin_idx for ch0               \n                                                                             \n          wait          65532      # auto generated wait (200316 ns)         \n          wait          65532      # auto generated wait (200316 ns)         \n          wait          65532      # auto generated wait (200316 ns)         \n          wait          3720       # auto generated wait (200316 ns)         \n          reset_ph                                                           \n          set_awg_gain  16383,0    # setting gain for Measure q0             \n          play          0,1,4      # play Measure q0 (160 ns)                \n          wait          116        # auto generated wait (116 ns)            \n                                                                             \n          acquire       0,R0,4                                               \n          add           R0,1,R0    # Increment bin_idx for ch0               \n                                                                             \n          wait          296        # auto generated wait (296 ns)            \n          loop          R1,@start                                            \n          set_mrk       0          # set markers to 0                        \n          upd_param     4                                                    \n          stop                                                               \n",
    "waveforms": {
        "-5025985798879788113": {
            "data": [
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0,
                1.0
            ],
            "index": 0
        },
        "23674677981782374": {
            "data": [
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0
            ],
            "index": 1
        }
    },
    "weights": {},
    "acquisitions": {
        "0": {
            "num_bins": 512,
            "index": 0
        }
    }
}
{"program": "          \n          wait_sync     4                                                    \n          upd_param     4                                                    \n          set_mrk       15         # set markers to 15                       \n          move          0,R0       # Initialize acquisition bin_idx for ch0  \n          wait          4          # latency correction of 4 + 0 ns          \n          move          256,R1     # iterator for loop with label start      \n  start:                                                                     \n          reset_ph                                                           \n          upd_param     4                                                    \n          wait          65532      # auto generated wait (200000 ns)         \n          wait          65532      # auto generated wait (200000 ns)         \n          wait          65532      # auto generated wait (200000 ns)         \n          wait          3404       # auto generated wait (200000 ns)         \n          reset_ph                                                           \n          set_awg_gain  16383,0    # setting gain for Measure q0             \n          play          0,1,4      # play Measure q0 (300 ns)                \n          wait          96         # auto generated wait (96 ns)             \n                                                                             \n          acquire       0,R0,4                                               \n          add           R0,1,R0    # Increment bin_idx for ch0               \n                                                                             \n          wait          65532      # auto generated wait (201016 ns)         \n          wait          65532      # auto generated wait (201016 ns)         \n          wait          65532      # auto generated wait (201016 ns)         \n          wait          4420       # auto generated wait (201016 ns)         \n          reset_ph                                                           \n          set_awg_gain  16383,0    # setting gain for Measure q0             \n          play          0,1,4      # play Measure q0 (300 ns)                \n          wait          96         # auto generated wait (96 ns)             \n                                                                             \n          acquire       0,R0,4                                               \n          add           R0,1,R0    # Increment bin_idx for ch0               \n                                                                             \n          wait          996        # auto generated wait (996 ns)            \n          loop          R1,@start                                            \n          set_mrk       0          # set markers to 0                        \n          upd_param     4                                                    \n          stop                                                               \n", "waveforms": {"-7813320401128183671": {"data": [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.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 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], "index": 1}}, "weights": {}, "acquisitions": {"0": {"num_bins": 512, "index": 0}}}
 No newline at end of file
+15 −12
Original line number Diff line number Diff line
@@ -13,18 +13,17 @@ from typing import Any, Callable, Generator, Dict, List, Optional

import numpy as np
import pytest
from quantify_scheduler.schemas.examples.circuit_to_device_example_cfgs import (
    example_transmon_cfg,
)
from quantify_scheduler.backends.circuit_to_device import DeviceCompilationConfig

from quantify_scheduler import Schedule
from quantify_scheduler.compilation import (
    device_compile,
    qcompile,
)
from quantify_scheduler.backends import SerialCompiler
from quantify_scheduler.backends.circuit_to_device import DeviceCompilationConfig
from quantify_scheduler.compilation import device_compile
from quantify_scheduler.operations.gate_library import CZ, Measure, Reset, X, X90
from quantify_scheduler.resources import ClockResource
from quantify_scheduler.schemas.examples import utils
from quantify_scheduler.schemas.examples.circuit_to_device_example_cfgs import (
    example_transmon_cfg,
)


QBLOX_HARDWARE_MAPPING = utils.load_json_example_scheme("qblox_test_mapping.json")
@@ -146,18 +145,19 @@ def schedule_with_pulse_info(create_schedule_with_pulse_info) -> Schedule:


@pytest.fixture
def compiled_two_qubit_t1_schedule(load_example_transmon_config):
def compiled_two_qubit_t1_schedule(mock_setup_basic_transmon_with_standard_params):
    """
    a schedule performing T1 on two-qubits simultaneously
    """
    device_config = load_example_transmon_config
    mock_setup = mock_setup_basic_transmon_with_standard_params
    mock_setup["q0"].measure.acq_channel(0)
    mock_setup["q1"].measure.acq_channel(1)

    q0, q1 = ("q0", "q1")
    repetitions = 1024
    schedule = Schedule("Multi-qubit T1", repetitions)

    times = np.arange(0, 60e-6, 3e-6)

    for i, tau in enumerate(times):
        schedule.add(Reset(q0, q1), label=f"Reset {i}")
        schedule.add(X(q0), label=f"pi {i} {q0}")
@@ -176,5 +176,8 @@ def compiled_two_qubit_t1_schedule(load_example_transmon_config):
            label=f"Measurement {q1}{i}",
        )

    comp_t1_sched = qcompile(schedule, device_config)
    compiler = SerialCompiler(name="compiler")
    comp_t1_sched = compiler.compile(
        schedule, config=mock_setup["quantum_device"].generate_compilation_config()
    )
    return comp_t1_sched
+10 −5
Original line number Diff line number Diff line
import pytest

from quantify_scheduler import Schedule
from quantify_scheduler.backends import SerialCompiler
from quantify_scheduler.compilation import device_compile, hardware_compile
from quantify_scheduler.operations.shared_native_library import SpectroscopyOperation
from quantify_scheduler.operations.gate_library import Measure, Reset
from quantify_scheduler.operations.nv_native_library import ChargeReset, CRCount
from quantify_scheduler.operations.shared_native_library import SpectroscopyOperation
from quantify_scheduler.schedules.schedule import CompiledSchedule


@@ -152,6 +153,7 @@ def test_compilation_measure_qblox_hardware(mock_setup_basic_nv_qblox_hardware):

    quantum_device = mock_setup_basic_nv_qblox_hardware["quantum_device"]
    quantum_device.get_element("qe0").measure.acq_delay(1e-8)

    dev_cfg = quantum_device.generate_device_config()
    schedule_device = device_compile(schedule, dev_cfg)

@@ -223,7 +225,7 @@ def test_compilation_charge_reset_qblox_hardware(mock_setup_basic_nv_qblox_hardw
    assert schedule_hardware.timing_table.data.loc[0, "is_acquisition"] is False


def test_compilation_cr_count_qblox_hardware(mock_setup_basic_nv_qblox_hardware):
def test_compilation_cr_count_qblox_hardware(mock_setup_basic_nv):
    """cr_count can be compiled to the device layer and to qblox
    instructions.

@@ -239,10 +241,13 @@ def test_compilation_cr_count_qblox_hardware(mock_setup_basic_nv_qblox_hardware)
    # We can plot the circuit diagram
    schedule.plot_circuit_diagram()

    quantum_device = mock_setup_basic_nv_qblox_hardware["quantum_device"]
    quantum_device = mock_setup_basic_nv["quantum_device"]
    quantum_device.get_element("qe0").cr_count.acq_delay(1e-8)
    dev_cfg = quantum_device.generate_device_config()
    schedule_device = device_compile(schedule, dev_cfg)

    compiler = SerialCompiler(name="compiler")
    schedule_device = compiler.compile(
        schedule=schedule, config=quantum_device.generate_compilation_config()
    )

    # The gate_info and acquisition_info remains unchanged, but the pulse info has been
    # added
Loading