qat.experimental.waveforms.shapes.sech module

Implements the sampling definitions for a Sech waveform shape.

The Sech waveform is defined by a hyperbolic secant function, which is parameterised by fractional_breadth, a dimensionless parameter that sets the fractional_breadth of the waveform; decreasing fractional_breadth makes the waveform more narrow, while increasing fractional_breadth makes the waveform more broad. The Sech waveform is also parameterised by the parameter regularize, which if set to True, applies a simple shift and rescaling to the Sech function so that it has zero value at the edges.

The waveform is defined as

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

where \(\sigma\) sets the fractional_breadth of the Sech function. \(C\) is the shift value, and \(N\) is the rescale (regularize) value, which are defined as

\[C = \text{sech}\left(\frac{1}{\sigma}\right),\]

and \(N = 1 - C\). If regularize = False, then \(C = 0\) and \(N = 1\).

This implements the legacy SechWaveform under the parameterisations fractional_breadth = 2 * std_dev / width, and regularize = zero_at_edges.

class SechWaveformShape(fractional_breadth=0.3333333333333333, regularize=False)

Bases: WaveformShape

Waveform-shape wrapper for sech sampling functions.

derivative(x, order=1)

Evaluates the derivative of the sech waveform shape.

Return type:

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

evaluate(x)

Evaluates the sech waveform shape at the sample points.

Return type:

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

fractional_breadth: float = 0.3333333333333333
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 Sech function.

  • regularize (bool) – Whether the waveform is zero at the edges. Default False.

Return type:

SechWaveformShape

classmethod from_legacy(std_dev, width, zero_at_edges=False)

Constructs from legacy SechWaveform 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 False.

Return type:

SechWaveformShape

regularize: bool = False
sample_sech_waveform(x, *, fractional_breadth=0.3333333333333333, regularize=False)

Samples a Sech 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 Sech function, default is 1/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_sech_waveform_derivative(x, order=1, *, fractional_breadth=0.3333333333333333, regularize=False)

Samples the derivative of a Sech 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 Sech function, default is 1/3.

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