Waveform#
- class iqm.models.playlist.waveforms.Waveform(n_samples)#
Bases:
objectDescribes the normalized shape of a real-valued control pulse.
The shape is described by a function \(f: \mathbb{R} \to [-1, 1]\) that comes with an implicit sampling window. \(f\) maps time (measured in units of the sampling window duration and relative to its center point) to the value of the pulse at that time.
Each Waveform subclass may have attributes that affect its shape. All time-like attributes are measured in units of the sampling window duration. The station method
non_timelike_attributesmay be used to define non-timelike attributes and their units (in addition to “s”, “Hz” has a special behaviour in that such attributes will be converted to the units of the inverse of duration). Providing type hints to the waveform attributes is mandatory, as they are used in parsing the information for theGateImplementations. Supported scalar attribute types are:int,float,complex,str,bool. In addition,list[<scalar type>]is supported for all the aforementioned scalar types, and alsonumpy.ndarray, in which case it is interpreted to contain complex numbers.When the Waveform is used by an instrument it is typically sampled using the
sample()method, which converts it into an array ofn_samplesequidistant samples, generated using the midpoint method, by evaluating the function \(f(t)\) inside the sampling window \(t \in [-1/2, 1/2]\). The instruments will discretize the values of the samples to a finite, instrument-dependent resolution, typically 14–16 bits.Usually, it is sufficient for Waveforms to describe normalized waveforms (i.e. using the full value range \([-1, 1]\)), not including a scaling prefactor in the defining expression. Instead, the scaling should be specified as a parameter of the
Instructionusing the Waveform (e.g.IQPulse,RealPulse), thus allowing compilers to more efficiently re-use waveforms and utilize the available hardware support to perform such re-scaling in real time.Module:
iqm.models.playlist.waveformsAttributes
Requested number of samples for the waveform.
Methods
Mapping from waveform attributes to the units of their calibration data, unless that unit is second.
Sample the waveform.
- Parameters:
n_samples (int)
- n_samples: int#
Requested number of samples for the waveform. May be different from the duration (in samples) of the parent Instruction.
- static non_timelike_attributes()#
Mapping from waveform attributes to the units of their calibration data, unless that unit is second.
Used to construct the parameters for the calibration data required by the waveform. By default all the waveform attributes are “timelike” (the unit for their calibration data is s). However, some waveform attributes can be dimensionless, e.g. the relative amplitudes in a sum of consisting of multiple terms, or frequency-like (calibration data has the unit ‘Hz’). If a Waveform subclass has non-timelike attributes, it needs to redefine this method.
When the Waveform is constructed, all timelike calibration data is converted to units of the sampling window duration, and all frequency-like calibration data into units of inverse sampling window duration.
- sample()#
Sample the waveform.
Contains the boilerplate code for determining the sample coordinates, the actual sampling happens in
_sample().- Returns:
selfsampled in the window [-1/2, 1/2]- Return type:
ndarray