operations ========== .. py:module:: quantify_scheduler.qblox.operations .. autoapi-nested-parse:: Module containing qblox specific operations. Package Contents ---------------- Classes ~~~~~~~ .. autoapisummary:: quantify_scheduler.qblox.operations.ConditionalReset quantify_scheduler.qblox.operations.LatchReset quantify_scheduler.qblox.operations.SimpleNumericalPulse quantify_scheduler.qblox.operations.StitchedPulse quantify_scheduler.qblox.operations.StitchedPulseBuilder Functions ~~~~~~~~~ .. autoapisummary:: quantify_scheduler.qblox.operations.convert_to_numerical_pulse .. py:class:: ConditionalReset(qubit_name: str, name: str = 'conditional_reset', **kwargs) Bases: :py:obj:`quantify_scheduler.schedules.schedule.Schedule` Reset a qubit to the :math:`|0\rangle` state. The :class:`~quantify_scheduler.backends.qblox.operations.gate_library.ConditionalReset` gate is a conditional gate that first measures the state of the qubit using an :class:`~quantify_scheduler.operations.acquisition_library.ThresholdedAcquisition` operation and then performs a :math:`\pi` rotation on the condition that the measured state is :math:`|1\rangle`. If the measured state is in :math:`|0\rangle`, the hardware will wait the same amount of time the :math:`\pi` rotation would've taken to ensure that total execution time of :class:`~quantify_scheduler.backends.qblox.operations.gate_library.ConditionalReset` is the same regardless of the measured state. .. note:: The total time of the the ConditionalReset is the sum of 1) integration time (.measure.integration_time) 2) acquisition delay (.measure.acq_delay) 3) trigger delay (364ns) 4) pi-pulse duration (.rxy.duration) 5) idle time (4ns) .. note:: Due to current hardware limitations, overlapping conditional resets might not work correctly if multiple triggers are sent within a 364ns window. See :ref:`sec-qblox-conditional-playback` for more information. .. note:: :class:`~quantify_scheduler.backends.qblox.operations.gate_library.ConditionalReset` is currently implemented as a subschedule, but can be added to an existing schedule as if it were a gate. See examples below. :param name: The name of the conditional subschedule, by default "conditional_reset". :type name: str :param qubit_name: The name of the qubit to reset to the :math:`|0\rangle` state. :type qubit_name: str :param \*\*kwargs: Additional keyword arguments are passed to :class:`~quantify_scheduler.operations.gate_library.Measure`. e.g. ``acq_channel``, ``acq_index``, and ``bin_mode``. .. rubric:: Examples .. admonition:: Examples .. jupyter-execute:: :hide-output: from quantify_scheduler.backends.qblox.operations.gate_library import ConditionalReset from quantify_scheduler.schedules.schedule import Schedule schedule = Schedule("example schedule") schedule.add(ConditionalReset("q0")) .. py:class:: LatchReset(portclock: tuple[str, str], t0: float = 0, duration: float = 4e-09) Bases: :py:obj:`quantify_scheduler.operations.operation.Operation` Operation that resets the feedback trigger addresses from the hardware. Currently only implemented for Qblox backend, refer to :class:`~quantify_scheduler.backends.qblox.operation_handling.virtual.ResetFeedbackTriggersStrategy` for more details. .. py:class:: SimpleNumericalPulse(samples: numpy.ndarray | list, port: str, clock: str = BasebandClockResource.IDENTITY, reference_magnitude: quantify_scheduler.operations.pulse_library.ReferenceMagnitude | None = None, t0: float = 0) Bases: :py:obj:`quantify_scheduler.operations.pulse_library.NumericalPulse` Wrapper on top of NumericalPulse to provide a simple interface for creating a pulse where the samples correspond 1:1 to the produced waveform, without needing to specify the time samples. :param samples: An array of (possibly complex) values specifying the shape of the pulse. :param port: The port that the pulse should be played on. :param clock: Clock used to (de)modulate the pulse. By default the baseband clock. :param reference_magnitude: Scaling value and unit for the unitless samples. Uses settings in hardware config if not provided. :param t0: Time in seconds when to start the pulses relative to the start time of the Operation in the Schedule. .. rubric:: Example .. jupyter-execute:: from quantify_scheduler.backends.qblox.operations.pulse_library import SimpleNumericalPulse from quantify_scheduler import Schedule waveform = [0.1,0.2,0.2,0.3,0.5,0.4] schedule = Schedule("") schedule.add(SimpleNumericalPulse(waveform, port="q0:out")) .. py:class:: StitchedPulse(name: str | None = None, pulse_info: list[Any] | None = None) Bases: :py:obj:`quantify_scheduler.operations.operation.Operation` A pulse composed of multiple operations that together constitute a waveform. This class can be used to construct arbitrarily long waveforms by stitching together pulses with optional changes in offset in between. :param name: An optional name for the pulse. :type name: str or None, optional :param pulse_info: A list containing the pulses that are part of the StitchedPulse. By default None. :type pulse_info: list[Any] or None, optional .. py:method:: add_pulse(pulse_operation: quantify_scheduler.operations.operation.Operation) -> None Adds pulse_info of pulse_operation Operation to this Operation. :param pulse_operation: an operation containing pulse_info. :type pulse_operation: Operation :raises ValueError: When the operation's port and/or clock do not match those of the previously added SitchedPulse components. .. py:method:: _pulse_and_clock_match(operation_info: list[dict[str, Any]]) -> bool Check operation's port and clock match with StitchedPulse or if it's empty. .. py:class:: StitchedPulseBuilder(name: str | None = None, port: str | None = None, clock: str | None = None, t0: float = 0.0) Incrementally construct a StitchedPulse using pulse and offset operations. :param port: Port of the stitched pulse. This can also be added later through :meth:`~.set_port`. By default None. :type port: str or None, optional :param clock: Clock used to modulate the stitched pulse. This can also be added later through :meth:`~.set_clock`. By default None. :type clock: str or None, optional :param t0: Time in seconds when to start the pulses relative to the start time of the Operation in the Schedule. This can also be added later through :meth:`~.set_t0`. By default None. :type t0: float, optional .. py:attribute:: _name .. py:attribute:: _port .. py:attribute:: _clock .. py:attribute:: _t0 .. py:attribute:: _pulses :type: list[quantify_scheduler.operations.operation.Operation] :value: [] .. py:attribute:: _offsets :type: list[_VoltageOffsetInfo] :value: [] .. py:method:: set_port(port: str) -> StitchedPulseBuilder Set the port for all parts of the StitchedPulse. :param port: Port of the stitched pulse. :type port: str :rtype: StitchedPulseBuilder .. py:method:: set_clock(clock: str) -> StitchedPulseBuilder Set the clock for all parts of the StitchedPulse. :param clock: Clock used to modulate the stitched pulse. :type clock: str :rtype: StitchedPulseBuilder .. py:method:: set_t0(t0: float) -> StitchedPulseBuilder Set the start time of the whole StitchedPulse. :param t0: Time in seconds when to start the pulses relative to the start time of the Operation in the Schedule. :type t0: float :rtype: StitchedPulseBuilder .. py:method:: add_pulse(pulse: quantify_scheduler.operations.operation.Operation, append: bool = True) -> StitchedPulseBuilder Add an Operation to the StitchedPulse that is a valid pulse. :param pulse: The Operation to add. :type pulse: Operation :param append: Specifies whether to append the operation to the end of the StitchedPulse, or to insert it at a time relative to the start of the StitchedPulse, specified by the pulse's t0 attribute. By default True. :type append: bool, optional :rtype: StitchedPulseBuilder :raises RuntimeError: If the Operation is not a pulse. .. py:method:: add_voltage_offset(path_I: float, path_Q: float, duration: float | None = None, rel_time: float = 0.0, append: bool = True, min_duration: float = constants.MIN_TIME_BETWEEN_OPERATIONS * 1e-09, reference_magnitude: quantify_scheduler.operations.pulse_library.ReferenceMagnitude | None = None) -> StitchedPulseBuilder Add a DC voltage offset to the StitchedPulse. .. note:: If the voltage offset is not zero at the end of the StitchedPulse, the StitchedPulseBuilder will automatically add a zero voltage offset operation at the end. In that case, the StitchedPulse operation cannot be used at the very end of a Schedule or a control-flow block. For more information, please see :ref:`sec-qblox-offsets-long-voltage-offsets`. :param path_I: The offset on path I of the sequencer. :type path_I: float :param path_Q: The offset on path Q of the sequencer. :type path_Q: float :param duration: Specifies how long to maintain the offset. The StitchedPulseBuilder will add a zero voltage offset operation after the specified duration. If set to None, the offset voltage offset will hold until the end of the StitchedPulse. By default None. :type duration: float or None, optional :param rel_time: Specifies when to set the offset, relative to the current end of the StitchedPulse (if ``append = True``), or to the start of the StitchedPulse (if ``append = False``). By default 0.0. :type rel_time: float, optional :param append: Specifies whether to append the operation to the end of the StitchedPulse, or to insert it at a time relative to the start of the StitchedPulse, specified by the the rel_time argument. By default True. :type append: bool, optional :param min_duration: The minimal duration of the voltage offset. By default equal to the grid time of Qblox modules. :type min_duration: float, optional :param reference_magnitude: Scaling value and unit for the unitless amplitude. Uses settings in hardware config if not provided. :type reference_magnitude: optional :rtype: StitchedPulseBuilder :raises ValueError: If the duration is specified and not at least ``min_duration``. :raises RuntimeError: If the offset overlaps in time with a previously added offset. .. py:property:: operation_end :type: float Determine the end time of an operation based on its pulses and offsets. For pulses, the end time is calculated as the start time (`t0`) plus the pulse duration. For offsets, it uses the start time (`t0`) and, if provided, adds the duration. If no duration is specified for an offset, it assumes a default value of 0.0. :returns: The maximum end time considering all pulses and offsets. .. py:method:: _distribute_port_clock() -> None .. py:method:: _distribute_t0(offsets: list[quantify_scheduler.operations.pulse_library.VoltageOffset]) -> None .. py:method:: _build_voltage_offset_operations() -> list[quantify_scheduler.operations.pulse_library.VoltageOffset] Add offset instructions that reset any offset that had a specified duration. If an offset was added without a duration, it is assumed that its duration should be until the end of the StitchedPulse, and any following offsets that _do_ have a duration will be reset to this value. Otherwise, offsets with a duration will be reset to 0. At the end of the StitchedPulse, the offset will be reset to 0. An offset does not need to be reset, if at the end of its duration, another offset instruction starts. This method requires the port and clock to have been set. .. py:method:: _overlaps_with_existing_offsets(offset: _VoltageOffsetInfo) -> bool .. py:method:: build() -> StitchedPulse Build the StitchedPulse. :rtype: StitchedPulse .. py:function:: convert_to_numerical_pulse(operation: quantify_scheduler.operations.operation.Operation, scheduled_at: float = 0.0, sampling_rate: float = 1000000000.0) -> quantify_scheduler.operations.operation.Operation Convert an operation with pulses and voltage offsets to a :class:`~.NumericalPulse`. If the operation also contains gate_info and/or acquisition_info, the original operation type is returned with only the pulse_info replaced by that of a NumericalPulse. The :class:`~.StitchedPulse`, and possibly other pulses, can contain descriptions for DC voltage offsets in the pulse info list. Not all functionality in :mod:`quantify_scheduler` supports such operations. For the cases where DC offset operations are not supported, this function can be used to convert the operation to a :class:`~.NumericalPulse`. :param operation: The operation to be converted. :type operation: Operation :param scheduled_at: The scheduled play time of the operation. The resulting NumericalPulse can be sampled from this time until the end of its duration. By default 0.0. :type scheduled_at: float, optional :param sampling_rate: The rate with which to sample the input operation. By default 1e9 (1 GHz). :type sampling_rate: float, optional :returns: **converted_operation** -- The converted operation containing the sampled pulse information of the input operation. If the original operation only contained pulse_info and no gate_info or acquisition_info, a NumericalPulse is returned. Otherwise, the input type is returned with the pulse_info replaced by that of a NumericalPulse. :rtype: Operation