quantify_scheduler.operations.pulse_library
Standard pulse-level operations for use with the quantify_scheduler.
Module Contents
Classes
Dataclass which describes an amplitude / power reference level, with respect to |
|
An operation that shifts the phase of a clock by a specified amount. |
|
An operation that resets the phase of a clock. |
|
Operation that sets updates the frequency of a clock. This is a low-level operation |
|
Operation that represents setting a constant offset to the output voltage. |
|
The IdlePulse Operation is a placeholder for a specified duration of time. |
|
The RampPulse Operation is a real-valued pulse that ramps from the specified offset |
|
A real valued staircase pulse, which reaches it's final amplitude in discrete |
|
A representation of quantum circuit operations. |
|
The SquarePulse Operation is a real-valued pulse with the specified |
|
The sudden net-zero (SNZ) pulse from Neg\^ırneac et al. [2021]. |
|
The SoftSquarePulse Operation is a real valued square pulse convolved with |
|
A linear chirp signal. A sinusoidal signal that ramps up in frequency. |
|
DRAG pulse intended for single qubit gates in transmon based systems. |
|
The WindowOperation is an operation for visualization purposes. |
|
Defines a pulse where the shape is determined by specifying an array of (complex) |
|
Hermite pulse intended for single qubit gates in diamond based systems. |
Functions
|
Generates a list of square pulses equivalent to a (very) long square pulse. |
|
Calculates a SquarePulse to counteract charging effects based on a list of pulses. |
|
- class ReferenceMagnitude[source]
Dataclass which describes an amplitude / power reference level, with respect to which pulse amplitudes are defined. This can be specified in units of “V”, “dBm” or “A”.
- class ShiftClockPhase(phase_shift: float, clock: str, t0: float = 0, data: Optional[dict] = None)[source]
Bases:
quantify_scheduler.Operation
An operation that shifts the phase of a clock by a specified amount.
Create a new instance of ShiftClockPhase.
- Parameters
phase_shift – The phase shift in degrees.
clock – The clock of which to shift the phase.
t0 – Time in seconds when to execute the command relative to the start time of the Operation in the Schedule.
data –
The operation’s dictionary, by default None
Note: if the data parameter is not None all other parameters are overwritten using the contents of data.
Deprecated: support for the data argument will be dropped in quantify-scheduler >= 0.13.0. Please consider updating the data dictionary after initialization.
- class ResetClockPhase(clock: str, t0: float = 0, data: Optional[dict] = None)[source]
Bases:
quantify_scheduler.Operation
An operation that resets the phase of a clock.
Create a new instance of ResetClockPhase.
- Parameters
clock – The clock of which to reset the phase.
data –
The operation’s dictionary, by default None
Note: if the data parameter is not None all other parameters are overwritten using the contents of data.
Deprecated: support for the data argument will be dropped in quantify-scheduler >= 0.13.0. Please consider updating the data dictionary after initialization.
- class SetClockFrequency(clock: str, clock_freq_new: float, t0: float = 0, duration: float = qblox_constants.NCO_SET_FREQ_WAIT * 1e-09)[source]
Bases:
quantify_scheduler.Operation
Operation that sets updates the frequency of a clock. This is a low-level operation and therefore depends on the backend.
Currently only implemented for Qblox backend, refer to
NcoSetClockFrequencyStrategy
for more details.- Parameters
clock – The clock for which a new frequency is to be set.
clock_freq_new – The new frequency in Hz.
t0 – Time in seconds when to execute the command relative to the start time of the Operation in the Schedule.
duration – The duration of the operation in seconds.
- class VoltageOffset(offset_path_0: float, offset_path_1: float, duration: float = 0.0, port: Optional[str] = None, clock: Optional[str] = None, t0: float = 0)[source]
Bases:
quantify_scheduler.Operation
Operation that represents setting a constant offset to the output voltage.
Currently only implemented for Qblox backend, refer to
AwgOffsetStrategy
for more details.- Parameters
offset_path_0 (float) – Offset of path 0 (the I-path).
offset_path_1 (float) – Offset of path 1 (the Q-path).
port (str or None, optional) – Port of the stitched pulse.
clock (str or None, optional) – Clock used to modulate the stitched pulse.
duration (float, optional) – The time to hold the offset for (in seconds).
t0 (float, optional) – Time in seconds when to start the pulses relative to the start time of the Operation in the Schedule.
- class IdlePulse(duration: float, data: Optional[dict] = None)[source]
Bases:
quantify_scheduler.Operation
The IdlePulse Operation is a placeholder for a specified duration of time.
Create a new instance of IdlePulse.
The IdlePulse Operation is a placeholder for a specified duration of time.
- Parameters
duration – The duration of idle time in seconds.
data –
The operation’s dictionary, by default None
Note: if the data parameter is not None all other parameters are overwritten using the contents of data.
Deprecated: support for the data argument will be dropped in quantify-scheduler >= 0.13.0. Please consider updating the data dictionary after initialization.
- class RampPulse(amp: float, duration: float, port: str, clock: str = BasebandClockResource.IDENTITY, reference_magnitude: Optional[ReferenceMagnitude] = None, offset: float = 0, t0: float = 0, data: Optional[dict] = None)[source]
Bases:
quantify_scheduler.Operation
The RampPulse Operation is a real-valued pulse that ramps from the specified offset to the specified amplitude + offset during the duration of the pulse.
Create a new instance of RampPulse.
The RampPulse Operation is a real-valued pulse that ramps from zero to the specified amplitude during the duration of the pulse.
The pulse is given as a function of time \(t\) and the parameters offset and amplitude by
\[P(t) = \mathrm{offset} + t \times \mathrm{amp}.\]- Parameters
amp – Unitless amplitude of the ramp envelope function.
duration – The pulse duration in seconds.
offset – Starting point of the ramp pulse
port – Port of the pulse.
clock – Clock used to modulate the pulse, by default a BasebandClock is used.
reference_magnitude – Scaling value and unit for the unitless amplitude. 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.
data – The operation’s dictionary, by default Nonen Note: if the data parameter is not None all other parameters are overwritten using the contents of data.n Deprecated: support for the data argument will be dropped in quantify-scheduler >= 0.13.0. Please consider updating the data dictionary after initialization.
- class StaircasePulse(start_amp: float, final_amp: float, num_steps: int, duration: float, port: str, clock: str = BasebandClockResource.IDENTITY, reference_magnitude: Optional[ReferenceMagnitude] = None, t0: float = 0, data: Optional[dict] = None)[source]
Bases:
quantify_scheduler.Operation
A real valued staircase pulse, which reaches it’s final amplitude in discrete steps. In between it will maintain a plateau.
Constructor for a staircase.
- Parameters
start_amp – Starting unitless amplitude of the staircase envelope function.
final_amp – Final unitless amplitude of the staircase envelope function.
num_steps – The number of plateaus.
duration – Duration of the pulse in seconds.
port – Port of the pulse.
clock – Clock used to modulate the pulse.
reference_magnitude – Scaling value and unit for the unitless amplitude. 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.
data –
The operation’s dictionary, by default None
Note: if the data parameter is not None all other parameters are overwritten using the contents of data.
Deprecated: support for the data argument will be dropped in quantify-scheduler >= 0.13.0. Please consider updating the data dictionary after initialization.
- class MarkerPulse(duration: float, port: str, t0: float = 0, clock: str = 'digital')[source]
Bases:
quantify_scheduler.Operation
A representation of quantum circuit operations.
The Operation class is a JSON-compatible data structure that contains information on how to represent the operation on the quantum-circuit and/or the quantum-device layer. It also contains information on where the operation should be applied: the
Resource
s used.An operation always has the following attributes:
duration (float): duration of the operation in seconds (can be 0).
hash (str): an auto generated unique identifier.
name (str): a readable identifier, does not have to be unique.
An Operation can contain information on several levels of abstraction. This information is used when different representations are required. Note that when initializing an operation not all of this information needs to be available as operations are typically modified during the compilation steps.
Tip
quantify_scheduler
comes with agate_library
and apulse_library
, both containing common operations.JSON schema of a valid Operation
JSON schema for a quantify sequencer operation.
type
object
properties
name
type
string
gate_info
type
object
properties
unitary
A unitary matrix describing the operation.
operation_type
Defines what class of operations this gate refers to (e.g. Rxy, CZ etc.).
type
string
qubits
A list of strings indicating the qubits the gate acts on. Valid qubits are strings that appear in the device_config.json file.
type
array
symmetric
A boolean to indicate whether a two qubit gate is symmetric. This is used in the device config compilation stage. By default, it is set as False
type
boolean
tex
latex snippet for plotting
type
string
plot_func
reference to a function for plotting this operation. If not specified, defaults to using
gate_box()
.type
string / null
additionalProperties
True
pulse_info
A list containing the pulses that are part of the operation
type
array
items
Info to generate an individual pulse.
type
object
properties
port
A string specifying the port used by the pulse.
type
string / null
clock
A string specifying the clock used to modulate the pulse.
type
string
wf_func
reference to a function to generate the pulse of this operation.
type
string / null
t0
Starting time of the pulse with respect to the start of the operation in seconds.
type
number
duration
The duration of the pulse in seconds.
type
number
acquisition_info
A list containing the acquisitions that are part of the operation
type
array
items
Info to generate an individual acquisition.
type
object
properties
port
A string specifying the port used by the acquisition.
type
string
clock
A string specifying the clock used to demodulate the acquisition.
type
string
t0
Starting time of the pulse with respect to the start of the operation in seconds.
type
number
duration
The duration of the acquisition in seconds.
type
number
acq_channel
The acquisition channel to use.
type
number
acq_index
The acquisition index where to store the result of the acquisition protocol.
type
number
acq_return_type
Describes the return type of an acquisition performed using this protocol.
additionalProperties
True
logic_info
Not Implemented.
additionalProperties
False
Note
Two different Operations containing the same information generate the same hash and are considered identical.
Digital pulse that is HIGH for the specified duration. Played on marker output. Currently only implemented for Qblox backend.
- Parameters
duration – Duration of the HIGH signal.
port – Name of associated port.
clock – As digital IO’s technically do not have a clock, this parameter is by default set to “digital”. In circuit to device compilation digital IO’s get assigned the digital clock.
- class SquarePulse(amp: float, duration: float, port: str, clock: str = BasebandClockResource.IDENTITY, reference_magnitude: Optional[ReferenceMagnitude] = None, phase: float = 0, t0: float = 0, data: Optional[dict] = None)[source]
Bases:
quantify_scheduler.Operation
The SquarePulse Operation is a real-valued pulse with the specified amplitude during the pulse.
Create a new instance of SquarePulse.
The SquarePulse Operation is a real-valued pulse with the specified amplitude during the pulse.
- Parameters
amp – Unitless amplitude of the envelope.
duration – The pulse duration in seconds.
port – Port of the pulse, must be capable of playing a complex waveform.
clock – Clock used to modulate the pulse.
reference_magnitude – Scaling value and unit for the unitless amplitude. Uses settings in hardware config if not provided.
phase – Phase of the pulse in degrees.
t0 – Time in seconds when to start the pulses relative to the start time of the Operation in the Schedule.
- class SuddenNetZeroPulse(amp_A: float, amp_B: float, net_zero_A_scale: float, t_pulse: float, t_phi: float, t_integral_correction: float, port: str, clock: str = BasebandClockResource.IDENTITY, reference_magnitude: Optional[ReferenceMagnitude] = None, t0: float = 0, data: Optional[dict] = None)[source]
Bases:
quantify_scheduler.Operation
The sudden net-zero (SNZ) pulse from Neg\^ırneac et al. [2021].
The sudden net-zero (SNZ) pulse from Neg\^ırneac et al. [2021].
The SuddenNetZeroPulse is a real-valued pulse that can be used to implement a conditional phase gate in transmon qubits.
- Parameters
amp_A – unitless amplitude of the main square pulse
amp_B – unitless scaling correction for the final sample of the first square and first sample of the second square pulse.
net_zero_A_scale – amplitude scaling correction factor of the negative arm of the net-zero pulse.
t_pulse – the total duration of the two half square pulses
t_phi – the idling duration between the two half pulses
t_integral_correction – the duration in which any non-zero pulse amplitude needs to be corrected.
port – Port of the pulse, must be capable of playing a complex waveform.
clock – Clock used to modulate the pulse.
reference_magnitude – Scaling value and unit for the unitless amplitude. 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.
data –
The operation’s dictionary, by default None
Note: if the data parameter is not None all other parameters are overwritten using the contents of data.
Deprecated: support for the data argument will be dropped in quantify-scheduler >= 0.13.0. Please consider updating the data dictionary after initialization.
- decompose_long_square_pulse(duration: float, duration_max: float, single_duration: bool = False, **kwargs) list [source]
Generates a list of square pulses equivalent to a (very) long square pulse.
Intended to be used for waveform-memory-limited devices. Effectively, only two square pulses, at most, will be needed: a main one of duration duration_max and a second one for potential mismatch between N duration_max and overall duration.
- Parameters
duration – Duration of the long pulse in seconds.
duration_max – Maximum duration of square pulses to be generated in seconds.
single_duration – If True, only square pulses of duration duration_max will be generated. If False, a square pulse of duration < duration_max might be generated if necessary.
**kwargs – Other keyword arguments to be passed to the
SquarePulse
.
- Returns
A list of :class`SquarePulse` s equivalent to the desired long pulse.
- class SoftSquarePulse(amp: float, duration: float, port: str, clock: str, reference_magnitude: Optional[ReferenceMagnitude] = None, t0: float = 0, data: Optional[dict] = None)[source]
Bases:
quantify_scheduler.Operation
The SoftSquarePulse Operation is a real valued square pulse convolved with a Hann window for smoothing.
Create a new instance of SoftSquarePulse.
The SoftSquarePulse Operation is a real valued square pulse convolved with a Hann window for smoothing.
- Parameters
amp – Unitless amplitude of the envelope.
duration – The pulse duration in seconds.
port – Port of the pulse, must be capable of playing a complex waveform.
clock – Clock used to modulate the pulse.
reference_magnitude – Scaling value and unit for the unitless amplitude. 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.
data –
The operation’s dictionary, by default None
Note: if the data parameter is not None all other parameters are overwritten using the contents of data.
Deprecated: support for the data argument will be dropped in quantify-scheduler >= 0.13.0. Please consider updating the data dictionary after initialization.
- class ChirpPulse(amp: float, duration: float, port: str, clock: str, start_freq: float, end_freq: float, reference_magnitude: Optional[ReferenceMagnitude] = None, t0: float = 0, data: Optional[dict] = None)[source]
Bases:
quantify_scheduler.Operation
A linear chirp signal. A sinusoidal signal that ramps up in frequency.
Constructor for a chirp pulse.
- Parameters
amp – Unitless amplitude of the envelope.
duration – Duration of the pulse.
port – The port of the pulse.
clock – Clock used to modulate the pulse.
start_freq – Start frequency of the Chirp. Note that this is the frequency at which the waveform is calculated, this may differ from the clock frequency.
end_freq – End frequency of the Chirp.
reference_magnitude – Scaling value and unit for the unitless amplitude. Uses settings in hardware config if not provided.
t0 – Shift of the start time with respect to the start of the operation.
- class DRAGPulse(G_amp: float, D_amp: float, phase: float, duration: float, port: str, clock: str, reference_magnitude: Optional[ReferenceMagnitude] = None, t0: float = 0, data: Optional[dict] = None)[source]
Bases:
quantify_scheduler.Operation
DRAG pulse intended for single qubit gates in transmon based systems.
A DRAG pulse is a gaussian pulse with a derivative component added to the out-of-phase channel to reduce unwanted excitations of the \(|1\rangle - |2\rangle\) transition (Motzoi et al. [2009] and Gambetta et al. [2011]).
The waveform is generated using
waveforms.drag()
.Create a new instance of DRAGPulse.
- Parameters
G_amp – Unitless amplitude of the Gaussian envelope.
D_amp – Unitless amplitude of the derivative component, the DRAG-pulse parameter.
duration – The pulse duration in seconds.
phase – Phase of the pulse in degrees.
clock – Clock used to modulate the pulse.
port – Port of the pulse, must be capable of carrying a complex waveform.
reference_magnitude – Scaling value and unit for the unitless amplitude. 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.
data –
The operation’s dictionary, by default None
Note: if the data parameter is not None all other parameters are overwritten using the contents of data.
Deprecated: support for the data argument will be dropped in quantify-scheduler >= 0.13.0. Please consider updating the data dictionary after initialization.
- create_dc_compensation_pulse(pulses: List[quantify_scheduler.Operation], sampling_rate: float, port: str, t0: float = 0, amp: Optional[float] = None, reference_magnitude: Optional[ReferenceMagnitude] = None, duration: Optional[float] = None, data: Optional[Dict[str, Any]] = None) SquarePulse [source]
Calculates a SquarePulse to counteract charging effects based on a list of pulses.
The compensation is calculated by summing the area of all pulses on the specified port. This gives a first order approximation for the pulse required to compensate the charging. All modulated pulses ignored in the calculation.
- Parameters
pulses – List of pulses to compensate
sampling_rate – Resolution to calculate the enclosure of the pulses to calculate the area to compensate.
amp – Desired unitless amplitude of the DCCompensationPulse. Leave to None to calculate the value for compensation, in this case you must assign a value to duration. The sign of the amplitude is ignored and adjusted automatically to perform the compensation.
duration – Desired pulse duration in seconds. Leave to None to calculate the value for compensation, in this case you must assign a value to amp. The sign of the value of amp given in the previous step is adjusted to perform the compensation.
port – Port to perform the compensation. Any pulse that does not belong to the specified port is ignored.
clock – Clock used to modulate the pulse.
reference_magnitude – Scaling value and unit for the unitless amplitude. Uses settings in hardware config if not provided.
phase – Phase of the pulse in degrees.
t0 – Time in seconds when to start the pulses relative to the start time of the Operation in the Schedule.
data –
The operation’s dictionary, by default None
Note: if the data parameter is not None all other parameters are overwritten using the contents of data.
Deprecated: support for the data argument will be dropped in quantify-scheduler >= 0.13.0. Please consider updating the data dictionary after initialization.
- Returns
Returns a SquarePulse object that compensates all pulses passed as argument.
- _extract_pulses(pulses: List[quantify_scheduler.Operation], port: str) List[Dict[str, Any]] [source]
- class WindowOperation(window_name: str, duration: float, t0: float = 0.0, data: Optional[Dict[str, Any]] = None)[source]
Bases:
quantify_scheduler.Operation
The WindowOperation is an operation for visualization purposes.
The WindowOperation has a starting time and duration.
Create a new instance of WindowOperation.
- class NumericalPulse(samples: Union[numpy.ndarray, list], t_samples: Union[numpy.ndarray, list], port: str, clock: str, reference_magnitude: Optional[ReferenceMagnitude] = None, t0: float = 0, interpolation: str = 'linear', data: Optional[dict] = None)[source]
Bases:
quantify_scheduler.Operation
Defines a pulse where the shape is determined by specifying an array of (complex) points. If points are required between the specified samples (such as could be required by the sampling rate of the hardware), meaning \(t[n] < t' < t[n+1]\), scipy.interpolate.interp1d will be used to interpolate between the two points and determine the value.
Creates an instance of the NumericalPulse.
- Parameters
samples – An array of (possibly complex) values specifying the shape of the pulse.
t_samples – An array of values specifying the corresponding times at which the samples are evaluated.
port – The port that the pulse should be played on.
clock – Clock used to (de)modulate the pulse.
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.
interpolation – Specifies the type of interpolation used. This is passed as the “kind” argument to scipy.interpolate.interp1d.
data –
The operation’s dictionary, by default None
Note: if the data parameter is not None all other parameters are overwritten using the contents of data.
Deprecated: support for the data argument will be dropped in quantify-scheduler >= 0.13.0. Please consider updating the data dictionary after initialization.
- class SkewedHermitePulse(duration: float, amplitude: float, skewness: float, phase: float, port: str, clock: str, reference_magnitude: Optional[ReferenceMagnitude] = None, t0: float = 0, data: Optional[dict] = None)[source]
Bases:
quantify_scheduler.Operation
Hermite pulse intended for single qubit gates in diamond based systems.
The waveform is generated using
skewed_hermite()
.Create a new instance of SkewedHermitePulse.
- Parameters
duration – The pulse duration in seconds.
amplitude – Unitless amplitude of the hermite pulse.
skewness – Skewness in the frequency space.
phase – Phase of the pulse in degrees.
clock – Clock used to modulate the pulse.
port – Port of the pulse, must be capable of carrying a complex waveform.
reference_magnitude – Scaling value and unit for the unitless amplitude. 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. By default 0.
data –
The operation’s dictionary, by default None
Note: if the data parameter is not None all other parameters are overwritten using the contents of data.
Deprecated: support for the data argument will be dropped in quantify-scheduler >= 0.13.0. Please consider updating the data dictionary after initialization.