common ====== .. py:module:: quantify_scheduler.backends.types.common .. autoapi-nested-parse:: Common python dataclasses for multiple backends. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: quantify_scheduler.backends.types.common.DistortionCorrection quantify_scheduler.backends.types.common.ModulationFrequencies quantify_scheduler.backends.types.common.MixerCorrections quantify_scheduler.backends.types.common.HardwareOptions quantify_scheduler.backends.types.common.LocalOscillatorDescription quantify_scheduler.backends.types.common.IQMixerDescription quantify_scheduler.backends.types.common.HardwareDescription quantify_scheduler.backends.types.common.Connectivity quantify_scheduler.backends.types.common.HardwareCompilationConfig Attributes ~~~~~~~~~~ .. autoapisummary:: quantify_scheduler.backends.types.common.LatencyCorrection .. py:data:: LatencyCorrection Latency correction in seconds for a port-clock combination. Positive values delay the operations on the corresponding port-clock combination, while negative values shift the operation backwards in time with respect to other operations in the schedule. .. note:: If the port-clock combination of a signal is not specified in the corrections, it is set to zero in compilation. The minimum correction over all port-clock combinations is then subtracted to allow for negative latency corrections and to ensure minimal wait time (see :meth:`~quantify_scheduler.backends.corrections.determine_relative_latency_corrections`). .. admonition:: Example :class: dropdown Let's say we have specified two latency corrections in the CompilationConfig: .. code-block:: python compilation_config.hardware_options.latency_corrections = { "q0:res-q0.ro": LatencyCorrection(-20e-9), "q0:mw-q0.01": LatencyCorrection(120e9), } In this case, all operations on port ``"q0:mw"`` and clock ``"q0.01"`` will be delayed by 140 ns with respect to operations on port ``"q0:res"`` and clock ``"q0.ro"``. .. py:class:: DistortionCorrection(/, **data: Any) Bases: :py:obj:`quantify_scheduler.structure.model.DataStructure` Distortion correction information for a port-clock combination. .. admonition:: Example :class: dropdown .. jupyter-execute:: from quantify_scheduler.backends.types.common import ( DistortionCorrection ) distortion_corrections = { "q0:fl-cl0.baseband": DistortionCorrection( filter_func="scipy.signal.lfilter", input_var_name="x", kwargs={ "b": [0, 0.25, 0.5], "a": [1] }, clipping_values=[-2.5, 2.5] ) } .. py:attribute:: filter_func :type: str The function applied to the waveforms. .. py:attribute:: input_var_name :type: str The argument to which the waveforms will be passed in the filter_func. .. py:attribute:: kwargs :type: Dict[str, Union[List, quantify_scheduler.structure.types.NDArray]] The keyword arguments that are passed to the filter_func. .. py:attribute:: clipping_values :type: Optional[List] The optional boundaries to which the corrected pulses will be clipped, upon exceeding. .. py:attribute:: sampling_rate :type: float :value: 1000000000.0 The sample rate of the corrected pulse, in Hz. .. py:class:: ModulationFrequencies(/, **data: Any) Bases: :py:obj:`quantify_scheduler.structure.model.DataStructure` Modulation frequencies for a port-clock combination. .. admonition:: Example :class: dropdown .. jupyter-execute:: from quantify_scheduler.backends.types.common import ( ModulationFrequencies ) modulation_frequencies = { "q0:res-q0.ro": ModulationFrequencies( interm_freq=None, lo_freq=6e9, ) } .. py:attribute:: interm_freq :type: Optional[float] The intermodulation frequency (IF) used for this port-clock combination. .. py:attribute:: lo_freq :type: Optional[float] The local oscillator frequency (LO) used for this port-clock combination. .. py:class:: MixerCorrections(/, **data: Any) Bases: :py:obj:`quantify_scheduler.structure.model.DataStructure` Mixer corrections for a port-clock combination. .. admonition:: Example :class: dropdown .. jupyter-execute:: from quantify_scheduler.backends.types.common import ( MixerCorrections ) mixer_corrections = { "q0:mw-q0.01": MixerCorrections( dc_offset_i = -0.0542, dc_offset_q = -0.0328, amp_ratio = 0.95, phase_error= 0.07, ) } .. py:attribute:: dc_offset_i :type: float :value: 0.0 The DC offset on the I channel used for this port-clock combination. .. py:attribute:: dc_offset_q :type: float :value: 0.0 The DC offset on the Q channel used for this port-clock combination. .. py:attribute:: amp_ratio :type: float :value: 1.0 The mixer gain ratio used for this port-clock combination. .. py:attribute:: phase_error :type: float :value: 0.0 The mixer phase error used for this port-clock combination. .. py:class:: HardwareOptions(/, **data: Any) Bases: :py:obj:`quantify_scheduler.structure.model.DataStructure` Datastructure containing the hardware options for each port-clock combination. This datastructure contains the HardwareOptions that are currently shared among the existing backends. Subclassing is required to add backend-specific options, see e.g., :class:`~quantify_scheduler.backends.types.qblox.QbloxHardwareOptions`, :class:`~quantify_scheduler.backends.types.zhinst.ZIHardwareOptions`. .. py:attribute:: latency_corrections :type: Optional[Dict[str, LatencyCorrection]] Dictionary containing the latency corrections (values) that should be applied to operations on a certain port-clock combination (keys). .. py:attribute:: distortion_corrections :type: Optional[Dict[str, DistortionCorrection]] Dictionary containing the distortion corrections (values) that should be applied to waveforms on a certain port-clock combination (keys). .. py:attribute:: modulation_frequencies :type: Optional[Dict[str, ModulationFrequencies]] Dictionary containing the modulation frequencies (values) that should be used for signals on a certain port-clock combination (keys). .. py:attribute:: mixer_corrections :type: Optional[Dict[str, MixerCorrections]] Dictionary containing the mixer corrections (values) that should be used for signals on a certain port-clock combination (keys). .. py:class:: LocalOscillatorDescription(/, **data: Any) Bases: :py:obj:`quantify_scheduler.structure.model.DataStructure` Information needed to specify a Local Oscillator in the :class:`~.CompilationConfig`. .. py:attribute:: instrument_type :type: Literal[LocalOscillator] The field discriminator for this HardwareDescription datastructure. .. py:attribute:: instrument_name :type: Optional[str] The QCoDeS instrument name corresponding to this Local Oscillator. .. py:attribute:: generic_icc_name :type: Optional[str] The name of the :class:`~.GenericInstrumentCoordinatorComponent` corresponding to this Local Oscillator. .. py:attribute:: frequency_param :type: str :value: 'frequency' The QCoDeS parameter that is used to set the LO frequency. .. py:attribute:: power_param :type: str :value: 'power' The QCoDeS parameter that is used to set the LO power. .. py:attribute:: power :type: Optional[int] The power setting for this Local Oscillator. .. py:class:: IQMixerDescription(/, **data: Any) Bases: :py:obj:`quantify_scheduler.structure.model.DataStructure` Information needed to specify an IQ Mixer in the :class:`~.CompilationConfig`. .. py:attribute:: instrument_type :type: Literal[IQMixer] The field discriminator for this HardwareDescription datastructure. .. py:class:: HardwareDescription(/, **data: Any) Bases: :py:obj:`quantify_scheduler.structure.model.DataStructure` Specifies a piece of hardware and its instrument-specific settings. Each supported instrument type should have its own datastructure that inherits from this class. For examples, see :class:`~quantify_scheduler.backends.types.qblox.ClusterDescription`, :class:`~quantify_scheduler.backends.types.zhinst.ZIHDAWG4Description`, :class:`~.LocalOscillatorDescription`. This datastructure is used to specify the control-hardware ports that are included in the :class:`~.Connectivity` graph. .. py:attribute:: instrument_type :type: str The instrument type. .. py:class:: Connectivity(/, **data: Any) Bases: :py:obj:`quantify_scheduler.structure.model.DataStructure` Connectivity between ports on the quantum device and control hardware inputs/outputs. The connectivity graph can be parsed from a list of edges, which are given by a set of two strings that each correspond to an input/output on an instrument or a port on the quantum device. .. note:: To specify connections between more than one pair of ports at once, one can also specify a list of ports within the edge input (see example below, and also see :ref:`sec-connectivity-examples`). The connectivity graph can be drawn using :meth:`~.draw`, which groups the nodes according to the instrument name (specified by the string before the first ``"."`` in the node name; the name is omitted for the quantum device). .. admonition:: Example :class: dropdown .. jupyter-execute:: from quantify_scheduler.backends.types.common import ( Connectivity ) connectivity_dict = { "graph": [ ("awg0.channel_0", "q0:mw"), ("awg0.channel_1", "q1:mw"), ("rom0.channel_0", ["q0:res", "q1:res"]), ] } connectivity = Connectivity.model_validate(connectivity_dict) connectivity.draw() .. py:attribute:: graph :type: quantify_scheduler.structure.types.Graph The connectivity graph consisting of i/o ports (nodes) on the quantum device and on the control hardware, and their connections (edges). .. py:method:: _unroll_lists_of_ports_in_edges_input(graph) .. py:method:: draw(ax: Optional[matplotlib.axes.Axes] = None, figsize: Tuple[float, float] = (20, 10), **options) -> matplotlib.axes.Axes Draw the connectivity graph using matplotlib. The nodes are positioned using a multipartite layout, where the nodes are grouped by instrument (identified by the first part of the node name). :param ax: Matplotlib axis to plot the figure on. :param figsize: Optional figure size, defaults to something slightly larger that fits the size of the nodes. :param options: optional keyword arguments that are passed to :code:`networkx.draw_networkx`. :returns: Matplotlib axis on which the figure is plotted. .. py:class:: HardwareCompilationConfig(/, **data: Any) Bases: :py:obj:`quantify_scheduler.structure.model.DataStructure` Information required to compile a schedule to the control-hardware layer. From a point of view of :ref:`sec-compilation` this information is needed to convert a schedule defined on a quantum-device layer to compiled instructions that can be executed on the control hardware. This datastructure defines the overall structure of a ``HardwareCompilationConfig``. Specific hardware backends should customize fields within this structure by inheriting from this class and specifying their own `"config_type"`, see e.g., :class:`~quantify_scheduler.backends.qblox_backend.QbloxHardwareCompilationConfig`, :class:`~quantify_scheduler.backends.zhinst_backend.ZIHardwareCompilationConfig`. .. py:attribute:: config_type :type: Type[HardwareCompilationConfig] A reference to the ``HardwareCompilationConfig`` DataStructure for the backend that is used. .. py:attribute:: hardware_description :type: Dict[str, HardwareDescription] Datastructure describing the control hardware instruments in the setup and their high-level settings. .. py:attribute:: hardware_options :type: HardwareOptions The :class:`~HardwareOptions` used in the compilation from the quantum-device layer to the control-hardware layer. .. py:attribute:: connectivity :type: Union[Connectivity, Dict] Datastructure representing how ports on the quantum device are connected to ports on the control hardware. .. py:attribute:: compilation_passes :type: List[quantify_scheduler.backends.graph_compilation.SimpleNodeConfig] :value: [] The list of compilation nodes that should be called in succession to compile a schedule to instructions for the control hardware. .. py:method:: _serialize_backend_func(v) .. py:method:: _import_config_type_if_str(config_type: Type[HardwareCompilationConfig]) -> Callable[[quantify_scheduler.schedules.schedule.Schedule, Any], quantify_scheduler.schedules.schedule.Schedule] .. py:method:: _latencies_in_hardware_config(connectivity) .. py:method:: _distortions_in_hardware_config(connectivity) .. py:method:: _check_connectivity_graph_nodes_format() .. py:method:: _connectivity_old_style_hw_cfg_empty_hw_options_and_descriptions()