lukingroup / pylabnet

Client-server, python-based laboratory software
MIT License
17 stars 8 forks source link

Issue 386: Add option for HDAWG to be accessed by USB or Ethernet #427

Closed kelwerks closed 11 months ago

kelwerks commented 12 months ago

image

Sample output if config file includes the new interface key: image

Sample output if no interface key is found: image

pieterjanstas commented 12 months ago

I think this is a good start, but I would maybe add some stuff to make it more robust to errors. Right now, if someone were to forget to add an 'interface' entry in the config file, the server would just not launch without a clear error message. One way to improve this is to modify the functions to something like this:

def hdwag_startfunction(other, variables, interface=None, more=x, variables=y):

if interface is None: send error message to logger

else: keep going

or for example when you pull from the config dict:

interface = load_device_config('zi_hdawg', kwargs['config'], logger=kwargs['logger'])['interface']

You can add a line like:

config_dict = load_device_config('zi_hdawg', kwargs['config'], logger=kwargs['logger'])

if 'interface' in config_dict: interface = config_dict['interface']

else: send error message to logger.

Finally, it would be good to add a screenshot of a config .json file for the hdawg (with the new interface entry) to this pull request for documentation.

kelwerks commented 12 months ago

Thanks for reviewing! I added the error handling and the config file screenshot. Let me know it looks good or if any other changes are necessary.