operations#
Module containing qblox specific operations.
Package Contents#
Classes#
Reset a qubit to the \(|0\rangle\) state. |
|
Operation that resets the feedback trigger addresses from the hardware. |
|
Wrapper on top of NumericalPulse to provide a simple interface for creating a pulse |
|
A pulse composed of multiple operations that together constitute a waveform. |
|
Incrementally construct a StitchedPulse using pulse and offset operations. |
Functions#
Convert an operation with pulses and voltage offsets to a |
- class ConditionalReset(qubit_name: str, name: str = 'conditional_reset', **kwargs)[source]#
Bases:
quantify_scheduler.schedules.schedule.Schedule
Reset a qubit to the \(|0\rangle\) state.
The
ConditionalReset
gate is a conditional gate that first measures the state of the qubit using anThresholdedAcquisition
operation and then performs a \(\pi\) rotation on the condition that the measured state is \(|1\rangle\). If the measured state is in \(|0\rangle\), the hardware will wait the same amount of time the \(\pi\) rotation would’ve taken to ensure that total execution time ofConditionalReset
is the same regardless of the measured state.Note
The total time of the the ConditionalReset is the sum of
integration time (<qubit>.measure.integration_time)
acquisition delay (<qubit>.measure.acq_delay)
trigger delay (364ns)
pi-pulse duration (<qubit>.rxy.duration)
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 Conditional Playback for more information.
Note
ConditionalReset
is currently implemented as a subschedule, but can be added to an existing schedule as if it were a gate. See examples below.- Parameters:
Examples
Examples
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"))
- class LatchReset(portclock: tuple[str, str], t0: float = 0, duration: float = 4e-09)[source]#
Bases:
quantify_scheduler.operations.operation.Operation
Operation that resets the feedback trigger addresses from the hardware.
Currently only implemented for Qblox backend, refer to
ResetFeedbackTriggersStrategy
for more details.
- 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)[source]#
Bases:
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.
- Parameters:
samples – An array of (possibly complex) values specifying the shape of the pulse.
port – The port that the pulse should be played on.
clock – Clock used to (de)modulate the pulse. By default the baseband clock.
reference_magnitude – Scaling value and unit for the unitless samples. Uses settings in hardware config if not provided.
t0 – Time in seconds when to start the pulses relative to the start time of the Operation in the Schedule.
Example
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"))
{'name': 'e55a293c-1892-44a7-8fd2-78d5d18ba460', 'operation_id': '7123301496608116143', 'timing_constraints': [{'rel_time': 0, 'ref_schedulable': None, 'ref_pt_new': None, 'ref_pt': None}], 'label': 'e55a293c-1892-44a7-8fd2-78d5d18ba460'}
- class StitchedPulse(name: str | None = None, pulse_info: list[Any] | None = None)[source]#
Bases:
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.
- Parameters:
- add_pulse(pulse_operation: quantify_scheduler.operations.operation.Operation) None [source]#
Adds pulse_info of pulse_operation Operation to this Operation.
- Parameters:
pulse_operation (Operation) – an operation containing pulse_info.
- Raises:
ValueError – When the operation’s port and/or clock do not match those of the previously added SitchedPulse components.
- 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:
- 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:
- 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:
- 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:
- Return type:
- 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 (ifappend = 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:
- 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_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:
- 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 [source]#
Convert an operation with pulses and voltage offsets to a
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
StitchedPulse
, and possibly other pulses, can contain descriptions for DC voltage offsets in the pulse info list. Not all functionality inquantify_scheduler
supports such operations. For the cases where DC offset operations are not supported, this function can be used to convert the operation to aNumericalPulse
.- Parameters:
operation (Operation) – The operation to be converted.
scheduled_at (float, optional) – 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.
sampling_rate (float, optional) – The rate with which to sample the input operation. By default 1e9 (1 GHz).
- 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.
- Return type: