stitched_pulse ============== .. py:module:: quantify_scheduler.operations.stitched_pulse Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: quantify_scheduler.operations.stitched_pulse.StitchedPulse quantify_scheduler.operations.stitched_pulse._VoltageOffsetInfo quantify_scheduler.operations.stitched_pulse.StitchedPulseBuilder Functions ~~~~~~~~~ .. autoapisummary:: quantify_scheduler.operations.stitched_pulse.convert_to_numerical_pulse .. py:class:: StitchedPulse(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 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 if the port and clock of an operation match the ports and clocks of the operations already present in the StitchedPulse. Returns True if the StitchedPulse is still empty. .. 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 .. py:class:: _VoltageOffsetInfo .. py:attribute:: path_0 :type: float .. py:attribute:: path_1 :type: float .. py:attribute:: t0 :type: float .. py:attribute:: duration :type: float | None .. py:attribute:: reference_magnitude :type: quantify_scheduler.operations.pulse_library.ReferenceMagnitude | None .. py:class:: StitchedPulseBuilder(port: str | None = None, clock: str | None = None, t0: float = 0.0) The StitchedPulseBuilder can be used to create a StitchedPulse incrementally by adding 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:property:: operation_end :type: float .. 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_0: float, path_1: float, duration: float | None = None, rel_time: float = 0.0, append: bool = True, min_duration: float = qblox_constants.GRID_TIME * 1e-09, reference_magnitude: quantify_scheduler.operations.pulse_library.ReferenceMagnitude | None = None) -> StitchedPulseBuilder Add a DC voltage offset to the StitchedPulse. :param path_0: The offset on path 0 of the sequencer. :type path_0: float :param path_1: The offset on path 1 of the sequencer. :type path_1: float :param duration: Specifies how long to maintain the offset. 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: :class:`~quantify_scheduler.operations.pulse_library.ReferenceMagnitude`, optional :rtype: StitchedPulseBuilder :raises ValueError: If the duration is not at least ``min_duration``. :raises RuntimeError: If the offset overlaps in time with a previously added offset. .. py:method:: _distribute_port_clock() -> None .. py:method:: _distribute_t0() -> 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. .. py:method:: _overlaps_with_existing_offsets(offset: _VoltageOffsetInfo) -> bool .. py:method:: build() -> StitchedPulse Build the StitchedPulse. :rtype: StitchedPulse