operations#

Submodules#

Package Contents#

Classes#

ConditionalOperation

Conditional over another operation.

StitchedPulseBuilder

Incrementally construct a StitchedPulse using pulse and offset operations.

Functions#

long_ramp_pulse(...)

Creates a long ramp pulse by stitching together shorter ramps.

long_square_pulse(...)

Create a long square pulse using DC voltage offsets.

staircase_pulse(...)

Create a staircase-shaped pulse using DC voltage offsets.

class ConditionalOperation(body: quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule, qubit_name: str, t0: float = 0.0)[source]#

Bases: 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.

Parameters:
  • body – Operation to be conditionally played

  • qubit_name – Name of the qubit on which the body will be conditioned

  • t0 – Time offset, by default 0

Example

A conditional reset can be implemented as follows:

example

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[source]#

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 StitchedPulse object, containing a combination of voltage offsets and waveforms. Overlapping StitchedPulses on the same port and clock may lead to unexpected results.

Parameters:
  • amp (float) – Amplitude of the ramp envelope function.

  • duration (float) – The pulse duration in seconds.

  • port (str) – Port of the pulse.

  • offset (float, optional) – Starting point of the ramp pulse. By default 0.

  • clock (str, optional) – Clock used to modulate the pulse, by default the baseband clock.

  • t0 (float, optional) – Time in seconds when to start the pulses relative to the start time of the Operation in the Schedule. By default 0.

  • part_duration_ns (int, optional) – Duration of each partial ramp in nanoseconds, by default STITCHED_PULSE_PART_DURATION_NS.

  • reference_magnitude (optional) – Scaling value and unit for the unitless amplitude. Uses settings in hardware config if not provided.

Returns:

A StitchedPulse composed of shorter ramp pulses with varying DC offsets, forming one long ramp pulse.

Return type:

StitchedPulse

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[source]#

Create a long square pulse using DC voltage offsets.

Warning

This function creates a StitchedPulse object, containing a combination of voltage offsets and waveforms. Overlapping StitchedPulses on the same port and clock may lead to unexpected results.

Parameters:
  • amp (float) – Amplitude of the envelope.

  • duration (float) – The pulse duration in seconds.

  • port (str) – Port of the pulse, must be capable of playing a complex waveform.

  • clock (str, optional) – Clock used to modulate the pulse. By default the baseband clock.

  • t0 (float, optional) – Time in seconds when to start the pulses relative to the start time of the Operation in the Schedule. By default 0.

  • reference_magnitude (optional) – Scaling value and unit for the unitless amplitude. Uses settings in hardware config if not provided.

Returns:

A StitchedPulse object containing an offset instruction with the specified amplitude.

Return type:

StitchedPulse

Raises:

ValueError – When the duration of the pulse is not a multiple of grid_time_ns.

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[source]#

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 StitchedPulse object, containing a combination of voltage offsets and waveforms. Overlapping StitchedPulses on the same port and clock may lead to unexpected results.

Parameters:
  • start_amp (float) – Starting amplitude of the staircase envelope function.

  • final_amp (float) – Final amplitude of the staircase envelope function.

  • num_steps (int) – The number of plateaus.

  • duration (float) – Duration of the pulse in seconds.

  • port (str) – Port of the pulse.

  • clock (str, optional) – Clock used to modulate the pulse. By default the baseband clock.

  • t0 (float, optional) – Time in seconds when to start the pulses relative to the start time of the Operation in the Schedule. By default 0.

  • min_operation_time_ns (int, optional) – 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.

  • reference_magnitude (optional) – Scaling value and unit for the unitless amplitude. Uses settings in hardware config if not provided.

Returns:

A StitchedPulse object containing incrementing or decrementing offset instructions.

Return type:

StitchedPulse

Raises:

ValueError – When the duration of a step is not a multiple of grid_time_ns.

class StitchedPulseBuilder(name: str | None = None, port: str | None = None, clock: str | None = None, t0: float = 0.0)[source]#

Incrementally construct a StitchedPulse using pulse and offset operations.

Parameters:
  • port (str or None, optional) – Port of the stitched pulse. This can also be added later through set_port(). By default None.

  • clock (str or None, optional) – Clock used to modulate the stitched pulse. This can also be added later through set_clock(). By default None.

  • t0 (float, optional) – 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 set_t0(). By default None.

_name#
_port#
_clock#
_t0#
_pulses: list[quantify_scheduler.operations.operation.Operation] = []#
_offsets: list[_VoltageOffsetInfo] = []#
set_port(port: str) StitchedPulseBuilder[source]#

Set the port for all parts of the StitchedPulse.

Parameters:

port (str) – Port of the stitched pulse.

Return type:

StitchedPulseBuilder

set_clock(clock: str) StitchedPulseBuilder[source]#

Set the clock for all parts of the StitchedPulse.

Parameters:

clock (str) – Clock used to modulate the stitched pulse.

Return type:

StitchedPulseBuilder

set_t0(t0: float) StitchedPulseBuilder[source]#

Set the start time of the whole StitchedPulse.

Parameters:

t0 (float) – Time in seconds when to start the pulses relative to the start time of the Operation in the Schedule.

Return type:

StitchedPulseBuilder

add_pulse(pulse: quantify_scheduler.operations.operation.Operation, append: bool = True) StitchedPulseBuilder[source]#

Add an Operation to the StitchedPulse that is a valid pulse.

Parameters:
  • pulse (Operation) – The Operation to add.

  • append (bool, optional) – 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.

Return type:

StitchedPulseBuilder

Raises:

RuntimeError – If the Operation is not a pulse.

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[source]#

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 Voltage offsets.

Parameters:
  • path_I (float) – The offset on path I of the sequencer.

  • path_Q (float) – The offset on path Q of the sequencer.

  • duration (float or None, optional) – 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.

  • rel_time (float, optional) – 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.

  • append (bool, optional) – 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.

  • min_duration (float, optional) – The minimal duration of the voltage offset. By default equal to the grid time of Qblox modules.

  • reference_magnitude (optional) – Scaling value and unit for the unitless amplitude. Uses settings in hardware config if not provided.

Return type:

StitchedPulseBuilder

Raises:
  • ValueError – If the duration is specified and not at least min_duration.

  • RuntimeError – If the offset overlaps in time with a previously added offset.

property operation_end: 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.

_distribute_port_clock() None[source]#
_distribute_t0(offsets: list[quantify_scheduler.operations.pulse_library.VoltageOffset]) None[source]#
_build_voltage_offset_operations() list[quantify_scheduler.operations.pulse_library.VoltageOffset][source]#

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.

_overlaps_with_existing_offsets(offset: _VoltageOffsetInfo) bool[source]#
build() StitchedPulse[source]#

Build the StitchedPulse.

Return type:

StitchedPulse