Skip to content

Commit

Permalink
Fix voltage book-keeping error introduced in #211 (#220)
Browse files Browse the repository at this point in the history
* Fix voltage booking error introduced in the previous fix.

* Change variables to be explicit

* remove special 0 case for ramp_to_zero

---------

Co-authored-by: Yoav Romach <[email protected]>
Co-authored-by: Yoav Romach <[email protected]>
  • Loading branch information
3 people authored Jun 9, 2024
1 parent 6f0d9bb commit a61bb41
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 5 additions & 11 deletions qualang_tools/control_panel/manual_output_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,10 @@ def set_amplitude(self, element, value, ignore_missing_elements=False):
raise Exception(f"The absolute value of the amplitude must smaller than 0.5, {value} was given")

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:
return
else:
delta_value = value
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 + delta_value * self.ANALOG_WAVEFORM_AMPLITUDE
)
Expand Down Expand Up @@ -618,10 +615,7 @@ def _QUA_update_freq_or_amp(self, input1, input2):
with switch_(input1):
for i in range(len(self.analog_elements)):
with case_(i):
with if_(a == 0):
ramp_to_zero(self.analog_elements[i], 1)
with else_():
play("play" * amp(a), self.analog_elements[i])
play("play" * amp(a), self.analog_elements[i])
with else_():
freq = declare(int)
assign(freq, input2)
Expand Down

0 comments on commit a61bb41

Please sign in to comment.