qiboteam / qibolab

Quantum hardware module and drivers for Qibo.
https://qibo.science
Apache License 2.0
43 stars 14 forks source link

Set default values in Qblox modules #725

Closed PiergiorgioButtarini closed 8 months ago

PiergiorgioButtarini commented 9 months ago

It's rather simpler if you just define a dictionary with the map, and then you loop over it

for name, value in defaults.items():
    target.set(name, value)

_Originally posted by @AleCandido in https://github.com/qiboteam/qibolab/pull/713#discussion_r1431585130_

Instead of doing this:

target.set("cont_mode_en_awg_path0", False)  # Default after reboot = False
target.set("cont_mode_en_awg_path1", False)
target.set("cont_mode_waveform_idx_awg_path0", 0)
target.set("cont_mode_waveform_idx_awg_path1", 0)
target.set("marker_ovr_en", True)
target.set("marker_ovr_value", 15)
target.set("mixer_corr_gain_ratio", 1)
target.set("mixer_corr_phase_offset_degree", 0)
...

define a top level dictionary and loop over. This should be implemented in the PR with the file module.py since many settings are in common to all the Qblox modules.