waveforms#

Contains function to generate most basic waveforms.

These functions are intended to be used to generate waveforms defined in the pulse_library. Examples of waveforms that are too advanced are flux pulses that require knowledge of the flux sensitivity and interaction strengths and qubit frequencies.

Module Contents#

Functions#

square(→ numpy.ndarray)

Generate a square pulse.

square_imaginary(→ numpy.ndarray)

Generate a square pulse with imaginary amplitude.

ramp(→ numpy.ndarray)

Generate a ramp pulse.

staircase(→ numpy.ndarray[float, ...)

Ramps from zero to a finite value in discrete steps.

soft_square(→ numpy.typing.NDArray)

A softened square pulse.

chirp(→ numpy.ndarray)

Produces a linear chirp signal.

drag(→ numpy.ndarray)

Generates a DRAG pulse consisting of a Gaussian \(G\) as the I- and a

sudden_net_zero(→ numpy.typing.NDArray)

Generates the sudden net zero waveform from Negîrneac et al. [NAM+21].

interpolated_complex_waveform(→ numpy.ndarray)

Wrapper function around scipy.interpolate.interp1d, which takes the

rotate_wave(→ numpy.ndarray)

Rotate a wave in the complex plane.

skewed_hermite(→ numpy.ndarray)

Generates a skewed hermite pulse for single qubit rotations in NV centers.

square(t: numpy.ndarray | list[float], amp: float | complex) numpy.ndarray[source]#

Generate a square pulse.

square_imaginary(t: numpy.ndarray | list[float], amp: float | complex) numpy.ndarray[source]#

Generate a square pulse with imaginary amplitude.

ramp(t: numpy.ndarray, amp: float, offset: float = 0, duration: float | None = None) numpy.ndarray[source]#

Generate a ramp pulse.

staircase(t: numpy.ndarray[float, numpy.dtype], start_amp: float | complex, final_amp: float | complex, num_steps: int, duration: float | None = None) numpy.ndarray[float, numpy.dtype] | numpy.ndarray[complex, numpy.dtype][source]#

Ramps from zero to a finite value in discrete steps.

Parameters:
  • t – Times at which to evaluate the function. Times < 0 will output start_amp. Times >= duration will output final_amp.

  • start_amp – Starting amplitude.

  • final_amp – Final amplitude to reach on the last step.

  • num_steps – Number of steps to reach final value.

  • duration – Duration of the pulse in seconds.

Returns:

The real valued waveform.

soft_square(t: numpy.typing.NDArray | list[float], amp: float | complex) numpy.typing.NDArray[source]#

A softened square pulse.

Parameters:
  • t – Times at which to evaluate the function.

  • amp – Amplitude of the pulse.

chirp(t: numpy.ndarray, amp: float, start_freq: float, end_freq: float, duration: float | None = None) numpy.ndarray[source]#

Produces a linear chirp signal.

The frequency is determined according to the relation:

The waveform is produced simply by multiplying with a complex exponential.

Parameters:
  • t – Times at which to evaluate the function.

  • amp – Amplitude of the envelope.

  • start_freq – Start frequency of the Chirp.

  • end_freq – End frequency of the Chirp.

  • duration – Duration of the pulse in seconds.

Returns:

The complex waveform.

drag(t: numpy.ndarray, G_amp: float, D_amp: float, duration: float, nr_sigma: float, sigma: float | int | None = None, phase: float = 0, subtract_offset: Literal['average', 'first', 'last', 'none'] = 'average') numpy.ndarray[source]#

Generates a DRAG pulse consisting of a Gaussian \(G\) as the I- and a Derivative \(D\) as the Q-component (Motzoi et al. [MGRW09] and Gambetta et al. [GMMW11]).

All inputs are in s and Hz. phases are in degree.

\(G(t) = G_{amp} e^{-(t-\mu)^2/(2\sigma^2)}\).

\(D(t) = -D_{amp} \frac{(t-\mu)}{\sigma} G(t)\).

Parameters:
  • t – Times at which to evaluate the function.

  • G_amp – Amplitude of the Gaussian envelope.

  • D_amp – Amplitude of the derivative component, the DRAG-pulse parameter.

  • duration – Duration of the pulse in seconds.

  • nr_sigma – After how many sigma the Gaussian is cut off.

  • sigma – Width of the Gaussian envelope. If None, it is calculated with nr_sigma, which is set to 4.

  • phase – Phase of the pulse in degrees.

  • subtract_offset

    Instruction on how to subtract the offset in order to avoid jumps in the waveform due to the cut-off.

    • ’average’: subtract the average of the first and last point.

    • ’first’: subtract the value of the waveform at the first sample.

    • ’last’: subtract the value of the waveform at the last sample.

    • ’none’, None: don’t subtract any offset.

Returns:

complex waveform

sudden_net_zero(t: numpy.ndarray, amp_A: float, amp_B: float, net_zero_A_scale: float, t_pulse: float, t_phi: float, t_integral_correction: float) numpy.typing.NDArray[source]#

Generates the sudden net zero waveform from Negîrneac et al. [NAM+21].

The waveform consists of a square pulse with a duration of half t_pulse and an amplitude of amp_A, followed by an idling period (0 V) with duration t_phi, followed again by a square pulse with amplitude -amp_A * net_zero_A_scale and a duration of half t_pulse, followed by a integral correction period with duration t_integral_correction.

The last sample of the first pulse has amplitude amp_A * amp_B. The first sample of the second pulse has amplitude -amp_A * net_zero_A_scale * amp_B.

The amplitude of the integral correction period is such that sum(waveform) == 0.

If the total duration of the pulse parts is less than the duration set by the t array, the remaining samples will be set to 0 V.

The various pulse part durations are rounded down (floor) to the sample rate of the t array. Since t_pulse is the total duration of the two square pulses, half this duration is rounded to the sample rate. For example:

import numpy as np
from quantify_scheduler.waveforms import sudden_net_zero

t = np.linspace(0, 9e-9, 10)  # 1 GSa/s
amp_A = 1.0
amp_B = 0.5
net_zero_A_scale = 0.8
t_pulse = 5.0e-9  # will be rounded to 2 pulses of 2 ns
t_phi = 2.6e-9  # rounded to 2 ns
t_integral_correction = 4.4e-9  # rounded to 4 ns

sudden_net_zero(
    t, amp_A, amp_B, net_zero_A_scale, t_pulse, t_phi, t_integral_correction
)
array([ 1.   ,  0.5  ,  0.   ,  0.   , -0.4  , -0.8  , -0.075, -0.075,
       -0.075, -0.075])
Parameters:
  • t – A uniformly sampled array of times at which to evaluate the function.

  • amp_A – Amplitude of the main square pulse

  • amp_B – 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. The duration of each half is rounded to the sample rate of the t array.

  • t_phi – The idling duration between the two half pulses. The duration is rounded to the sample rate of the t array.

  • t_integral_correction – The duration in which any non-zero pulse amplitude needs to be corrected. The duration is rounded to the sample rate of the t array.

interpolated_complex_waveform(t: numpy.ndarray, samples: numpy.ndarray, t_samples: numpy.ndarray, interpolation: str = 'linear', **kwargs) numpy.ndarray[source]#

Wrapper function around scipy.interpolate.interp1d, which takes the array of (complex) samples, interpolates the real and imaginary parts separately and returns the interpolated values at the specified times.

Parameters:
  • t – Times at which to evaluated the to be returned waveform.

  • samples – An array of (possibly complex) values specifying the shape of the waveform.

  • t_samples – An array of values specifying the corresponding times at which the samples are evaluated.

  • interpolation – The interpolation method to use, by default “linear”.

  • kwargs – Optional keyword arguments to pass to scipy.interpolate.interp1d.

Returns:

An array containing the interpolated values.

rotate_wave(wave: numpy.ndarray, phase: float) numpy.ndarray[source]#

Rotate a wave in the complex plane.

Parameters:
  • wave – Complex waveform, real component corresponds to I, imaginary component to Q.

  • phase – Rotation angle in degrees.

Returns:

Rotated complex waveform.

skewed_hermite(t: numpy.ndarray, duration: float, amplitude: float, skewness: float, phase: float, pi2_pulse: bool = False, center: float | None = None, duration_over_char_time: float = 6.0) numpy.ndarray[source]#

Generates a skewed hermite pulse for single qubit rotations in NV centers.

A Hermite pulse is a Gaussian multiplied by a second degree Hermite polynomial. See Beukers [Beu19], Appendix A.2.

The skew parameter is a first order amplitude correction to the hermite pulse. It increases the fidelity of the performed gates. See Beukers [Beu19], section 4.2. To get a “standard” hermite pulse, use skewness=0.

The hermite factors are taken from equation 44 and 45 of Warren [War84].

Parameters:
  • t – Times at which to evaluate the function.

  • duration – Duration of the pulse in seconds.

  • amplitude – Amplitude of the pulse.

  • skewness – Skewness in the frequency space

  • phase – Phase of the pulse in degrees.

  • pi2_pulse – if True, the pulse will be pi/2 otherwise pi pulse

  • center – Optional: time after which the pulse center occurs. If None, it is automatically set to duration/2.

  • duration_over_char_time – Ratio of the pulse duration and the characteristic time of the hermite polynomial. Increasing this number will compress the pulse. By default, 6.

Returns:

complex skewed waveform