-
Blackman — A Blackman window of a specified duration and area under the curve.
-
Constant — A constant waveform over a given duration.
-
Delay — An empty waveform.
-
Interpolated — A waveform created from interpolation of a set of data points.
-
PiecewiseLinear — A piecewise linear waveform.
-
Ramp — A ramp that linearly interpolates between an initial and final value.
-
Sin — An arbitrary sine over a given duration.
-
CompositeWaveform — Base class for composite waveforms.
-
Waveform — Base class for waveforms.
qoolqit.waveforms
package
qoolqit.waveforms
Classes
class
Blackman
(duration: float, area: float)
Bases : Waveform
A Blackman window of a specified duration and area under the curve.
Implements the Blackman window shaped waveform blackman(t) = A(0.42 - 0.5cos(αt) + 0.08cos(2αt)) A = area/(0.42duration) α = 2π/duration
Initializes a new Blackman waveform.
See
Parameters
-
duration : float — The waveform duration.
-
area : float — The integral of the waveform.
Example
blackman_wf = Blackman(100.0, area=3.14)Attributes
-
duration : float — Returns the duration of the waveform.
-
params : dict[str, float | np.ndarray] — Dictionary of parameters used by the waveform.
Methods
method
function
(t: float) → float
method
max
() → float
method
min
() → float
class
Constant
(duration: float, value: float)
Bases : Waveform
A constant waveform over a given duration.
Parameters
-
duration : float — the total duration.
-
value : float — the value to take during the duration.
Attributes
-
duration : float — Returns the duration of the waveform.
-
params : dict[str, float | np.ndarray] — Dictionary of parameters used by the waveform.
Methods
method
function
(t: float) → float
method
max
() → float
method
min
() → float
class
Delay
(duration: float, *args: float, **kwargs: float | np.ndarray)
Bases : Waveform
An empty waveform.
Initializes the Waveform.
Parameters
-
duration : float — the total duration of the waveform.
Attributes
-
duration : float — Returns the duration of the waveform.
-
params : dict[str, float | np.ndarray] — Dictionary of parameters used by the waveform.
Methods
method
function
(t: float) → float
method
max
() → float
method
min
() → float
class
Interpolated
(duration: float, values: ArrayLike, times: Optional[ArrayLike] = None, interpolator: str = 'PchipInterpolator', **interpolator_kwargs: Any)
Bases : Waveform
A waveform created from interpolation of a set of data points.
Initializes a new Interpolated waveform.
Parameters
-
duration : int — The waveform duration (in ns).
-
values : ArrayLike — Values of the interpolation points. Must be a list of castable to float or a parametrized object.
-
times : ArrayLike — Fractions of the total duration (between 0 and 1), indicating where to place each value on the time axis. Must be a list of castable to float or a parametrized object. If not given, the values are spread evenly throughout the full duration of the waveform.
-
interpolator : str — The SciPy interpolation class to use. Supports "PchipInterpolator" and "interp1d".
Attributes
-
duration : float — Returns the duration of the waveform.
-
params : dict[str, float | np.ndarray] — Dictionary of parameters used by the waveform.
Methods
method
function
(t: float) → float
method
min
() → float
method
max
() → float
class
PiecewiseLinear
(durations: list | tuple, values: list | tuple)
Bases : CompositeWaveform
A piecewise linear waveform.
Creates a composite waveform of N ramps that linearly interpolate through the given N+1 values.
Parameters
-
durations : list | tuple — list or tuple of N duration values.
-
values : list | tuple — list or tuple of N+1 waveform values.
Attributes
-
duration : float — Returns the duration of the waveform.
-
params : dict[str, float | np.ndarray] — Dictionary of parameters used by the waveform.
-
durations : list[float] — Returns the list of durations of each individual waveform.
-
times : list[float] — Returns the list of times when each individual waveform starts.
-
waveforms : list[Waveform] — Returns a list of the individual waveforms.
-
n_waveforms : int — Returns the number of waveforms.
class
Ramp
(duration: float, initial_value: float, final_value: float)
Bases : Waveform
A ramp that linearly interpolates between an initial and final value.
Parameters
-
duration : float — the total duration.
-
initial_value : float — the initial value at t = 0.
-
final_value : float — the final value at t = duration.
Attributes
-
duration : float — Returns the duration of the waveform.
-
params : dict[str, float | np.ndarray] — Dictionary of parameters used by the waveform.
Methods
method
function
(t: float) → float
method
max
() → float
method
min
() → float
class
Sin
(duration: float, amplitude: float = 1.0, omega: float = 1.0, phi: float = 0.0, shift: float = 0.0)
Bases : Waveform
An arbitrary sine over a given duration.
Parameters
-
duration : float — the total duration.
-
amplitude : float — the amplitude of the sine wave.
-
omega : float — the frequency of the sine wave.
-
phi : float — the phase of the sine wave.
-
shift : float — the vertical shift of the sine wave.
Attributes
-
duration : float — Returns the duration of the waveform.
-
params : dict[str, float | np.ndarray] — Dictionary of parameters used by the waveform.
Methods
method
function
(t: float) → float
class
CompositeWaveform
(*waveforms: Waveform)
Bases : Waveform
Base class for composite waveforms.
A CompositeWaveform stores a sequence of waveforms occurring one after the other by the order given. When it is evaluated at time t, the corresponding waveform from the sequence is identified depending on the duration of each one, and it is then evaluated for a time t' = t minus the duration of all previous waveforms.
Initializes the CompositeWaveform.
Parameters
-
waveforms : Waveform — an iterator over waveforms.
Attributes
-
duration : float — Returns the duration of the waveform.
-
params : dict[str, float | np.ndarray] — Dictionary of parameters used by the waveform.
-
durations : list[float] — Returns the list of durations of each individual waveform.
-
times : list[float] — Returns the list of times when each individual waveform starts.
-
waveforms : list[Waveform] — Returns a list of the individual waveforms.
-
n_waveforms : int — Returns the number of waveforms.
Methods
property
durations
: list[float]
Returns the list of durations of each individual waveform.
property
times
: list[float]
Returns the list of times when each individual waveform starts.
property
waveforms
: list[Waveform]
Returns a list of the individual waveforms.
property
n_waveforms
: int
Returns the number of waveforms.
method
function
(t: float) → float
Identifies the right waveform in the composition and evaluates it at time t.
method
max
() → float
Get the maximum value of the waveform.
class
Waveform
(duration: float, *args: float, **kwargs: float | np.ndarray)
Bases : ABC
Base class for waveforms.
A Waveform is a function of time for t >= 0. Custom waveforms can be defined by
inheriting from the base class and overriding the function method corresponding
to the function f(t) that returns the value of the waveform evaluated at time t.
A waveform is always a 1D function, so if it includes other parameters, these should be
passed and saved at initialization for usage within the function method.
Initializes the Waveform.
Parameters
-
duration : float — the total duration of the waveform.
Attributes
-
duration : float — Returns the duration of the waveform.
-
params : dict[str, float | np.ndarray] — Dictionary of parameters used by the waveform.
Methods
property
duration
: float
Returns the duration of the waveform.
property
params
: dict[str, float | np.ndarray]
Dictionary of parameters used by the waveform.
method
function
(t: float) → float
Evaluates the waveform function at a given time t.
method
max
() → float
Get the approximate maximum value of the waveform.
This is a brute-force method that samples the waveform over a pre-defined number of points to find the maximum value in the duration. Custom waveforms that have an easy to compute maximum value should override this method.
method
min
() → float
Get the approximate minimum value of the waveform.
This is a brute-force method that samples the waveform over a pre-defined number of points to find the minimum value in the duration. Custom waveforms that have an easy to compute maximum value should override this method.