From 7ea98791addfb84c7be5eefa3187f31f386a96ca Mon Sep 17 00:00:00 2001 From: Yoav Romach <53370976+yomach@users.noreply.github.com> Date: Thu, 6 Jun 2024 09:02:34 +0300 Subject: [PATCH] Change variables to be explicit --- .../control_panel/manual_output_control.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/qualang_tools/control_panel/manual_output_control.py b/qualang_tools/control_panel/manual_output_control.py index e6d95e51..c9a754aa 100644 --- a/qualang_tools/control_panel/manual_output_control.py +++ b/qualang_tools/control_panel/manual_output_control.py @@ -248,23 +248,21 @@ def set_amplitude(self, element, value, ignore_missing_elements=False): prev_value = self.analog_data[element]["amplitude"] if value != 0: - value = (value - prev_value) * (1 / self.ANALOG_WAVEFORM_AMPLITUDE) - value = _round_to_fixed_point_accuracy(value) - 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: return - self.analog_data[element]["amplitude"] = _floor_to_fixed_point_accuracy( - prev_value + value * self.ANALOG_WAVEFORM_AMPLITUDE - ) + set_value = _floor_to_fixed_point_accuracy(prev_value + delta_value * self.ANALOG_WAVEFORM_AMPLITUDE) else: - self.analog_data[element]["amplitude"] = 0.0 - + set_value = 0.0 + self.analog_data[element]["amplitude"] = set_value 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(value), + float(set_value), ) self.analog_job.resume()