quantify_scheduler.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)

square_imaginary(→ numpy.ndarray)

ramp(→ numpy.ndarray)

staircase(→ numpy.ndarray)

Ramps from zero to a finite value in discrete steps.

soft_square(t, amp)

A softened square pulse.

chirp(→ numpy.ndarray)

Produces a linear chirp signal. The frequency is determined according to the

drag(→ numpy.ndarray)

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

sudden_net_zero(t, amp_A, amp_B, net_zero_A_scale, ...)

Generates the sudden net zero waveform from Neg\^ırneac et al. [2021].

interpolated_complex_waveform(→ numpy.ndarray)

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

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.

modulate_wave(→ numpy.ndarray)

Apply single sideband (SSB) modulation to a waveform.

square(t: Union[numpy.ndarray, List[float]], amp: Union[float, complex]) numpy.ndarray[source]
square_imaginary(t: Union[numpy.ndarray, List[float]], amp: Union[float, complex]) numpy.ndarray[source]
ramp(t, amp, offset=0) numpy.ndarray[source]
staircase(t: Union[numpy.ndarray, List[float]], start_amp: Union[float, complex], final_amp: Union[float, complex], num_steps: int) numpy.ndarray[source]

Ramps from zero to a finite value in discrete steps.

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

  • start_amp – Starting amplitude.

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

  • num_steps – Number of steps to reach final value.

Returns

The real valued waveform.

soft_square(t, amp)[source]

A softened square pulse.

Parameters
  • t

  • amp

chirp(t: numpy.ndarray, amp: float, start_freq: float, end_freq: float) 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.

Returns

The complex waveform.

drag(t: numpy.ndarray, G_amp: float, D_amp: float, duration: float, nr_sigma: int = 3, phase: float = 0, subtract_offset: str = '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. [2009] and Gambetta et al. [2011]).

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.

  • 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)[source]

Generates the sudden net zero waveform from Neg\^ırneac et al. [2021].

Parameters
  • t – 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

  • 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.

interpolated_complex_waveform(t: numpy.ndarray, samples: numpy.ndarray, t_samples: numpy.ndarray, interpolation: str = 'linear', bounds_error: Optional[bool] = False, fill_value: numpy.ndarray | float | Literal[extrapolate] = 'extrapolate', **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.

  • 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: Optional[float] = 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 [2019], 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 [2019], section 4.2. To get a “standard” hermite pulse, use skewness=0.

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

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

modulate_wave(t: numpy.ndarray, wave: numpy.ndarray, freq_mod: float) numpy.ndarray[source]

Apply single sideband (SSB) modulation to a waveform.

The frequency convention we adhere to is:

freq_base + freq_mod = freq_signal

Parameters
  • t – Times at which to determine the modulation.

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

  • freq_mod – Modulation frequency in Hz.

Returns

modulated waveform.

Note

Pulse modulation is generally not included when specifying waveform envelopes as there are many hardware backends include this capability.