From 61c37ac873944183c32d33e824cea849582bdbd7 Mon Sep 17 00:00:00 2001 From: Matteo Pompili <6500688+matpompili@users.noreply.github.com> Date: Wed, 5 Jun 2024 14:27:56 -0700 Subject: [PATCH] Fix voltage booking error introduced in the previous fix. --- CHANGELOG.md | 1 + .../control_panel/manual_output_control.py | 17 +++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc42be59..99552efb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## [Unreleased] ### Fixed +- control_panel - Fix voltage booking error introduced in the previous fix. - control_panel - Fix rounding error in `ManualOutputControl` that caused voltage drifts. - octave_tools - Fix bug when setting calibrate to False in ``get_correction_for_each_LO_and_IF()``. - unit - ``to_clock_cycles()`` now always returns an integer. diff --git a/qualang_tools/control_panel/manual_output_control.py b/qualang_tools/control_panel/manual_output_control.py index da9d2151..e6d95e51 100644 --- a/qualang_tools/control_panel/manual_output_control.py +++ b/qualang_tools/control_panel/manual_output_control.py @@ -248,22 +248,23 @@ def set_amplitude(self, element, value, ignore_missing_elements=False): prev_value = self.analog_data[element]["amplitude"] if value != 0: - delta_value = (value - prev_value) * (1 / self.ANALOG_WAVEFORM_AMPLITUDE) - delta_value = _round_to_fixed_point_accuracy(delta_value) - if delta_value == 0: + value = (value - prev_value) * (1 / self.ANALOG_WAVEFORM_AMPLITUDE) + value = _round_to_fixed_point_accuracy(value) + if value == 0: return + self.analog_data[element]["amplitude"] = _floor_to_fixed_point_accuracy( + prev_value + value * self.ANALOG_WAVEFORM_AMPLITUDE + ) else: - delta_value = value - self.analog_data[element]["amplitude"] = _floor_to_fixed_point_accuracy( - prev_value + delta_value * self.ANALOG_WAVEFORM_AMPLITUDE - ) + self.analog_data[element]["amplitude"] = 0.0 + while not self.analog_job.is_paused(): sleep(0.01) self.analog_qm.set_io_values( int(self.analog_elements.index(element)) + len(self.analog_elements), - float(delta_value), + float(value), ) self.analog_job.resume()