Formalize compilation configuration
After a good discussion, we have converged on the following plan. - [x] Specify the high-level pydantic datastructure quantify-scheduler#332 , and include a version key to be backwards compatible. - [x] Add hardware options quantify-scheduler#340 for different things (quantify-scheduler#333 , quantify-scheduler#334 , quantify-scheduler#335 , quantify-scheduler#336 , quantify-scheduler#337 etc. ) - [ ] Go to a new version of how to specify connectivity - [ ] quantify-scheduler#338 - [x] quantify-scheduler#339 As a rule of thumb, `HardwareOptions` should only be added if they provide a tangible benefit. This means that a lot of interfaces that were added to some of the backends can be removed step by step and replaced by the appropriate hardware options. Schematic view of contents of the to be extended [CompilationConfig](https://gitlab.com/quantify-os/quantify-scheduler/blob/66b00ce92b5957ba82e3a8f4cbace785523c135c/quantify_scheduler/backends/graph_compilation.py#L45-53): ``` CompilationConfig: {version, DeviceParameters, HardwareOptions, Connectivity} ``` ![image](/uploads/1badf08c8423c836faeab3cee260bf32/image.png) ## Original issue text The hardware configuration is currently a `dict` without a formal structure (the [documentation](https://quantify-quantify-scheduler.readthedocs-hosted.com/en/0.5.1/user_guide.html#hardware-configuration-file) only shows two examples). That makes it hard to write good methods to modify or generate this configuration. For example, we wrote the following method to update the line gain settings: ``` def update_line_gain(hardware_mapping, gain_dictionary): for key in hardware_mapping: if key=='backend': continue for key2 in hardware_mapping[key]: if key2=='ref' or key2=='instrument_type': continue print(f'checking {key} {key2}') for key3 in hardware_mapping[key][key2]: if key3=='line_gain_db': continue port = hardware_mapping[key][key2][key3]['port'] if port in gain_dictionary: hardware_mapping[key][key2]['line_gain_db']=gain_dictionary[port] gain_dictionary_db = {'P1': -3., 'P2': -1.1, 'RP':-2.3} update_line_gain(SPIN_HARDWARE_MAPPING_CFG, gain_dictionary_db) ``` The method is error prone and could be improved if either the hardware configuration is a class or dataclass with structure, or tooling is provided to generate the hardware mapping. @AdriaanRol @jvoven
epic