operations ========== .. py:module:: quantify_scheduler.backends.qblox.operations Submodules ---------- .. toctree:: :titlesonly: :maxdepth: 1 control_flow_library/index.rst gate_library/index.rst pulse_factories/index.rst pulse_library/index.rst stitched_pulse/index.rst Package Contents ---------------- Classes ~~~~~~~ .. autoapisummary:: quantify_scheduler.backends.qblox.operations.ConditionalOperation quantify_scheduler.backends.qblox.operations.StitchedPulseBuilder Functions ~~~~~~~~~ .. autoapisummary:: quantify_scheduler.backends.qblox.operations.long_ramp_pulse quantify_scheduler.backends.qblox.operations.long_square_pulse quantify_scheduler.backends.qblox.operations.staircase_pulse .. py:class:: ConditionalOperation(body: quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule, qubit_name: str, t0: float = 0.0) Bases: :py:obj:`quantify_scheduler.operations.control_flow_library.ConditionalOperation` Conditional over another operation. If a preceding thresholded acquisition on ``qubit_name`` results in a "1", the body will be executed, otherwise it will generate a wait time that is equal to the time of the subschedule, to ensure the absolute timing of later operations remains consistent. :param body: Operation to be conditionally played :param qubit_name: Name of the qubit on which the body will be conditioned :param t0: Time offset, by default 0 .. rubric:: Example A conditional reset can be implemented as follows: .. admonition:: example .. jupyter-execute # relevant imports from quantify_scheduler import Schedule from quantify_scheduler.backends.qblox.operations import ConditionalOperation from quantify_scheduler.operations.gate_library import Measure, X # define conditional reset as a Schedule conditional_reset = Schedule("conditional reset") conditional_reset.add(Measure("q0", feedback_trigger_label="q0")) conditional_reset.add( ConditionalOperation(body=X("q0"), qubit_name="q0"), rel_time=364e-9, ) .. py:function:: long_ramp_pulse(amp: float, duration: float, port: str, offset: float = 0, clock: str = BasebandClockResource.IDENTITY, t0: float = 0, part_duration_ns: int = constants.STITCHED_PULSE_PART_DURATION_NS, reference_magnitude: quantify_scheduler.operations.pulse_library.ReferenceMagnitude | None = None) -> quantify_scheduler.backends.qblox.operations.stitched_pulse.StitchedPulse Creates a long ramp pulse by stitching together shorter ramps. This function creates a long ramp pulse by stitching together ramp pulses of the specified duration ``part_duration_ns``, with DC voltage offset instructions placed in between. .. warning:: This function creates a :class:`~quantify_scheduler.backends.qblox.operations.stitched_pulse.StitchedPulse` object, containing a combination of voltage offsets and waveforms. Overlapping StitchedPulses on the same port and clock may lead to unexpected results. :param amp: Amplitude of the ramp envelope function. :type amp: float :param duration: The pulse duration in seconds. :type duration: float :param port: Port of the pulse. :type port: str :param offset: Starting point of the ramp pulse. By default 0. :type offset: float, optional :param clock: Clock used to modulate the pulse, by default the baseband clock. :type clock: str, optional :param t0: Time in seconds when to start the pulses relative to the start time of the Operation in the Schedule. By default 0. :type t0: float, optional :param part_duration_ns: Duration of each partial ramp in nanoseconds, by default :class:`~quantify_scheduler.backends.qblox.constants.STITCHED_PULSE_PART_DURATION_NS`. :type part_duration_ns: int, optional :param reference_magnitude: Scaling value and unit for the unitless amplitude. Uses settings in hardware config if not provided. :type reference_magnitude: optional :returns: A ``StitchedPulse`` composed of shorter ramp pulses with varying DC offsets, forming one long ramp pulse. :rtype: StitchedPulse .. py:function:: long_square_pulse(amp: float, duration: float, port: str, clock: str = BasebandClockResource.IDENTITY, t0: float = 0, reference_magnitude: quantify_scheduler.operations.pulse_library.ReferenceMagnitude | None = None) -> quantify_scheduler.backends.qblox.operations.stitched_pulse.StitchedPulse Create a long square pulse using DC voltage offsets. .. warning:: This function creates a :class:`~quantify_scheduler.backends.qblox.operations.stitched_pulse.StitchedPulse` object, containing a combination of voltage offsets and waveforms. Overlapping StitchedPulses on the same port and clock may lead to unexpected results. :param amp: Amplitude of the envelope. :type amp: float :param duration: The pulse duration in seconds. :type duration: float :param port: Port of the pulse, must be capable of playing a complex waveform. :type port: str :param clock: Clock used to modulate the pulse. By default the baseband clock. :type clock: str, optional :param t0: Time in seconds when to start the pulses relative to the start time of the Operation in the Schedule. By default 0. :type t0: 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 :returns: A StitchedPulse object containing an offset instruction with the specified amplitude. :rtype: StitchedPulse :raises ValueError: When the duration of the pulse is not a multiple of ``grid_time_ns``. .. py:function:: staircase_pulse(start_amp: float, final_amp: float, num_steps: int, duration: float, port: str, clock: str = BasebandClockResource.IDENTITY, t0: float = 0, min_operation_time_ns: int = constants.MIN_TIME_BETWEEN_OPERATIONS, reference_magnitude: quantify_scheduler.operations.pulse_library.ReferenceMagnitude | None = None) -> quantify_scheduler.backends.qblox.operations.stitched_pulse.StitchedPulse Create a staircase-shaped pulse using DC voltage offsets. This function generates a real valued staircase pulse, which reaches its final amplitude in discrete steps. In between it will maintain a plateau. .. warning:: This function creates a :class:`~quantify_scheduler.backends.qblox.operations.stitched_pulse.StitchedPulse` object, containing a combination of voltage offsets and waveforms. Overlapping StitchedPulses on the same port and clock may lead to unexpected results. :param start_amp: Starting amplitude of the staircase envelope function. :type start_amp: float :param final_amp: Final amplitude of the staircase envelope function. :type final_amp: float :param num_steps: The number of plateaus. :type num_steps: int :param duration: Duration of the pulse in seconds. :type duration: float :param port: Port of the pulse. :type port: str :param clock: Clock used to modulate the pulse. By default the baseband clock. :type clock: str, optional :param t0: Time in seconds when to start the pulses relative to the start time of the Operation in the Schedule. By default 0. :type t0: float, optional :param min_operation_time_ns: Min operation time in ns. The duration of the long_square_pulse must be a multiple of this. By default equal to the min operation time time of Qblox modules. :type min_operation_time_ns: int, optional :param reference_magnitude: Scaling value and unit for the unitless amplitude. Uses settings in hardware config if not provided. :type reference_magnitude: optional :returns: A StitchedPulse object containing incrementing or decrementing offset instructions. :rtype: StitchedPulse :raises ValueError: When the duration of a step is not a multiple of ``grid_time_ns``. .. 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