qat.experimental.waveforms.shapes.setup_hold module

Implements the sampling definitions for a Setup Hold waveform shape.

The Setup Hold waveform is piecewise constant: a short initial setup segment with amplitude setup followed by a hold segment with amplitude 1. Sampling is performed on the normalised domain x in [-1, 1].

Using the normalised setup duration rise_location (fraction of total waveform width in [0, 1]), the transition boundary in x is

\[x_{b} = 2r - 1\]

where \(r\) is the normalised setup duration. The waveform is then defined as

\[f(x) = \begin{cases} A_{s} & \text{if } x < x_b \ 1 & \text{if } x \ge x_b \end{cases},\]

where \(A_{s}\) is the setup amplitude.

This implements the legacy SetupHoldWaveform under the parameterisations setup = amp_setup / amp and rise_location = rise_location / width.

Since this waveform has a jump discontinuity at x_b, classical derivatives are not well-defined at the transition point and are therefore treated as undefined.

class SetupHoldWaveformShape(setup=0.1, rise_location=0.1)

Bases: WaveformShape

Waveform-shape wrapper for setup-hold sampling functions.

derivative(x, order=1)

Evaluates the derivative of the setup-hold waveform shape.

Return type:

ndarray[tuple[int, ...], dtype[complexfloating]]

evaluate(x)

Evaluates the setup-hold waveform shape at the sample points.

Return type:

ndarray[tuple[int, ...], dtype[complexfloating]]

classmethod from_absolute(width, amp, absolute_rise, absolute_amp_setup)

Constructs from legacy SetupHoldWaveform parameters.

Parameters:
  • width (float) – The waveform width.

  • amp (float) – The hold-segment amplitude from the legacy implementation.

  • absolute_rise (float) – The rise time of the setup-hold transition from the legacy implementation.

  • absolute_amp_setup (float) – The setup-segment amplitude from the legacy implementation.

Return type:

SetupHoldWaveformShape

classmethod from_legacy(amp_setup, amp, rise, width)

Constructs from legacy SetupHoldWaveform parameters.

Parameters:
  • amp_setup (float) – The setup-segment amplitude from the legacy implementation.

  • amp (float) – The hold-segment amplitude from the legacy implementation.

  • rise (float) – The rise time of the setup-hold transition from the legacy implementation.

  • width (float) – The waveform width.

Return type:

SetupHoldWaveformShape

rise_location: float = 0.1
setup: float = 0.1
sample_setup_hold_waveform(x, *, setup=0.1, rise_location=0.1)

Samples a Setup Hold waveform shape.

Parameters:
  • x (ndarray[tuple[int, ...], dtype[floating]] | list[float]) – The list of values in the range [-1, 1] to sample the waveform for.

  • setup (float) – Amplitude of the initial setup segment relative to the hold segment. Default is 0.1.

  • rise_location (float) – Fraction of the waveform duration occupied by the setup segment. Default is 0.1.

Return type:

ndarray[tuple[int, ...], dtype[complexfloating]]

Returns:

The sampled Setup Hold waveform as a complex-valued array.

The setup-to-hold transition occurs at x_b = 2 * rise_location - 1.

sample_setup_hold_waveform_derivative(x, order=1, *, setup=0.1, rise_location=0.1)

Samples the derivative of a Setup Hold waveform shape.

The derivative of a Setup Hold waveform shape is not defined at the transition point, and is therefore treated as undefined.

Parameters:
  • x (ndarray[tuple[int, ...], dtype[floating]] | list[float]) – The list of values in the range [-1, 1] to sample the waveform for.

  • setup (float) – Amplitude of the initial setup segment relative to the hold segment.

  • rise_location (float) – Fraction of the waveform duration occupied by the setup segment.

  • order (int) – The derivative order requested.

Raises:

DerivativeOrderUndefinedError – Always for order greater than equal to one, since Setup Hold is discontinuous and derivatives are not defined in this sampling API.

Return type:

ndarray[tuple[int, ...], dtype[complexfloating]]