qat.experimental.waveforms.shapes.gaussian module

Implements the sampling definitions for a Gaussian waveform shape.

The Gaussian waveform is defined as a standard Gaussian function, with optional normalisation so it can be zero at the boundary of the waveform. The parameters for the waveform are

  • fractional_breadth: The standard deviation of the Gaussian function, which controls the fractional_breadth of the waveform. A larger value of fractional_breadth results in a broader waveform, and a smaller value results in a narrower peak. The default value is sqrt(2)/3, which coincides with the legacy implementation (which is 1/3 under that parameterisation).

  • regularize: If True, the waveform is normalised so that it has value zero at the edges of the waveform. Equivalent to zero_at_edges in the legacy implementation. It is False by default.

The Gaussian waveform is defined as

\[f(x) = \frac{1}{N}\left[\text{exp}\left(-\frac{x^2}{2\sigma^2}\right) - C\right],\]

where fractional_breadth is the standard deviation. C is the shift value, and N is the regularization value, where N and C are one and zero respectively if regularize = False, and are otherwise defined as

\[C = \text{exp}\left(-\frac{1}{2\sigma^2}\right),\]

and \(N = 1 - C\).

This implements the legacy GaussianWaveform, GaussianZeroEdgeWaveform, DragGaussianWaveform, and the SofterGaussianWaveform with the following parameterisations:

  • GaussianWaveform: fractional_breadth = sqrt(2) * fractional_rise, regularize = False,

  • GaussianZeroEdgeWaveform: fractional_breadth = 2 * std_dev / width, regularize = zero_at_edges,

  • DragGaussianWaveform: fractional_breadth = std_dev, regularize = zero_at_edges, where DRAG is implemented away from the waveform definition, using the derivatives,

  • SofterGaussianWaveform: fractional_breadth = sqrt(2) * fractional_rise, regularize = True.

class GaussianWaveformShape(fractional_breadth=np.float64(0.47140452079103173), regularize=False)

Bases: WaveformShape

Waveform-shape wrapper for Gaussian sampling functions.

derivative(x, order=1)

Evaluates the derivative of the Gaussian waveform shape.

Return type:

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

evaluate(x)

Evaluates the Gaussian waveform shape at the sample points.

Return type:

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

fractional_breadth: float = np.float64(0.47140452079103173)
classmethod from_absolute(width, absolute_breadth, regularize=False)

Constructs from absolute parameters.

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

  • absolute_breadth (float) – The absolute fractional_breadth of the Gaussian waveform.

  • regularize (bool) – If True, applies a shift and rescaling so that the waveform is zero at the edges with maximum component one. Default is False.

Return type:

GaussianWaveformShape

classmethod from_gaussian_waveform(rise)

Constructs from legacy GaussianWaveform parameters.

Parameters:

rise (float) – The rise parameter from the legacy implementation.

Return type:

GaussianWaveformShape

classmethod from_gaussian_zero_edge_waveform(std_dev, width, zero_at_edges=True)

Constructs from legacy GaussianZeroEdgeWaveform / DragGaussianWaveform parameters.

Parameters:
  • std_dev (float) – The std_dev parameter from the legacy implementation.

  • width (float) – The waveform width.

  • zero_at_edges (bool) – Whether the waveform is zero at the edges. Default True.

Return type:

GaussianWaveformShape

classmethod from_softer_gaussian_waveform(rise)

Constructs from legacy SofterGaussianWaveform parameters.

Parameters:

rise (float) – The rise parameter from the legacy implementation.

Return type:

GaussianWaveformShape

regularize: bool = False
sample_gaussian_waveform(x, *, fractional_breadth=np.float64(0.47140452079103173), regularize=False)

Samples a Gaussian 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.

  • fractional_breadth (float) – The standard deviation of the Gaussian function, default is sqrt(2)/3.

  • regularize (bool) – If True, applies a shift and rescaling so that the waveform is zero at the edges. Default is False.

Return type:

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

sample_gaussian_waveform_derivative(x, order=1, *, fractional_breadth=np.float64(0.47140452079103173), regularize=False)

Samples the derivative of a Gaussian waveform shape.

The derivative is calculated using the Hermite polynomial of order order, and the Gaussian function. Note this is the Physicist’s Hermite polynomial, and not the Probabilist’s Hermite polynomial.

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

  • fractional_breadth (float) – The standard deviation of the Gaussian function, default is sqrt(2)/3, which coincides with the legacy implementation under the new definition.

  • regularize (bool) – If True, applies a shift and rescaling so that the waveform is zero at the edges. Default is False.

  • order (int) – The order of the derivative to sample. Default is 1.

Return type:

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