m-labs / artiq

A leading-edge control system for quantum information experiments
https://m-labs.hk/artiq
GNU Lesser General Public License v3.0
435 stars 201 forks source link

suservo: dds0_device key error in artiq_sinara_tester #1814

Closed occheung closed 2 years ago

occheung commented 2 years ago

Bug Report

One-Line Summary

artiq_sinara_tester reports "KeyError: 'dds0_device'" when testing a system with SU-Servo.

Issue Details

Steps to Reproduce

  1. Generate a device_db.py with an SU-Servo peripheral. For example, the peripherals of the json file could look like this.
    "peripherals": [
        {
            "type": "suservo",
            "sampler_ports": [2, 3],
            "urukul0_ports": [0, 1],
            "clk_sel": 2
        }
    ]
  2. Run artiq_sinara_tester with the same device_db.py.

Expected Behavior

artiq_sinara_tester starts the tests without error.

Actual (undesired) Behavior

A key error is reported.

Traceback (most recent call last):
  File "/nix/store/kzlp7v5bxw7k71pbpgn9b7g7x9dml5bm-python3.9-artiq-7.0-dev/bin/.artiq_sinara_tester-wrapped", line 9, in <module>
    sys.exit(main())
  File "/home/occheung/Desktop/artiq-shell-dev/artiq/artiq/frontend/artiq_sinara_tester.py", line 722, in main
    experiment = SinaraTester((device_mgr, None, None, None))
  File "/home/occheung/Desktop/artiq-shell-dev/artiq/artiq/language/environment.py", line 243, in __init__
    self.build(*args, **kwargs)
  File "/home/occheung/Desktop/artiq-shell-dev/artiq/artiq/frontend/artiq_sinara_tester.py", line 118, in build
    del self.urukuls[desc["arguments"]["dds0_device"]]
KeyError: 'dds0_device'

The actual device_db.py has the following entries regarding the SU-Servo.

device_db["suservo0"] = {
    "type": "local",
    "module": "artiq.coredevice.suservo",
    "class": "SUServo",
    "arguments": {
        "channel": 0x000008,
        "pgia_device": "spi_sampler0_pgia",
        "cpld_devices": ['urukul0_cpld', 'urukul1_cpld'],
        "dds_devices": ['urukul0_dds', 'urukul1_dds']
    }
}

Related PR

1500, for the changes in artiq_ddb_template without updating artiq_sinara_tester as well. @pmldrmota @dnadlinger

Your System (omit irrelevant parts)

occheung commented 2 years ago

Note: The generated device_db.py has 2 entries on CPLD and DDS while only 1 urukul was configured. Edit: These entries were there as well before the related PR was merged.