qat.experimental.waveforms.shapes.rounded_square module
Implements the sampling definitions for a Rounded Square waveform shape.
The Rounded Square waveform shape is implemented by ERF functions that has the consequence
of being roughly square in the center fractional_top_width region, which is the
“top width”, with fractional_rise and fall edges at the tails that have a sharpness
determined by the fractional_rise parameter. Note that the function isn’t actually
square in the center, but has the appearance of being so. The function is actually
continuously differentiable.
The Rounded Square waveform is defined by the function
where \(w_t\) is fractional_top_width and \(r\) is fractional_rise. The
shift \(C\) and regularize constant \(N\) are
and
This implements the legacy RoundedSquareWaveform shape with the following
parameterisations: fractional_rise = 2 * fractional_rise / width,
fractional_top_width = std_dev / width.
- class RoundedSquareWaveformShape(fractional_top_width=0.5, fractional_rise=0.1)
Bases:
WaveformShapeWaveform-shape wrapper for rounded-square sampling functions.
- derivative(x, order=1)
Evaluates the derivative of the rounded-square waveform shape.
- Return type:
ndarray[tuple[int,...],dtype[complexfloating]]
- evaluate(x)
Evaluates the rounded-square waveform shape at the sample points.
- Return type:
ndarray[tuple[int,...],dtype[complexfloating]]
-
fractional_rise:
float= 0.1
-
fractional_top_width:
float= 0.5
- classmethod from_absolute(width, absolute_top_width, absolute_rise)
Constructs from absolute parameters.
- Parameters:
- Return type:
- classmethod from_legacy(rise, std_dev, width)
Constructs from legacy
RoundedSquareWaveformparameters.- Parameters:
- Return type:
- sample_rounded_square_waveform(x, *, fractional_top_width=0.5, fractional_rise=0.1)
Samples a Rounded 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_top_width¶ (
float) – The “top width” of the Rounded Square function, default is0.5.fractional_rise¶ (
float) – The sharpness of the fractional_rise and fall edges of the Rounded Square function, default is0.1.
- Return type:
ndarray[tuple[int,...],dtype[complexfloating]]- Returns:
The sampled Rounded Square waveform as a complex-valued array.
- sample_rounded_square_waveform_derivative(x, order=1, *, fractional_top_width=0.5, fractional_rise=0.1)
Samples the derivative of a Rounded 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_top_width¶ (
float) – The “top width” of the Rounded Square function, default is0.5.fractional_rise¶ (
float) – The sharpness of the fractional_rise and fall edges of the Rounded Square function, default is0.1.order¶ (
int) – The order of the derivative to sample, default is1.
- Return type:
ndarray[tuple[int,...],dtype[complexfloating]]- Returns:
The sampled derivative of the Rounded Square waveform as a complex-valued array.