3.3.5. qupulse.hardware.util¶
Functions
|
Implementation detail that can be compiled with numba. |
|
Implementation detail to be used if numba is not available. |
|
Numba targeted implementation |
|
Fallback implementation if numba is not available |
|
Find indices of the first occurrence of the elements of to_find in data. |
|
Calculates the sample times required for the longest waveform in waveforms and returns it together with an array of the lengths. |
|
Calculates the number of samples in a waveform |
|
|
|
Calculate lookup table from sparse to non sparse indices and the total number of not None elements |
|
Noop traced that is used if autologging package is not available |
|
Convert values of the range |
|
Potentially (if numba is installed) faster version of zhinst.utils.convert_awg_waveform |
- qupulse.hardware.util.get_sample_times(waveforms: Union[Collection[qupulse.program.waveforms.Waveform], qupulse.program.waveforms.Waveform], sample_rate_in_GHz: qupulse.utils.types.TimeType, tolerance: float = 1e-10) Tuple[numpy.array, numpy.array] [source]¶
Calculates the sample times required for the longest waveform in waveforms and returns it together with an array of the lengths.
If only one waveform is given, the number of samples has shape ()
Raises a ValueError if any waveform has a length that is zero or not a multiple of the inverse sample rate.
- Parameters
waveforms – A waveform or a sequence of waveforms
sample_rate_in_GHz – The sample rate in GHz
tolerance – Allowed deviation from an integer sample count
- Returns
Array of sample times sufficient for the longest waveform Number of samples of each waveform
- qupulse.hardware.util.traced(obj)[source]¶
Noop traced that is used if autologging package is not available
- qupulse.hardware.util.voltage_to_uint16(voltage: numpy.ndarray, output_amplitude: float, output_offset: float, resolution: int) numpy.ndarray [source]¶
- Convert values of the range
[output_offset - output_amplitude, output_offset + output_amplitude)
- to uint16 in the range
[0, 2**resolution)
output_offset - output_amplitude -> 0 output_offset -> 2**(resolution - 1) output_offset + output_amplitude -> 2**resolution - 1
- Parameters
voltage – input voltage. read-only
output_amplitude – input divided by this
output_offset – is subtracted from input
resolution – Target resolution in bits (determines the output range)
- Raises
ValueError if the voltage is out of range or the resolution is not an integer –
- Returns
(voltage - output_offset + output_amplitude) * (2**resolution - 1) / (2*output_amplitude) as uint16
- qupulse.hardware.util.zhinst_voltage_to_uint16(ch1: Optional[numpy.ndarray], ch2: Optional[numpy.ndarray], markers: Tuple[Optional[numpy.ndarray], Optional[numpy.ndarray], Optional[numpy.ndarray], Optional[numpy.ndarray]]) numpy.ndarray [source]¶
Potentially (if numba is installed) faster version of zhinst.utils.convert_awg_waveform
- Parameters
ch1 – Sampled data of channel 1 [-1, 1]
ch2 – Sampled data of channel 1 [-1, 1]
markers – Marker data of (ch1_front, ch1_back, ch2_front, ch2_back)
- Returns
Interleaved data in the correct format (u16). The first bit is the sign bit so the data needs to be interpreted as i16.