# 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. . 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. modulate_wave(→ numpy.ndarray) Apply single sideband (SSB) modulation to a waveform.
square(t: Union[numpy.ndarray, List[float]], amp: Union[float, complex]) [source]
square_imaginary(t: Union[numpy.ndarray, List[float]], amp: Union[float, complex]) [source]
ramp(t, amp, offset=0) [source]
staircase(t: Union[numpy.ndarray, List[float]], start_amp: Union[float, complex], final_amp: Union[float, complex], num_steps: int) [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) [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') [source]

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

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

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', **kwargs) [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) [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.

modulate_wave(t: numpy.ndarray, wave: numpy.ndarray, freq_mod: float) [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.