{ "cells": [ { "cell_type": "markdown", "id": "b6034398", "metadata": {}, "source": [ "(hardware-verfication-tutorial)=\n", "\n", "# Tutorial: Zhinst hardware verification\n", "\n", "``````{seealso}\n", "The complete source code of this tutorial can be found in\n", "\n", "{nb-download}`T_verification_programs.ipynb`\n", "\n", "``````" ] }, { "cell_type": "code", "execution_count": 1, "id": "6cc97237", "metadata": { "mystnb": { "remove_code_source": true } }, "outputs": [], "source": [ "# Make output easier to read\n", "from rich import pretty\n", "\n", "pretty.install()" ] }, { "cell_type": "markdown", "id": "943211cf", "metadata": {}, "source": [ "## Introduction\n", "\n", "This tutorial gives an overview of how to use the {mod}`~quantify_scheduler.backends.zhinst_backend` for quantify-scheduler.\n", "The example we follow in this notebook corresponds to a standard circuit QED measurement setup in which readout is performed by generating a pulse on a UFHQA, send to the device and the returning signal is measured in transmission using the same UFHQA, and an HDAWG is then used to generate the control pulses.\n", "We set up this test setup so that it is easy to verify the hardware is behaving correctly and that it can be used for real experiments with minimal modifications.\n", "\n", "In {ref}`how to connect ` we discuss how to set up the test setup, connect all the cables, and use quantify to connect to the hardware.\n", "In {ref}`how to configure ` we discuss how to write a hardware configuration file that can be used to compile instructions for the Zurich Instruments hardware.\n", "In {ref}`verification programs ` we go over how to write and compile several verification programs, how to verify that these are correct, and how to execute these on the physical hardware.\n", "\n", "(sec-zhinst-how-to-connect)=\n", "\n", "## How to connect\n", "\n", "```{note}\n", "This documentation is a work in progress. See issue #237.\n", "Improvements to this tutorial will include adding instructions on how to connect the hardware and how to set up the initialization script as well as more example programs.\n", "```\n", "\n", "(sec-zhinst-how-to-configure)=\n", "\n", "## How to create an hardware compilation configuration\n", "\n", "``````{admonition} Example Zurich Instruments hardware compilation configuration\n", ":class: dropdown\n", "\n", "In this tutorial we make use of the example configuration that contains an HDAWG, a UHFQA and a few local oscillators. This configuration is fully described by the hardware compilation config file below, which contains the `\"hardware_description\"`, `\"connectivity\"`, and `\"hardware_options\"` information. These same files are also used for testing purposes in the CI.\n", "\n", "```{literalinclude} ../../../../quantify_scheduler/schemas/examples/zhinst_hardware_compilation_config.json\n", ":language: JSON\n", "```\n", "``````\n", "\n", "(sec-zhinst-verification-programs)=\n", "\n", "## Verifying the hardware compilation\n", "\n", "`quantify-scheduler` comes with several built-in verification programs in the {mod}`~.schedules.verification` module.\n", "Here we will start by building and compiling the first schedule by hand to show how one can construct such a schedule and debug it, before giving an overview of test programs.\n", "\n", "### Bining and averaging - AWG staircase\n", "\n", "#### Description\n", "In this schedule, we will play pulses of increasing amplitude on the HDAWG.\n", "These pulses are modulated with a local oscillator so that they appear at the same frequency as the readout pulse.\n", "This ensures that they are visible in the acquired signal.\n", "\n", "#### Expected outcome\n", "\n", "One would expect to see a monotonic increase in the measured amplitude.\n", "The actual amplitudes would probably not match the input amplitudes 1-to-1 because there is likely some loss on the signal path from the up- and down-conversion.\n", "Additionally, depending on the overlap between the pulse and the integration window, the average measured voltage will be slightly lower, and the phase can be slightly different resulting in not all signals being in the I-quadrature.\n", "\n", "#### Creating the staircase program\n", "\n", "We start by manually recreating the {func}`~quantify_scheduler.schedules.verification.awg_staircase_sched`, a schedule in which (modulated) square pulses are played on an HDAWG and the UHFQA is triggered subsequently to observe the result of that schedule." ] }, { "cell_type": "code", "execution_count": 2, "id": "187702fc", "metadata": {}, "outputs": [], "source": [ "# import statements required to make a schedule\n", "\n", "import numpy as np\n", "\n", "from quantify_scheduler import Schedule\n", "from quantify_scheduler.operations.acquisition_library import SSBIntegrationComplex\n", "from quantify_scheduler.operations.pulse_library import IdlePulse, SquarePulse\n", "from quantify_scheduler.resources import ClockResource\n", "\n" ] }, { "cell_type": "code", "execution_count": 3, "id": "5d6c7752", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "Schedule \u001b[32m\"AWG staircase\"\u001b[0m containing \u001b[1m(\u001b[0m\u001b[1;36m7\u001b[0m\u001b[1m)\u001b[0m \u001b[1;36m9\u001b[0m  \u001b[1m(\u001b[0munique\u001b[1m)\u001b[0m operations."
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pulse_amps = np.linspace(0.05, 0.9, 3)\n",
    "repetitions = 1024\n",
    "init_duration = 4000e-6  # 4us should allow for plenty of wait time\n",
    "mw_port = \"q0:mw\"\n",
    "ro_port = \"q0:res\"\n",
    "mw_clock = \"q0.01\"  # chosen to correspond to values in the hardware compilation cfg\n",
    "ro_clock = \"q0.ro\"\n",
    "readout_frequency = (\n",
    "    6.5e9  # this frequency will be used for both the AWG pulse as well as\n",
    ")\n",
    "# for the readout.\n",
    "\n",
    "pulse_duration = 1e-6\n",
    "acq_channel = 0\n",
    "integration_time = 2e-6\n",
    "acquisition_delay = 0\n",
    "\n",
    "\n",
    "sched = Schedule(name=\"AWG staircase\", repetitions=repetitions)\n",
    "\n",
    "sched.add_resource(ClockResource(name=mw_clock, freq=readout_frequency))\n",
    "sched.add_resource(ClockResource(name=ro_clock, freq=readout_frequency))\n",
    "pulse_amps = np.asarray(pulse_amps)\n",
    "\n",
    "\n",
    "for acq_index, pulse_amp in enumerate(pulse_amps):\n",
    "\n",
    "    sched.add(IdlePulse(duration=init_duration))\n",
    "\n",
    "    pulse = sched.add(\n",
    "        SquarePulse(\n",
    "            duration=pulse_duration,\n",
    "            amp=pulse_amp,\n",
    "            port=mw_port,\n",
    "            clock=mw_clock,\n",
    "        ),\n",
    "        label=f\"SquarePulse_{acq_index}\",\n",
    "    )\n",
    "\n",
    "    sched.add(\n",
    "        SSBIntegrationComplex(\n",
    "            duration=integration_time,\n",
    "            port=ro_port,\n",
    "            clock=ro_clock,\n",
    "            acq_index=acq_index,\n",
    "            acq_channel=acq_channel,\n",
    "        ),\n",
    "        ref_op=pulse,\n",
    "        ref_pt=\"start\",\n",
    "        rel_time=acquisition_delay,\n",
    "        label=f\"Acquisition_{acq_index}\",\n",
    "    )\n",
    "\n",
    "sched\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a42f642a",
   "metadata": {},
   "source": [
    "Now that we have generated the schedule we can compile it and verify if the hardware output is correct."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "b62a3f10",
   "metadata": {},
   "outputs": [],
   "source": [
    "from quantify_scheduler.backends.circuit_to_device import DeviceCompilationConfig\n",
    "from quantify_scheduler.backends.graph_compilation import SerialCompiler\n",
    "from quantify_scheduler.device_under_test.quantum_device import QuantumDevice\n",
    "from quantify_scheduler.schemas.examples import utils\n",
    "from quantify_scheduler.schemas.examples.device_example_cfgs import (\n",
    "    example_transmon_cfg,\n",
    ")\n",
    "\n",
    "quantum_device = QuantumDevice(\"DUT\")\n",
    "\n",
    "transmon_device_cfg = DeviceCompilationConfig.model_validate(example_transmon_cfg)\n",
    "quantum_device.hardware_config(utils.load_json_example_scheme(\"zhinst_hardware_compilation_config.json\"))\n",
    "\n",
    "compiler = SerialCompiler(name=\"compiler\")\n",
    "comp_sched = compiler.compile(\n",
    "    schedule=sched, config=quantum_device.generate_compilation_config()\n",
    ")\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a425637c",
   "metadata": {},
   "source": [
    "##### The timing table\n",
    "\n",
    "The {attr}`.ScheduleBase.timing_table` can be used after the absolute timing has been determined. It gives an overview of all operations in the schedule at the quantum-device level."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "722a8afe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "
\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "  \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "  \n",
       "  \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "  \n",
       "
 waveform_op_idportclockabs_timedurationis_acquisitionoperationwf_idxoperation_hash
0IdlePulse(duration=0.004)_acq_0Nonecl0.baseband0.0 ns4,000,000.0 nsFalseIdlePulse(duration=0.004)0-4263418673627657099
1SquarePulse(amp=0.05,duration=1e-06,port='q0:mw',clock='q0.01',reference_magnitude=None,t0=0)_acq_0q0:mwq0.014,000,000.0 ns1,000.0 nsFalseSquarePulse(amp=0.05,duration=1e-06,port='q0:mw',clock='q0.01',reference_magnitude=None,t0=0)0-2727203542188472253
2SSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=0,bin_mode='average',phase=0,t0=0)_acq_0q0:resq0.ro4,000,000.0 ns2,000.0 nsTrueSSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=0,bin_mode='average',phase=0,t0=0)06019175693960656089
3IdlePulse(duration=0.004)_acq_0Nonecl0.baseband4,002,000.0 ns4,000,000.0 nsFalseIdlePulse(duration=0.004)0-4263418673627657099
4SquarePulse(amp=0.475,duration=1e-06,port='q0:mw',clock='q0.01',reference_magnitude=None,t0=0)_acq_0q0:mwq0.018,002,000.0 ns1,000.0 nsFalseSquarePulse(amp=0.475,duration=1e-06,port='q0:mw',clock='q0.01',reference_magnitude=None,t0=0)04672744198158955576
5SSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=1,bin_mode='average',phase=0,t0=0)_acq_0q0:resq0.ro8,002,000.0 ns2,000.0 nsTrueSSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=1,bin_mode='average',phase=0,t0=0)0-2435547926867543021
6IdlePulse(duration=0.004)_acq_0Nonecl0.baseband8,004,000.0 ns4,000,000.0 nsFalseIdlePulse(duration=0.004)0-4263418673627657099
7SquarePulse(amp=0.9,duration=1e-06,port='q0:mw',clock='q0.01',reference_magnitude=None,t0=0)_acq_0q0:mwq0.0112,004,000.0 ns1,000.0 nsFalseSquarePulse(amp=0.9,duration=1e-06,port='q0:mw',clock='q0.01',reference_magnitude=None,t0=0)03375117930624595081
8SSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=2,bin_mode='average',phase=0,t0=0)_acq_0q0:resq0.ro12,004,000.0 ns2,000.0 nsTrueSSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=2,bin_mode='average',phase=0,t0=0)06363080616616400370
\n" ], "text/plain": [ "\u001b[1m<\u001b[0m\u001b[1;95mpandas.io.formats.style.Styler\u001b[0m\u001b[39m object at \u001b[0m\u001b[1;36m0x7948911572b0\u001b[0m\u001b[1m>\u001b[0m" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Pandas dataframes do not render correctly in the sphinx documentation environment. See issue #238.\n", "comp_sched.timing_table\n", "\n" ] }, { "cell_type": "markdown", "id": "973aab8c", "metadata": {}, "source": [ "##### The hardware timing table\n", "\n", "The {attr}`.CompiledSchedule.hardware_timing_table` is populated during the hardware compilation. It gives an overview of all operations in the schedule at the control-electronics layer. This means that the signals are corrected for effects such as gain and latency, and that modulations have been applied.\n", "\n", "The \"waveform_id\" key can be used to find the numerical waveforms in {attr}`.CompiledSchedule.hardware_waveform_dict`." ] }, { "cell_type": "code", "execution_count": 6, "id": "23624e4a", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "  \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "  \n",
       "  \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "  \n",
       "
 waveform_op_idportclockabs_timedurationis_acquisitionoperationwf_idxoperation_hashhardware_channelclock_cycle_startsample_startwaveform_id
0IdlePulse(duration=0.004)_acq_0Nonecl0.baseband0.0 ns4,000,000.0 nsFalseIdlePulse(duration=0.004)0-4263418673627657099NonenannanIdlePulse(duration=0.004)_acq_0_sample:nan_phase:0.0
2SSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=0,bin_mode='average',phase=0,t0=0)_acq_0q0:resq0.ro4,000,000.0 ns2,000.0 nsTrueSSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=0,bin_mode='average',phase=0,t0=0)06019175693960656089ic_uhfqa0.awg0900,000.00.0SSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=*,_acq_0_sample:0.0_phase:0.0
1SquarePulse(amp=0.05,duration=1e-06,port='q0:mw',clock='q0.01',reference_magnitude=None,t0=0)_acq_0q0:mwq0.014,000,190.0 ns1,000.0 nsFalseSquarePulse(amp=0.05,duration=1e-06,port='q0:mw',clock='q0.01',reference_magnitude=None,t0=0)0-2727203542188472253ic_hdawg0.awg01,200,057.00.0SquarePulse(amp=0.05,duration=1e-06,port='q0:mw',clock='q0.01',reference_magnitude=None,t0=0)_acq_0_sample:0.0_phase:0.0
3IdlePulse(duration=0.004)_acq_0Nonecl0.baseband4,002,000.0 ns4,000,000.0 nsFalseIdlePulse(duration=0.004)0-4263418673627657099NonenannanIdlePulse(duration=0.004)_acq_0_sample:nan_phase:0.0
5SSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=1,bin_mode='average',phase=0,t0=0)_acq_0q0:resq0.ro8,002,000.0 ns2,000.0 nsTrueSSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=1,bin_mode='average',phase=0,t0=0)0-2435547926867543021ic_uhfqa0.awg01,800,450.00.0SSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=*,_acq_0_sample:0.0_phase:0.0
4SquarePulse(amp=0.475,duration=1e-06,port='q0:mw',clock='q0.01',reference_magnitude=None,t0=0)_acq_0q0:mwq0.018,002,190.0 ns1,000.0 nsFalseSquarePulse(amp=0.475,duration=1e-06,port='q0:mw',clock='q0.01',reference_magnitude=None,t0=0)04672744198158955576ic_hdawg0.awg02,400,657.00.0SquarePulse(amp=0.475,duration=1e-06,port='q0:mw',clock='q0.01',reference_magnitude=None,t0=0)_acq_0_sample:0.0_phase:0.0
6IdlePulse(duration=0.004)_acq_0Nonecl0.baseband8,004,000.0 ns4,000,000.0 nsFalseIdlePulse(duration=0.004)0-4263418673627657099NonenannanIdlePulse(duration=0.004)_acq_0_sample:nan_phase:0.0
8SSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=2,bin_mode='average',phase=0,t0=0)_acq_0q0:resq0.ro12,004,000.0 ns2,000.0 nsTrueSSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=2,bin_mode='average',phase=0,t0=0)06363080616616400370ic_uhfqa0.awg02,700,900.00.0SSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=*,_acq_0_sample:0.0_phase:0.0
7SquarePulse(amp=0.9,duration=1e-06,port='q0:mw',clock='q0.01',reference_magnitude=None,t0=0)_acq_0q0:mwq0.0112,004,190.0 ns1,000.0 nsFalseSquarePulse(amp=0.9,duration=1e-06,port='q0:mw',clock='q0.01',reference_magnitude=None,t0=0)03375117930624595081ic_hdawg0.awg03,601,257.00.0SquarePulse(amp=0.9,duration=1e-06,port='q0:mw',clock='q0.01',reference_magnitude=None,t0=0)_acq_0_sample:0.0_phase:0.0
\n" ], "text/plain": [ "\u001b[1m<\u001b[0m\u001b[1;95mpandas.io.formats.style.Styler\u001b[0m\u001b[39m object at \u001b[0m\u001b[1;36m0x79489110b160\u001b[0m\u001b[1m>\u001b[0m" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "comp_sched.hardware_timing_table\n", "\n" ] }, { "cell_type": "markdown", "id": "b92a09ac", "metadata": {}, "source": [ "##### The hardware waveform dict" ] }, { "cell_type": "code", "execution_count": 7, "id": "8606894a", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "\n",
       "\u001b[1m{\u001b[0m\n",
       "    \u001b[32m\"SSBIntegrationComplex\u001b[0m\u001b[32m(\u001b[0m\u001b[32mport\u001b[0m\u001b[32m='q0:res',\u001b[0m\u001b[32mclock\u001b[0m\u001b[32m='q0.ro',\u001b[0m\u001b[32mduration\u001b[0m\u001b[32m=\u001b[0m\u001b[32m2e\u001b[0m\u001b[32m-06,\u001b[0m\u001b[32macq_channel\u001b[0m\u001b[32m=\u001b[0m\u001b[32m0\u001b[0m\u001b[32m,\u001b[0m\u001b[32macq_index\u001b[0m\u001b[32m=*,_acq_0_sample:0.0_phase:0.0\"\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m \u001b[1;36m1\u001b[0m.        +\u001b[1;36m1.j\u001b[0m        ,  \u001b[1;36m1.40883205+0.12325683j\u001b[0m,\n",
       "        \u001b[1;36m1.15845593-0.81115958j\u001b[0m, \u001b[33m...\u001b[0m, \u001b[1;36m-1.3660254\u001b[0m +\u001b[1;36m0.3660254j\u001b[0m ,\n",
       "       \u001b[1;36m-0.81115958+1.15845593j\u001b[0m,  \u001b[1;36m0.12325683+1.40883205j\u001b[0m\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m\"SquarePulse\u001b[0m\u001b[32m(\u001b[0m\u001b[32mamp\u001b[0m\u001b[32m=\u001b[0m\u001b[32m0\u001b[0m\u001b[32m.05,\u001b[0m\u001b[32mduration\u001b[0m\u001b[32m=\u001b[0m\u001b[32m1e\u001b[0m\u001b[32m-06,\u001b[0m\u001b[32mport\u001b[0m\u001b[32m='q0:mw',\u001b[0m\u001b[32mclock\u001b[0m\u001b[32m='q0.01',\u001b[0m\u001b[32mreference_magnitude\u001b[0m\u001b[32m=\u001b[0m\u001b[32mNone\u001b[0m\u001b[32m,\u001b[0m\u001b[32mt0\u001b[0m\u001b[32m=\u001b[0m\u001b[32m0\u001b[0m\u001b[32m)\u001b[0m\u001b[32m_acq_0_sample:0.0_phase:0.0\"\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m0.04873397+0.j\u001b[0m        , \u001b[1;36m0.04705799-0.01327714j\u001b[0m,\n",
       "       \u001b[1;36m0.04217509-0.02564946j\u001b[0m, \u001b[33m...\u001b[0m, \u001b[1;36m0.03450222+0.03627381j\u001b[0m,\n",
       "       \u001b[1;36m0.04223463+0.02564946j\u001b[0m, \u001b[1;36m0.04708881+0.01327714j\u001b[0m\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m\"SquarePulse\u001b[0m\u001b[32m(\u001b[0m\u001b[32mamp\u001b[0m\u001b[32m=\u001b[0m\u001b[32m0\u001b[0m\u001b[32m.475,\u001b[0m\u001b[32mduration\u001b[0m\u001b[32m=\u001b[0m\u001b[32m1e\u001b[0m\u001b[32m-06,\u001b[0m\u001b[32mport\u001b[0m\u001b[32m='q0:mw',\u001b[0m\u001b[32mclock\u001b[0m\u001b[32m='q0.01',\u001b[0m\u001b[32mreference_magnitude\u001b[0m\u001b[32m=\u001b[0m\u001b[32mNone\u001b[0m\u001b[32m,\u001b[0m\u001b[32mt0\u001b[0m\u001b[32m=\u001b[0m\u001b[32m0\u001b[0m\u001b[32m)\u001b[0m\u001b[32m_acq_0_sample:0.0_phase:0.0\"\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m0.46297273+0.j\u001b[0m        , \u001b[1;36m0.44705092-0.1261328j\u001b[0m ,\n",
       "       \u001b[1;36m0.40066333-0.24366986j\u001b[0m, \u001b[33m...\u001b[0m, \u001b[1;36m0.32777112+0.34460122j\u001b[0m,\n",
       "       \u001b[1;36m0.40122896+0.24366986j\u001b[0m, \u001b[1;36m0.44734371+0.1261328j\u001b[0m \u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m\"SquarePulse\u001b[0m\u001b[32m(\u001b[0m\u001b[32mamp\u001b[0m\u001b[32m=\u001b[0m\u001b[32m0\u001b[0m\u001b[32m.9,\u001b[0m\u001b[32mduration\u001b[0m\u001b[32m=\u001b[0m\u001b[32m1e\u001b[0m\u001b[32m-06,\u001b[0m\u001b[32mport\u001b[0m\u001b[32m='q0:mw',\u001b[0m\u001b[32mclock\u001b[0m\u001b[32m='q0.01',\u001b[0m\u001b[32mreference_magnitude\u001b[0m\u001b[32m=\u001b[0m\u001b[32mNone\u001b[0m\u001b[32m,\u001b[0m\u001b[32mt0\u001b[0m\u001b[32m=\u001b[0m\u001b[32m0\u001b[0m\u001b[32m)\u001b[0m\u001b[32m_acq_0_sample:0.0_phase:0.0\"\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m0.87721149+0.j\u001b[0m        , \u001b[1;36m0.84704385-0.23898846j\u001b[0m,\n",
       "       \u001b[1;36m0.75915158-0.46169026j\u001b[0m, \u001b[33m...\u001b[0m, \u001b[1;36m0.62104001+0.65292863j\u001b[0m,\n",
       "       \u001b[1;36m0.76022329+0.46169026j\u001b[0m, \u001b[1;36m0.84759861+0.23898846j\u001b[0m\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m\n",
       "\u001b[1m}\u001b[0m"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "comp_sched.hardware_waveform_dict\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c1046949",
   "metadata": {},
   "source": [
    "##### The compiled instructions\n",
    "\n",
    "The compiled instructions can be found in the `compiled_instructions` of the compiled schedule."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "9cac3fe4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "
\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "\n",
       "\u001b[1m{\u001b[0m\n",
       "    \u001b[32m'ic_hdawg0'\u001b[0m: \u001b[1;35mZIDeviceConfig\u001b[0m\u001b[1m(\u001b[0m\n",
       "        \u001b[33mname\u001b[0m=\u001b[32m'ic_hdawg0'\u001b[0m,\n",
       "        \u001b[33msettings_builder\u001b[0m=\u001b[1m<\u001b[0m\u001b[1;95mquantify_scheduler.backends.zhinst.settings.ZISettingsBuilder\u001b[0m\u001b[39m object at \u001b[0m\u001b[1;36m0x7948912cef10\u001b[0m\u001b[39m>,\u001b[0m\n",
       "\u001b[39m        \u001b[0m\u001b[33macq_config\u001b[0m\u001b[39m=\u001b[0m\u001b[3;35mNone\u001b[0m\n",
       "\u001b[39m    \u001b[0m\u001b[1;39m)\u001b[0m\u001b[39m,\u001b[0m\n",
       "\u001b[39m    \u001b[0m\u001b[32m'generic'\u001b[0m\u001b[39m: \u001b[0m\u001b[1;39m{\u001b[0m\n",
       "\u001b[39m        \u001b[0m\u001b[32m'lo0.ch1.frequency'\u001b[0m\u001b[39m: \u001b[0m\u001b[1;36m6600000000.0\u001b[0m\u001b[39m,\u001b[0m\n",
       "\u001b[39m        \u001b[0m\u001b[32m'lo0.power'\u001b[0m\u001b[39m: \u001b[0m\u001b[1;36m13\u001b[0m\u001b[39m,\u001b[0m\n",
       "\u001b[39m        \u001b[0m\u001b[32m'lo1.frequency'\u001b[0m\u001b[39m: \u001b[0m\u001b[1;36m6300000000.0\u001b[0m\u001b[39m,\u001b[0m\n",
       "\u001b[39m        \u001b[0m\u001b[32m'lo1.power'\u001b[0m\u001b[39m: \u001b[0m\u001b[1;36m16\u001b[0m\n",
       "\u001b[39m    \u001b[0m\u001b[1;39m}\u001b[0m\u001b[39m,\u001b[0m\n",
       "\u001b[39m    \u001b[0m\u001b[32m'ic_uhfqa0'\u001b[0m\u001b[39m: \u001b[0m\u001b[1;35mZIDeviceConfig\u001b[0m\u001b[1;39m(\u001b[0m\n",
       "\u001b[39m        \u001b[0m\u001b[33mname\u001b[0m\u001b[39m=\u001b[0m\u001b[32m'ic_uhfqa0'\u001b[0m\u001b[39m,\u001b[0m\n",
       "\u001b[39m        \u001b[0m\u001b[33msettings_builder\u001b[0m\u001b[39m=,\u001b[0m\n",
       "\u001b[39m        \u001b[0m\u001b[33macq_config\u001b[0m\u001b[39m=\u001b[0m\u001b[1;35mZIAcquisitionConfig\u001b[0m\u001b[1;39m(\u001b[0m\n",
       "\u001b[39m            \u001b[0m\u001b[33mn_acquisitions\u001b[0m\u001b[39m=\u001b[0m\u001b[1;36m3\u001b[0m\u001b[39m,\u001b[0m\n",
       "\u001b[39m            \u001b[0m\u001b[33mresolvers\u001b[0m\u001b[39m=\u001b[0m\u001b[1;39m{\u001b[0m\n",
       "\u001b[39m                \u001b[0m\u001b[1;36m0\u001b[0m\u001b[39m: \u001b[0m\u001b[1;35mfunctools.partial\u001b[0m\u001b[1;39m(\u001b[0m\u001b[39m, \u001b[0m\u001b[33mresult_nodes\u001b[0m\u001b[39m=\u001b[0m\u001b[1;39m[\u001b[0m\u001b[32m'qas/0/result/data/0/wave'\u001b[0m\u001b[39m, \u001b[0m\u001b[32m'qas/0/result/data/1/wave'\u001b[0m\u001b[1;39m]\u001b[0m\u001b[1;39m)\u001b[0m\n",
       "\u001b[39m            \u001b[0m\u001b[1;39m}\u001b[0m\u001b[39m,\u001b[0m\n",
       "\u001b[39m            \u001b[0m\u001b[33mbin_mode\u001b[0m\u001b[39m=\u001b[0m,\n",
       "            \u001b[33macq_protocols\u001b[0m=\u001b[1m{\u001b[0m\u001b[1;36m0\u001b[0m: \u001b[32m'SSBIntegrationComplex'\u001b[0m\u001b[1m}\u001b[0m\n",
       "        \u001b[1m)\u001b[0m\n",
       "    \u001b[1m)\u001b[0m\n",
       "\u001b[1m}\u001b[0m"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "comp_sched.compiled_instructions\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fb274268",
   "metadata": {},
   "source": [
    "The settings for the Zurich Instruments instruments are stored as a {class}`~.ZIDeviceConfig`, of which the `settings_builder` contains the {class}`~.backends.zhinst.settings.ZISettingsBuilder` containing both the settings to set on all the nodes in the Zurich Instruments drivers as well as the compiled `seqc` instructions."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "73179b08",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "
\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "\n",
       "\u001b[1m{\u001b[0m\n",
       "    \u001b[32m'sigouts/*/on'\u001b[0m: \u001b[1;36m0\u001b[0m,\n",
       "    \u001b[32m'awgs/*/single'\u001b[0m: \u001b[1;36m1\u001b[0m,\n",
       "    \u001b[32m'system/awg/channelgrouping'\u001b[0m: \u001b[1;36m0\u001b[0m,\n",
       "    \u001b[32m'awgs/0/time'\u001b[0m: \u001b[1;36m0\u001b[0m,\n",
       "    \u001b[32m'awgs/1/time'\u001b[0m: \u001b[1;36m0\u001b[0m,\n",
       "    \u001b[32m'awgs/2/time'\u001b[0m: \u001b[1;36m0\u001b[0m,\n",
       "    \u001b[32m'awgs/3/time'\u001b[0m: \u001b[1;36m0\u001b[0m,\n",
       "    \u001b[32m'sigouts/0/on'\u001b[0m: \u001b[1;36m1\u001b[0m,\n",
       "    \u001b[32m'sigouts/1/on'\u001b[0m: \u001b[1;36m1\u001b[0m,\n",
       "    \u001b[32m'awgs/0/outputs/0/gains/0'\u001b[0m: \u001b[1;36m1\u001b[0m,\n",
       "    \u001b[32m'awgs/0/outputs/1/gains/1'\u001b[0m: \u001b[1;36m1\u001b[0m,\n",
       "    \u001b[32m'sigouts/0/offset'\u001b[0m: \u001b[1;36m-0.0542\u001b[0m,\n",
       "    \u001b[32m'sigouts/1/offset'\u001b[0m: \u001b[1;36m-0.0328\u001b[0m,\n",
       "    \u001b[32m'awgs/0/commandtable/data'\u001b[0m: \u001b[32m'\u001b[0m\u001b[32m{\u001b[0m\u001b[32m\"header\":\u001b[0m\u001b[32m{\u001b[0m\u001b[32m\"version\":\"0.2\",\"partial\":false\u001b[0m\u001b[32m}\u001b[0m\u001b[32m,\"table\":\u001b[0m\u001b[32m[\u001b[0m\u001b[32m{\u001b[0m\u001b[32m\"index\":0,\"waveform\":\u001b[0m\u001b[32m{\u001b[0m\u001b[32m\"index\":0,\"length\":2400\u001b[0m\u001b[32m}\u001b[0m\u001b[32m}\u001b[0m\u001b[32m,\u001b[0m\u001b[32m{\u001b[0m\u001b[32m\"index\":1,\"waveform\":\u001b[0m\u001b[32m{\u001b[0m\u001b[32m\"index\":1,\"length\":2400\u001b[0m\u001b[32m}\u001b[0m\u001b[32m}\u001b[0m\u001b[32m,\u001b[0m\u001b[32m{\u001b[0m\u001b[32m\"index\":2,\"waveform\":\u001b[0m\u001b[32m{\u001b[0m\u001b[32m\"index\":2,\"length\":2400\u001b[0m\u001b[32m}\u001b[0m\u001b[32m}\u001b[0m\u001b[32m]\u001b[0m\u001b[32m}\u001b[0m\u001b[32m'\u001b[0m,\n",
       "    \u001b[32m'awgs/0/waveform/waves/0'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m1596\u001b[0m,    \u001b[1;36m0\u001b[0m, \u001b[1;36m1541\u001b[0m, \u001b[33m...\u001b[0m,  \u001b[1;36m840\u001b[0m, \u001b[1;36m1542\u001b[0m,  \u001b[1;36m435\u001b[0m\u001b[1m]\u001b[0m, \u001b[33mdtype\u001b[0m=\u001b[35mint16\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'awgs/0/waveform/waves/1'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m15170\u001b[0m,     \u001b[1;36m0\u001b[0m, \u001b[1;36m14648\u001b[0m, \u001b[33m...\u001b[0m,  \u001b[1;36m7984\u001b[0m, \u001b[1;36m14658\u001b[0m,  \u001b[1;36m4132\u001b[0m\u001b[1m]\u001b[0m, \u001b[33mdtype\u001b[0m=\u001b[35mint16\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'awgs/0/waveform/waves/2'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m28743\u001b[0m,     \u001b[1;36m0\u001b[0m, \u001b[1;36m27755\u001b[0m, \u001b[33m...\u001b[0m, \u001b[1;36m15128\u001b[0m, \u001b[1;36m27773\u001b[0m,  \u001b[1;36m7830\u001b[0m\u001b[1m]\u001b[0m, \u001b[33mdtype\u001b[0m=\u001b[35mint16\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'compiler/sourcestring'\u001b[0m: \u001b[1m{\u001b[0m\n",
       "        \u001b[1;36m0\u001b[0m: \u001b[32m'// Generated by quantify-scheduler.\\n// Variables\\nvar __repetitions__ = 1024;\\nwave w0 = placeholder\u001b[0m\u001b[32m(\u001b[0m\u001b[32m2400\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\nwave w1 = placeholder\u001b[0m\u001b[32m(\u001b[0m\u001b[32m2400\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\nwave w2 = placeholder\u001b[0m\u001b[32m(\u001b[0m\u001b[32m2400\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\n\\n// Operations\\nassignWaveIndex\u001b[0m\u001b[32m(\u001b[0m\u001b[32mw0, w0, 0\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\nassignWaveIndex\u001b[0m\u001b[32m(\u001b[0m\u001b[32mw1, w1, 1\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\nassignWaveIndex\u001b[0m\u001b[32m(\u001b[0m\u001b[32mw2, w2, 2\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\nsetTrigger\u001b[0m\u001b[32m(\u001b[0m\u001b[32m0\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\t//  \u001b[0m\u001b[32mn_instr\u001b[0m\u001b[32m=\u001b[0m\u001b[32m1\u001b[0m\u001b[32m\\nrepeat\u001b[0m\u001b[32m(\u001b[0m\u001b[32m__repetitions__\u001b[0m\u001b[32m)\u001b[0m\u001b[32m\\n\u001b[0m\u001b[32m{\u001b[0m\u001b[32m\\n  setTrigger\u001b[0m\u001b[32m(\u001b[0m\u001b[32mAWG_MARKER1 + AWG_MARKER2\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\t//  \u001b[0m\u001b[32mn_instr\u001b[0m\u001b[32m=\u001b[0m\u001b[32m2\u001b[0m\u001b[32m\\n  wait\u001b[0m\u001b[32m(\u001b[0m\u001b[32m1200052\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\t\\t// \u001b[0m\u001b[32mclock\u001b[0m\u001b[32m=\u001b[0m\u001b[32m2\u001b[0m\u001b[32m\\t \u001b[0m\u001b[32mn_instr\u001b[0m\u001b[32m=\u001b[0m\u001b[32m3\u001b[0m\u001b[32m\\n  executeTableEntry\u001b[0m\u001b[32m(\u001b[0m\u001b[32m0\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\t// \u001b[0m\u001b[32mclock\u001b[0m\u001b[32m=\u001b[0m\u001b[32m1200057\u001b[0m\u001b[32m \u001b[0m\u001b[32mpulse\u001b[0m\u001b[32m=\u001b[0m\u001b[32m0\u001b[0m\u001b[32m \u001b[0m\u001b[32mn_instr\u001b[0m\u001b[32m=\u001b[0m\u001b[32m0\u001b[0m\u001b[32m\\n  wait\u001b[0m\u001b[32m(\u001b[0m\u001b[32m1200597\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\t\\t// \u001b[0m\u001b[32mclock\u001b[0m\u001b[32m=\u001b[0m\u001b[32m1200057\u001b[0m\u001b[32m\\t \u001b[0m\u001b[32mn_instr\u001b[0m\u001b[32m=\u001b[0m\u001b[32m3\u001b[0m\u001b[32m\\n  executeTableEntry\u001b[0m\u001b[32m(\u001b[0m\u001b[32m1\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\t// \u001b[0m\u001b[32mclock\u001b[0m\u001b[32m=\u001b[0m\u001b[32m2400657\u001b[0m\u001b[32m \u001b[0m\u001b[32mpulse\u001b[0m\u001b[32m=\u001b[0m\u001b[32m1\u001b[0m\u001b[32m \u001b[0m\u001b[32mn_instr\u001b[0m\u001b[32m=\u001b[0m\u001b[32m0\u001b[0m\u001b[32m\\n  wait\u001b[0m\u001b[32m(\u001b[0m\u001b[32m1200597\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\t\\t// \u001b[0m\u001b[32mclock\u001b[0m\u001b[32m=\u001b[0m\u001b[32m2400657\u001b[0m\u001b[32m\\t \u001b[0m\u001b[32mn_instr\u001b[0m\u001b[32m=\u001b[0m\u001b[32m3\u001b[0m\u001b[32m\\n  executeTableEntry\u001b[0m\u001b[32m(\u001b[0m\u001b[32m2\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\t// \u001b[0m\u001b[32mclock\u001b[0m\u001b[32m=\u001b[0m\u001b[32m3601257\u001b[0m\u001b[32m \u001b[0m\u001b[32mpulse\u001b[0m\u001b[32m=\u001b[0m\u001b[32m2\u001b[0m\u001b[32m \u001b[0m\u001b[32mn_instr\u001b[0m\u001b[32m=\u001b[0m\u001b[32m0\u001b[0m\u001b[32m\\n  setTrigger\u001b[0m\u001b[32m(\u001b[0m\u001b[32m0\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\t// \u001b[0m\u001b[32mclock\u001b[0m\u001b[32m=\u001b[0m\u001b[32m3601257\u001b[0m\u001b[32m \u001b[0m\u001b[32mn_instr\u001b[0m\u001b[32m=\u001b[0m\u001b[32m1\u001b[0m\u001b[32m\\n  wait\u001b[0m\u001b[32m(\u001b[0m\u001b[32m539\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\t\\t// \u001b[0m\u001b[32mclock\u001b[0m\u001b[32m=\u001b[0m\u001b[32m3601258\u001b[0m\u001b[32m, dead time to ensure total schedule duration\\t \u001b[0m\u001b[32mn_instr\u001b[0m\u001b[32m=\u001b[0m\u001b[32m3\u001b[0m\u001b[32m\\n\u001b[0m\u001b[32m}\u001b[0m\u001b[32m\\n'\u001b[0m\n",
       "    \u001b[1m}\u001b[0m\n",
       "\u001b[1m}\u001b[0m"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# the .as_dict method can be used to generate a \"readable\" overview of the settings.\n",
    "hdawg_settings_dict = (\n",
    "    comp_sched.compiled_instructions[\"ic_hdawg0\"].settings_builder.build().as_dict()\n",
    ")\n",
    "# hdawg_settings_dict\n",
    "hdawg_settings_dict\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "94317bd8",
   "metadata": {},
   "source": [
    "The compiler source string for each awg channel can be printed to see the instructions the ZI hardware will execute.\n",
    "The clock-cycles are tracked by the assembler backend and can be compared to the hardware_timing_table."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "10075f6d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "// Generated by quantify-scheduler.\n",
      "// Variables\n",
      "var __repetitions__ = 1024;\n",
      "wave w0 = placeholder(2400);\n",
      "wave w1 = placeholder(2400);\n",
      "wave w2 = placeholder(2400);\n",
      "\n",
      "// Operations\n",
      "assignWaveIndex(w0, w0, 0);\n",
      "assignWaveIndex(w1, w1, 1);\n",
      "assignWaveIndex(w2, w2, 2);\n",
      "setTrigger(0);\t//  n_instr=1\n",
      "repeat(__repetitions__)\n",
      "{\n",
      "  setTrigger(AWG_MARKER1 + AWG_MARKER2);\t//  n_instr=2\n",
      "  wait(1200052);\t\t// clock=2\t n_instr=3\n",
      "  executeTableEntry(0);\t// clock=1200057 pulse=0 n_instr=0\n",
      "  wait(1200597);\t\t// clock=1200057\t n_instr=3\n",
      "  executeTableEntry(1);\t// clock=2400657 pulse=1 n_instr=0\n",
      "  wait(1200597);\t\t// clock=2400657\t n_instr=3\n",
      "  executeTableEntry(2);\t// clock=3601257 pulse=2 n_instr=0\n",
      "  setTrigger(0);\t// clock=3601257 n_instr=1\n",
      "  wait(539);\t\t// clock=3601258, dead time to ensure total schedule duration\t n_instr=3\n",
      "}\n",
      "\n"
     ]
    }
   ],
   "source": [
    "awg_index = 0\n",
    "print(hdawg_settings_dict[\"compiler/sourcestring\"][awg_index])\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "e381d4a4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "
\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "\n",
       "\u001b[1m{\u001b[0m\n",
       "    \u001b[32m'awgs/0/single'\u001b[0m: \u001b[1;36m1\u001b[0m,\n",
       "    \u001b[32m'qas/0/rotations/*'\u001b[0m: \u001b[1m(\u001b[0m\u001b[1;36m1+1j\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/sources/*'\u001b[0m: \u001b[1;36m0\u001b[0m,\n",
       "    \u001b[32m'sigouts/0/on'\u001b[0m: \u001b[1;36m1\u001b[0m,\n",
       "    \u001b[32m'sigouts/1/on'\u001b[0m: \u001b[1;36m1\u001b[0m,\n",
       "    \u001b[32m'awgs/0/time'\u001b[0m: \u001b[1;36m0\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/weights/0/real'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m1\u001b[0m.        , \u001b[1;36m1.40883205\u001b[0m, \u001b[1;36m1.15845593\u001b[0m, \u001b[33m...\u001b[0m, \u001b[1;36m0\u001b[0m.        , \u001b[1;36m0\u001b[0m.        ,\n",
       "       \u001b[1;36m0\u001b[0m.        \u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/weights/1/real'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m \u001b[1;36m1\u001b[0m.        ,  \u001b[1;36m0.12325683\u001b[0m, \u001b[1;36m-0.81115958\u001b[0m, \u001b[33m...\u001b[0m,  \u001b[1;36m0\u001b[0m.        ,\n",
       "        \u001b[1;36m0\u001b[0m.        ,  \u001b[1;36m0\u001b[0m.        \u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/weights/2/real'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[33m...\u001b[0m, \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m.\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/weights/3/real'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[33m...\u001b[0m, \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m.\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/weights/4/real'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[33m...\u001b[0m, \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m.\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/weights/5/real'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[33m...\u001b[0m, \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m.\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/weights/6/real'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[33m...\u001b[0m, \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m.\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/weights/7/real'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[33m...\u001b[0m, \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m.\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/weights/8/real'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[33m...\u001b[0m, \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m.\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/weights/9/real'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[33m...\u001b[0m, \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m.\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/weights/0/imag'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m \u001b[1;36m1\u001b[0m.        ,  \u001b[1;36m0.12325683\u001b[0m, \u001b[1;36m-0.81115958\u001b[0m, \u001b[33m...\u001b[0m,  \u001b[1;36m0\u001b[0m.        ,\n",
       "        \u001b[1;36m0\u001b[0m.        ,  \u001b[1;36m0\u001b[0m.        \u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/weights/1/imag'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m-1\u001b[0m.        , \u001b[1;36m-1.40883205\u001b[0m, \u001b[1;36m-1.15845593\u001b[0m, \u001b[33m...\u001b[0m, \u001b[1;36m-0\u001b[0m.        ,\n",
       "       \u001b[1;36m-0\u001b[0m.        , \u001b[1;36m-0\u001b[0m.        \u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/weights/2/imag'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[33m...\u001b[0m, \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m.\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/weights/3/imag'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[33m...\u001b[0m, \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m.\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/weights/4/imag'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[33m...\u001b[0m, \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m.\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/weights/5/imag'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[33m...\u001b[0m, \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m.\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/weights/6/imag'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[33m...\u001b[0m, \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m.\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/weights/7/imag'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[33m...\u001b[0m, \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m.\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/weights/8/imag'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[33m...\u001b[0m, \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m.\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/weights/9/imag'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[33m...\u001b[0m, \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m., \u001b[1;36m0\u001b[0m.\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'sigouts/0/offset'\u001b[0m: \u001b[1;36m0.0\u001b[0m,\n",
       "    \u001b[32m'sigouts/1/offset'\u001b[0m: \u001b[1;36m0.0\u001b[0m,\n",
       "    \u001b[32m'awgs/0/waveform/waves/0'\u001b[0m: \u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1;36m23258\u001b[0m, \u001b[1;36m23258\u001b[0m, \u001b[1;36m32766\u001b[0m, \u001b[33m...\u001b[0m, \u001b[1;36m26943\u001b[0m,  \u001b[1;36m2866\u001b[0m, \u001b[1;36m32766\u001b[0m\u001b[1m]\u001b[0m, \u001b[33mdtype\u001b[0m=\u001b[35mint16\u001b[0m\u001b[1m)\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/mode'\u001b[0m: \u001b[1;36m0\u001b[0m,\n",
       "    \u001b[32m'qas/0/integration/length'\u001b[0m: \u001b[1;36m3600\u001b[0m,\n",
       "    \u001b[32m'qas/0/result/enable'\u001b[0m: \u001b[1;36m1\u001b[0m,\n",
       "    \u001b[32m'qas/0/monitor/enable'\u001b[0m: \u001b[1;36m0\u001b[0m,\n",
       "    \u001b[32m'qas/0/delay'\u001b[0m: \u001b[1;36m0\u001b[0m,\n",
       "    \u001b[32m'qas/0/result/mode'\u001b[0m: \u001b[1;36m0\u001b[0m,\n",
       "    \u001b[32m'qas/0/result/source'\u001b[0m: \u001b[1;36m7\u001b[0m,\n",
       "    \u001b[32m'qas/0/result/length'\u001b[0m: \u001b[1;36m3\u001b[0m,\n",
       "    \u001b[32m'qas/0/result/averages'\u001b[0m: \u001b[1;36m1024\u001b[0m,\n",
       "    \u001b[32m'qas/0/result/reset'\u001b[0m: \u001b[1;36m1\u001b[0m,\n",
       "    \u001b[32m'qas/0/monitor/reset'\u001b[0m: \u001b[1;36m1\u001b[0m,\n",
       "    \u001b[32m'compiler/sourcestring'\u001b[0m: \u001b[1m{\u001b[0m\n",
       "        \u001b[1;36m0\u001b[0m: \u001b[32m'// Generated by quantify-scheduler.\\n// Variables\\nvar __repetitions__ = 1024;\\nwave w0 = \"ic_uhfqa0_awg0_wave0\";\\n\\n// Operations\\nrepeat\u001b[0m\u001b[32m(\u001b[0m\u001b[32m__repetitions__\u001b[0m\u001b[32m)\u001b[0m\u001b[32m\\n\u001b[0m\u001b[32m{\u001b[0m\u001b[32m\\n  waitDigTrigger\u001b[0m\u001b[32m(\u001b[0m\u001b[32m2, 1\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\t// \\t// \u001b[0m\u001b[32mclock\u001b[0m\u001b[32m=\u001b[0m\u001b[32m0\u001b[0m\u001b[32m\\n  wait\u001b[0m\u001b[32m(\u001b[0m\u001b[32m900000\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\t\\t// \u001b[0m\u001b[32mclock\u001b[0m\u001b[32m=\u001b[0m\u001b[32m0\u001b[0m\u001b[32m\\t \u001b[0m\u001b[32mn_instr\u001b[0m\u001b[32m=\u001b[0m\u001b[32m900000\u001b[0m\u001b[32m\\n  startQA\u001b[0m\u001b[32m(\u001b[0m\u001b[32mQA_INT_ALL, true\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\t// \u001b[0m\u001b[32mclock\u001b[0m\u001b[32m=\u001b[0m\u001b[32m900000\u001b[0m\u001b[32m \u001b[0m\u001b[32mn_instr\u001b[0m\u001b[32m=\u001b[0m\u001b[32m7\u001b[0m\u001b[32m\\n  wait\u001b[0m\u001b[32m(\u001b[0m\u001b[32m900443\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\t\\t// \u001b[0m\u001b[32mclock\u001b[0m\u001b[32m=\u001b[0m\u001b[32m900007\u001b[0m\u001b[32m\\t \u001b[0m\u001b[32mn_instr\u001b[0m\u001b[32m=\u001b[0m\u001b[32m900443\u001b[0m\u001b[32m\\n  startQA\u001b[0m\u001b[32m(\u001b[0m\u001b[32mQA_INT_ALL, true\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\t// \u001b[0m\u001b[32mclock\u001b[0m\u001b[32m=\u001b[0m\u001b[32m1800450\u001b[0m\u001b[32m \u001b[0m\u001b[32mn_instr\u001b[0m\u001b[32m=\u001b[0m\u001b[32m7\u001b[0m\u001b[32m\\n  wait\u001b[0m\u001b[32m(\u001b[0m\u001b[32m900443\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\t\\t// \u001b[0m\u001b[32mclock\u001b[0m\u001b[32m=\u001b[0m\u001b[32m1800457\u001b[0m\u001b[32m\\t \u001b[0m\u001b[32mn_instr\u001b[0m\u001b[32m=\u001b[0m\u001b[32m900443\u001b[0m\u001b[32m\\n  startQA\u001b[0m\u001b[32m(\u001b[0m\u001b[32mQA_INT_ALL, true\u001b[0m\u001b[32m)\u001b[0m\u001b[32m;\\t// \u001b[0m\u001b[32mclock\u001b[0m\u001b[32m=\u001b[0m\u001b[32m2700900\u001b[0m\u001b[32m \u001b[0m\u001b[32mn_instr\u001b[0m\u001b[32m=\u001b[0m\u001b[32m7\u001b[0m\u001b[32m\\n\u001b[0m\u001b[32m}\u001b[0m\u001b[32m\\n'\u001b[0m\n",
       "    \u001b[1m}\u001b[0m\n",
       "\u001b[1m}\u001b[0m"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# the .as_dict method can be used to generate a \"readable\" overview of the settings.\n",
    "uhfqa_settings_dict = (\n",
    "    comp_sched.compiled_instructions[\"ic_uhfqa0\"].settings_builder.build().as_dict()\n",
    ")\n",
    "# uhfqa_settings_dict\n",
    "uhfqa_settings_dict\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "84b69de2",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "// Generated by quantify-scheduler.\n",
      "// Variables\n",
      "var __repetitions__ = 1024;\n",
      "wave w0 = \"ic_uhfqa0_awg0_wave0\";\n",
      "\n",
      "// Operations\n",
      "repeat(__repetitions__)\n",
      "{\n",
      "  waitDigTrigger(2, 1);\t// \t// clock=0\n",
      "  wait(900000);\t\t// clock=0\t n_instr=900000\n",
      "  startQA(QA_INT_ALL, true);\t// clock=900000 n_instr=7\n",
      "  wait(900443);\t\t// clock=900007\t n_instr=900443\n",
      "  startQA(QA_INT_ALL, true);\t// clock=1800450 n_instr=7\n",
      "  wait(900443);\t\t// clock=1800457\t n_instr=900443\n",
      "  startQA(QA_INT_ALL, true);\t// clock=2700900 n_instr=7\n",
      "}\n",
      "\n"
     ]
    }
   ],
   "source": [
    "awg_index = 0\n",
    "print(uhfqa_settings_dict[\"compiler/sourcestring\"][awg_index])\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2c2e96c7",
   "metadata": {},
   "source": [
    "## Verification programs\n",
    "\n",
    "`quantify-scheduler` comes with several test programs that can be used to verify that the software and the hardware are configured and functioning correctly.\n",
    "You should be able to run this notebook on your setup directly if you replace the mock_setup initialization with your initialization script.\n",
    "\n",
    "```{note}\n",
    "This documentation is a work in progress. See issue #237.\n",
    "Here we provide an overview of schedules that are used to verify different kinds of functionality.\n",
    "This section will be expanded to include working examples.\n",
    "```\n",
    "\n",
    "### Time trace acquisition - readout pulse\n",
    "\n",
    "#### Description\n",
    "\n",
    "In this experiment, a square readout pulse is applied. This pulse should be visible in the acquisition window and can be used to calibrate the timing delay of the integration window.\n",
    "\n",
    "This experiment can be used to verify the time-trace acquisition functionality of the readout module (e.g., Qblox QRM or ZI UHFQA) is working.\n",
    "\n",
    "#### Expected outcome\n",
    "\n",
    "A square pulse with some modulation is visible in the integration window.\n",
    "\n",
    "{func}`~quantify_scheduler.schedules.trace_schedules.trace_schedule`\n",
    "\n",
    "### Time trace acquisition - two pulses\n",
    "\n",
    "#### Description\n",
    "\n",
    "In this experiment, a square pulse is applied to the microwave drive line. This pulse should be visible in the acquisition window and can be used to calibrate the timing delay between the readout and control pulses.\n",
    "\n",
    "This experiment can be used to verify the time-trace acquisition functionality of the readout module (e.g., Qblox QRM or ZI UHFQA) is working in combination with the synchronization between the readout module (e.g., Qblox QRM or ZI UHFQA) and the pulse generating module (e.g., Qblox QCM or ZI HDAWG).\n",
    "\n",
    "#### Expected outcome\n",
    "\n",
    "A square pulse with some modulation is visible on top of a second pulse with a different modulation frequency in the integration window.\n",
    "\n",
    "{func}`~quantify_scheduler.schedules.trace_schedules.two_tone_trace_schedule`\n",
    "\n",
    "### Weighted integration and averaging - Heterodyne spectroscopy\n",
    "\n",
    "#### Description\n",
    "\n",
    "#### Expected outcome\n",
    "\n",
    "{func}`~quantify_scheduler.schedules.spectroscopy_schedules.heterodyne_spec_sched`\n",
    "\n",
    "### Binning and averaging - acquisition staircase\n",
    "\n",
    "#### Description\n",
    "\n",
    "#### Expected outcome\n",
    "\n",
    "One would expect to see a monotonic increase in the measured amplitude.\n",
    "The actual amplitudes would probably not match the input amplitudes 1-to-1 because there is likely some loss on the signal path from the up- and down-conversion.\n",
    "Additionally, depending on the overlap between the pulse and the integration window, the average measured voltage will be slightly lower, and the phase can be slightly different resulting in not all signals being in the I-quadrature.\n",
    "\n",
    "{func}`~quantify_scheduler.schedules.verification.acquisition_staircase_sched`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "8f03e57a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "
\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "  \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "  \n",
       "  \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "    \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "      \n",
       "    \n",
       "  \n",
       "
 waveform_op_idportclockabs_timedurationis_acquisitionoperationwf_idxoperation_hashhardware_channelclock_cycle_startsample_startwaveform_id
0IdlePulse(duration=1e-06)_acq_0Nonecl0.baseband6.7 ns1,000.0 nsFalseIdlePulse(duration=1e-06)0894082367168206916NonenannanIdlePulse(duration=1e-06)_acq_0_sample:nan_phase:0.0
1SquarePulse(amp=0.0,duration=1e-06,port='q0:res',clock='q0.ro',reference_magnitude=None,t0=0)_acq_0q0:resq0.ro1,006.7 ns1,000.0 nsFalseSquarePulse(amp=0.0,duration=1e-06,port='q0:res',clock='q0.ro',reference_magnitude=None,t0=0)0-7322461322227695740ic_uhfqa0.awg0226.04.0SquarePulse(amp=0.0,duration=1e-06,port='q0:res',clock='q0.ro',reference_magnitude=None,t0=0)_acq_0_sample:4.0_phase:0.0
2SSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=0,bin_mode='average',phase=0,t0=0)_acq_0q0:resq0.ro1,106.7 ns2,000.0 nsTrueSSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=0,bin_mode='average',phase=0,t0=0)06019175693960656089ic_uhfqa0.awg0249.00.0SSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=*,_acq_0_sample:0.0_phase:0.0
3IdlePulse(duration=1e-06)_acq_0Nonecl0.baseband3,113.3 ns1,000.0 nsFalseIdlePulse(duration=1e-06)0894082367168206916NonenannanIdlePulse(duration=1e-06)_acq_0_sample:nan_phase:0.0
4SquarePulse(amp=0.3333333333333333,duration=1e-06,port='q0:res',clock='q0.ro',reference_magnitude=None,t0=0)_acq_0q0:resq0.ro4,113.3 ns1,000.0 nsFalseSquarePulse(amp=0.3333333333333333,duration=1e-06,port='q0:res',clock='q0.ro',reference_magnitude=None,t0=0)0-332917405313320243ic_uhfqa0.awg0925.04.0SquarePulse(amp=0.3333333333333333,duration=1e-06,port='q0:res',clock='q0.ro',reference_magnitude=None,t0=0)_acq_0_sample:4.0_phase:0.0
5SSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=1,bin_mode='average',phase=0,t0=0)_acq_0q0:resq0.ro4,213.3 ns2,000.0 nsTrueSSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=1,bin_mode='average',phase=0,t0=0)0-2435547926867543021ic_uhfqa0.awg0948.0-0.0SSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=*,_acq_0_sample:0.0_phase:0.0
6IdlePulse(duration=1e-06)_acq_0Nonecl0.baseband6,220.0 ns1,000.0 nsFalseIdlePulse(duration=1e-06)0894082367168206916NonenannanIdlePulse(duration=1e-06)_acq_0_sample:nan_phase:0.0
7SquarePulse(amp=0.6666666666666666,duration=1e-06,port='q0:res',clock='q0.ro',reference_magnitude=None,t0=0)_acq_0q0:resq0.ro7,220.0 ns1,000.0 nsFalseSquarePulse(amp=0.6666666666666666,duration=1e-06,port='q0:res',clock='q0.ro',reference_magnitude=None,t0=0)0-3727799718454013081ic_uhfqa0.awg01,624.04.0SquarePulse(amp=0.6666666666666666,duration=1e-06,port='q0:res',clock='q0.ro',reference_magnitude=None,t0=0)_acq_0_sample:4.0_phase:0.0
8SSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=2,bin_mode='average',phase=0,t0=0)_acq_0q0:resq0.ro7,320.0 ns2,000.0 nsTrueSSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=2,bin_mode='average',phase=0,t0=0)06363080616616400370ic_uhfqa0.awg01,647.0-0.0SSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=*,_acq_0_sample:0.0_phase:0.0
9IdlePulse(duration=1e-06)_acq_0Nonecl0.baseband9,326.7 ns1,000.0 nsFalseIdlePulse(duration=1e-06)0894082367168206916NonenannanIdlePulse(duration=1e-06)_acq_0_sample:nan_phase:0.0
10SquarePulse(amp=1.0,duration=1e-06,port='q0:res',clock='q0.ro',reference_magnitude=None,t0=0)_acq_0q0:resq0.ro10,326.7 ns1,000.0 nsFalseSquarePulse(amp=1.0,duration=1e-06,port='q0:res',clock='q0.ro',reference_magnitude=None,t0=0)03040913832356527230ic_uhfqa0.awg02,323.04.0SquarePulse(amp=1.0,duration=1e-06,port='q0:res',clock='q0.ro',reference_magnitude=None,t0=0)_acq_0_sample:4.0_phase:0.0
11SSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=3,bin_mode='average',phase=0,t0=0)_acq_0q0:resq0.ro10,426.7 ns2,000.0 nsTrueSSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=3,bin_mode='average',phase=0,t0=0)0-4858210094801046156ic_uhfqa0.awg02,346.00.0SSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=2e-06,acq_channel=0,acq_index=*,_acq_0_sample:0.0_phase:0.0
\n" ], "text/plain": [ "\u001b[1m<\u001b[0m\u001b[1;95mpandas.io.formats.style.Styler\u001b[0m\u001b[39m object at \u001b[0m\u001b[1;36m0x7948911711f0\u001b[0m\u001b[1m>\u001b[0m" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from quantify_scheduler.schedules.verification import acquisition_staircase_sched\n", "\n", "acq_channel = 0\n", "schedule = acquisition_staircase_sched(\n", " readout_pulse_amps=np.linspace(0, 1, 4),\n", " readout_pulse_duration=1e-6,\n", " readout_frequency=6e9,\n", " acquisition_delay=100e-9,\n", " integration_time=2e-6,\n", " port=\"q0:res\",\n", " clock=\"q0.ro\",\n", " repetitions=1024,\n", " acq_channel=acq_channel,\n", ")\n", "\n", "\n", "comp_sched = compiler.compile(\n", " schedule=schedule, config=quantum_device.generate_compilation_config()\n", ")\n", "\n", "comp_sched.hardware_timing_table" ] } ], "metadata": { "file_format": "mystnb", "kernelspec": { "display_name": "python3", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.20" }, "source_map": [ 6, 18, 28, 87, 101, 159, 163, 184, 190, 196, 204, 209, 213, 218, 224, 229, 233, 243, 248, 256, 268, 274, 335 ] }, "nbformat": 4, "nbformat_minor": 5 }