qat.experimental.waveforms.shapes.base module

Shared decorators and helpers for waveform shape sampling.

class WaveformShape

Bases: ABC

Abstract base class for waveform shapes.

Child classes must implement the evaluate and derivative methods to provide the specific waveform shape and its derivatives.

abstract derivative(x, order=1)

Evaluates the derivative of the waveform shape at the given sample points.

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

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

Return type:

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

abstract evaluate(x)

Evaluates the waveform shape at the given sample points.

Parameters:

x (ndarray | list[float]) – The list of values in the range [-1, 1] to sample the waveform for.

Return type:

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

derivative_definition(fn=None, *, sample_parameter='x', order_parameter='order')

Coerces/validates sampling points and validates derivative order.

Parameters:
  • fn (Optional[Callable[[ParamSpec(P)], TypeVar(T)]]) – The function to decorate.

  • sample_parameter (str | int) – The parameter that contains the sample points to validate. This may be a parameter name (for example "x") or the index of a positional parameter.

  • order_parameter (str | int) – The parameter that contains the derivative order. This may be a parameter name (for example "order") or the index of a positional parameter.

Return type:

Callable[[ParamSpec(P)], TypeVar(T)] | Callable[[Callable[[ParamSpec(P)], TypeVar(T)]], Callable[[ParamSpec(P)], TypeVar(T)]]

shape_definition(fn=None, *, sample_parameter='x')

Coerces and validates normalized sampling points before shape evaluation.

Parameters:
  • fn (Optional[Callable[[ParamSpec(P)], TypeVar(T)]]) – The function to decorate.

  • sample_parameter (str | int) – The parameter that contains the sample points to validate. This may be a parameter name (for example "x") or the index of a positional parameter.

Return type:

Callable[[ParamSpec(P)], TypeVar(T)] | Callable[[Callable[[ParamSpec(P)], TypeVar(T)]], Callable[[ParamSpec(P)], TypeVar(T)]]