qoolqit.waveforms
waveforms
Modules:
-
base_waveforms– -
utils– -
waveforms–
Classes:
-
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.
Blackman(duration: float, area: float)
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
See: https://en.wikipedia.org/wiki/Window_function#:~:text=Blackman%20window
Parameters:
-
(durationfloat) –The waveform duration.
-
(areafloat) –The integral of the waveform.
Attributes:
-
duration(float) –Returns the duration of the waveform.
-
params(dict[str, float | ndarray]) –Dictionary of parameters used by the waveform.
Source code in qoolqit/waveforms/waveforms.py
duration: float
property
Returns the duration of the waveform.
params: dict[str, float | np.ndarray]
property
Dictionary of parameters used by the waveform.
Constant(duration: float, value: float)
A constant waveform over a given duration.
Parameters:
-
(durationfloat) –the total duration.
-
(valuefloat) –the value to take during the duration.
Attributes:
-
duration(float) –Returns the duration of the waveform.
-
params(dict[str, float | ndarray]) –Dictionary of parameters used by the waveform.
Source code in qoolqit/waveforms/waveforms.py
duration: float
property
Returns the duration of the waveform.
params: dict[str, float | np.ndarray]
property
Dictionary of parameters used by the waveform.
Delay(duration: float, *args: float, **kwargs: float | np.ndarray)
An empty waveform.
Parameters:
-
(durationfloat) –the total duration of the waveform.
Attributes:
-
duration(float) –Returns the duration of the waveform.
-
params(dict[str, float | ndarray]) –Dictionary of parameters used by the waveform.
Source code in qoolqit/waveforms/base_waveforms.py
duration: float
property
Returns the duration of the waveform.
params: dict[str, float | np.ndarray]
property
Dictionary of parameters used by the waveform.
Interpolated(duration: float, values: ArrayLike, times: Optional[ArrayLike] = None, interpolator: str = 'PchipInterpolator', **interpolator_kwargs: Any)
A waveform created from interpolation of a set of data points.
Parameters:
-
(durationint) –The waveform duration (in ns).
-
(valuesArrayLike) –Values of the interpolation points. Must be a list of castable to float or a parametrized object.
-
(timesArrayLike, default:None) –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.
-
(interpolatorstr, default:'PchipInterpolator') –The SciPy interpolation class to use. Supports "PchipInterpolator" and "interp1d".
Attributes:
-
duration(float) –Returns the duration of the waveform.
-
params(dict[str, float | ndarray]) –Dictionary of parameters used by the waveform.
Source code in qoolqit/waveforms/waveforms.py
duration: float
property
Returns the duration of the waveform.
params: dict[str, float | np.ndarray]
property
Dictionary of parameters used by the waveform.
PiecewiseLinear(durations: list | tuple, values: list | tuple)
A piecewise linear waveform.
Creates a composite waveform of N ramps that linearly interpolate through the given N+1 values.
Parameters:
-
(durationslist | tuple) –list or tuple of N duration values.
-
(valueslist | tuple) –list or tuple of N+1 waveform values.
Methods:
-
function–Identifies the right waveform in the composition and evaluates it at time t.
-
max–Get the maximum value of the waveform.
-
min–Get the approximate minimum value of the waveform.
Attributes:
-
duration(float) –Returns the duration of the waveform.
-
durations(list[float]) –Returns the list of durations of each individual waveform.
-
n_waveforms(int) –Returns the number of waveforms.
-
params(dict[str, float | ndarray]) –Dictionary of parameters used by the waveform.
-
times(list[float]) –Returns the list of times when each individual waveform starts.
-
waveforms(list[Waveform]) –Returns a list of the individual waveforms.
Source code in qoolqit/waveforms/waveforms.py
duration: float
property
Returns the duration of the waveform.
durations: list[float]
property
Returns the list of durations of each individual waveform.
n_waveforms: int
property
Returns the number of waveforms.
params: dict[str, float | np.ndarray]
property
Dictionary of parameters used by the waveform.
times: list[float]
property
Returns the list of times when each individual waveform starts.
waveforms: list[Waveform]
property
Returns a list of the individual waveforms.
function(t: float) -> float
Identifies the right waveform in the composition and evaluates it at time t.
Source code in qoolqit/waveforms/base_waveforms.py
max() -> float
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.
Source code in qoolqit/waveforms/base_waveforms.py
Ramp(duration: float, initial_value: float, final_value: float)
A ramp that linearly interpolates between an initial and final value.
Parameters:
-
(durationfloat) –the total duration.
-
(initial_valuefloat) –the initial value at t = 0.
-
(final_valuefloat) –the final value at t = duration.
Attributes:
-
duration(float) –Returns the duration of the waveform.
-
params(dict[str, float | ndarray]) –Dictionary of parameters used by the waveform.
Source code in qoolqit/waveforms/waveforms.py
duration: float
property
Returns the duration of the waveform.
params: dict[str, float | np.ndarray]
property
Dictionary of parameters used by the waveform.
Sin(duration: float, amplitude: float = 1.0, omega: float = 1.0, phi: float = 0.0, shift: float = 0.0)
An arbitrary sine over a given duration.
Parameters:
-
(durationfloat) –the total duration.
-
(amplitudefloat, default:1.0) –the amplitude of the sine wave.
-
(omegafloat, default:1.0) –the frequency of the sine wave.
-
(phifloat, default:0.0) –the phase of the sine wave.
-
(shiftfloat, default:0.0) –the vertical shift of the sine wave.
Methods:
-
max–Get the approximate maximum value of the waveform.
-
min–Get the approximate minimum value of the waveform.
Attributes:
-
duration(float) –Returns the duration of the waveform.
-
params(dict[str, float | ndarray]) –Dictionary of parameters used by the waveform.
Source code in qoolqit/waveforms/waveforms.py
duration: float
property
Returns the duration of the waveform.
params: dict[str, float | np.ndarray]
property
Dictionary of parameters used by the waveform.
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.
Source code in qoolqit/waveforms/base_waveforms.py
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.