qat.experimental.waveforms.shapes.sinusoidal module

Implements the sampling definitions for a Sinusoidal waveform shape.

The Sinusoidal waveform is defined by a standard sine function, which is parameterised by number_of_periods, a dimensionless parameter that creates a waveform with that specified number of periods (it needs not be an integer). It is also parameterised by the parameter internal_phase, which is specified in radians and sets the starting phase of the waveform shape. By default, the Sinusoidal function is defined with number_of_periods = 1/2, and internal_phase = 0. To have a cosine-like waveform, use internal_phase = pi/2.

The Sinusoidal waveform is defined as

\[f(x) = \text{sin}(2\pi Nx + \theta),\]

where \(N\) is the number of periods, and \(\theta\) is the internal phase in radians.

class SinusoidalWaveformShape(number_of_periods=0.5, internal_phase=0.0)

Bases: WaveformShape

Waveform-shape wrapper for sinusoidal sampling functions.

derivative(x, order=1)

Evaluates the derivative of the sinusoidal waveform shape.

Return type:

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

evaluate(x)

Evaluates the sinusoidal waveform shape at the sample points.

Return type:

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

classmethod from_frequency(frequency, width, internal_phase=0.0)

Constructs from a physical frequency and waveform width.

The number of periods is calculated as frequency * width.

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

  • width (float) – The waveform width (same units as the reciprocal of frequency).

  • internal_phase (float) – The starting phase in radians. Default 0.0.

Return type:

SinusoidalWaveformShape

internal_phase: float = 0.0
number_of_periods: float = 0.5
sample_sinusoidal_waveform(x, *, number_of_periods=0.5, internal_phase=0.0)

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

  • number_of_periods (float) – The number of periods of the Sinusoidal function, default is 1/2.

  • internal_phase (float) – The internal phase of the Sinusoidal function in radians, default is 0.

Return type:

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

sample_sinusoidal_waveform_derivative(x, order=1, *, number_of_periods=0.5, internal_phase=0.0)

Samples the derivative of a Sinusoidal 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.

  • number_of_periods (float) – The number of periods of the Sinusoidal function, default is 1/2.

  • internal_phase (float) – The internal phase of the Sinusoidal function in radians, default is 0.

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

Return type:

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

sample_sinusoidal_waveform_derivative_from_frequency(x, order=1, *, frequency=0.5, width=1.0, internal_phase=0.0)

Samples the derivative of a Sinusoidal waveform shape from frequency and width.

This helper supports legacy parameterisation with number_of_periods = frequency * width.

Return type:

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

sample_sinusoidal_waveform_from_frequency(x, *, frequency=0.5, width=1.0, internal_phase=0.0)

Samples a Sinusoidal waveform shape from frequency and width.

This helper supports legacy parameterisation with number_of_periods = frequency * width.

Return type:

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