qat.experimental.waveforms.shapes.gaussian_square module
Implements the sampling definitions for a Gaussian-Square waveform shape.
The Gaussian Square waveform shape has a fractional_rise and fall at the edges that is
defined by a Gaussian function, connected by a square bridge in between. The proportion of
the waveform that is square is parameterised by the parameter fractional_top_width,
which is a dimensionless parameter between 0 and 1; if fractional_top_width = 0, then
the waveform is a pure Gaussian function, and if fractional_top_width = 1, then the
waveform is a pure square function, and otherwise it linearly interpolates between the two.
The Gaussian fractional_rise and fall components of the waveform are parameterised by
fractional_rise, which is expressed as a fraction of the full normalised waveform domain
[-1, 1]. To evaluate the Gaussian, the fractional_rise interval
[-1, -fractional_top_width] and the fall interval [fractional_top_width, 1] are each
remapped to [-1, 0] and [0, 1] respectively via
and the Gaussian is sampled with effective parameter \(r / (1 - w_{t})\). This ensures
that fractional_rise retains the same meaning regardless of fractional_top_width;
changing fractional_top_width does not implicitly rescale the Gaussian edge. The
regularize parameter is applied to the Gaussian edge components independently of
fractional_top_width.
If regularize is used, the Gaussian edge components are shifted and rescaled so that
they are zero at the waveform edges. Since the edges x = ±1 map to
\(x_{\text{rise/fall}} = \pm 1\) after remapping, the edge value of the
Gaussian is
and the regularize factor is \(N = 1 - C\). If regularize = False, then
\(C = 0\) and \(N = 1\). The Gaussian Square waveform is then
where \(w_{t}\) is fractional_top_width and \(r\) is fractional_rise.
Since the Gaussian Square waveform is differentiable, the first derivative of the waveform can also be sampled. However, it is not continuously differentiable, so further orders cannot be sampled.
The Gaussian Square waveform implements the legacy GaussianSquareWaveform under the
parameterisations fractional_rise = 2 * std_dev / width,
regularize = zero_at_edges, and fractional_top_width = square_width / width.
- class GaussianSquareWaveformShape(fractional_top_width=0.5, fractional_rise=np.float64(0.47140452079103173), regularize=False)
Bases:
WaveformShapeWaveform-shape wrapper for Gaussian-square sampling functions.
- Variables:
fractional_top_width – The proportion of the waveform that is square, between 0 and 1. Default is
0.5.fractional_rise – The standard deviation of the Gaussian edge profile on the normalised waveform domain, default is
sqrt(2)/3.regularize – If
True, applies a shift and rescaling so that the waveform is zero at the edges. Default isFalse.
- derivative(x, order=1)
Evaluates the derivative of the Gaussian-square waveform shape.
- Return type:
ndarray[tuple[int,...],dtype[complexfloating]]
- evaluate(x)
Evaluates the Gaussian-square waveform shape at the sample points.
- Return type:
ndarray[tuple[int,...],dtype[complexfloating]]
-
fractional_rise:
float= np.float64(0.47140452079103173)
-
fractional_top_width:
float= 0.5
- classmethod from_absolute(width, absolute_top_width, absolute_rise, regularize=True)
Constructs from absolute waveform parameters.
- Parameters:
- Return type:
- classmethod from_legacy(std_dev, width, square_width, zero_at_edges=False)
Constructs from legacy
GaussianSquareWaveformparameters.- Parameters:
- Return type:
-
regularize:
bool= False
- sample_gaussian_square_waveform(x, *, fractional_rise=np.float64(0.47140452079103173), regularize=False, fractional_top_width=0.5)
Samples a Gaussian-Square 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_rise¶ (
float) – The standard deviation of the Gaussian edge profile on the normalised waveform domain, default issqrt(2)/3.regularize¶ (
bool) – IfTrue, applies a shift and rescaling so that the waveform is zero at the edges. Default isFalse.fractional_top_width¶ (
float) – The proportion of the waveform that is square, between 0 and 1. Default is0.5.
- Return type:
ndarray[tuple[int,...],dtype[complexfloating]]
- sample_gaussian_square_waveform_derivative(x, order=1, *, fractional_rise=np.float64(0.47140452079103173), regularize=False, fractional_top_width=0.5)
Samples the derivative of a Gaussian-Square 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_rise¶ (
float) – The standard deviation of the Gaussian edge profile on the normalised waveform domain, default issqrt(2)/3.regularize¶ (
bool) – IfTrue, applies a shift and rescaling so that the waveform is zero at the edges. Default isFalse.fractional_top_width¶ (
float) – The proportion of the waveform that is square, between 0 and 1. Default is0.5.order¶ (
int) – The order of the derivative to sample. Default is1.
- Return type:
ndarray[tuple[int,...],dtype[complexfloating]]