labscript-suite-temp / labscript

The labscript Python library provides a translation from simple Python code to complex hardware instructions. The library is used to construct a "connection table" containing information about what hardware is being used and how it is interconnected. Devices described in this connection table can then have their outputs set by using a range of functions, including arbitrary ramps.
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Basic connection tables (with no outputs) do not compile #15

Open philipstarkey opened 9 years ago

philipstarkey commented 9 years ago

Original report (archived issue) by Philip Starkey (Bitbucket: pstarkey, GitHub: pstarkey).


Take this simple connection table:

#!python

from labscript import *
from labscript_devices.PineBlaster import PineBlaster
from labscript_utils.unitconversions import *
from labscript_devices.NI_PCI_6733 import NI_PCI_6733

PineBlaster(name='pineblaster_0', trigger_device = None, trigger_connection = None, usbport='com6')
NI_PCI_6733(name='ni_card_1', parent_device=pineblaster_0.clockline, clock_terminal='ni_pcie_6733_0/PFI0', MAX_name='ni_pci_6733_0')

start()
stop(1)

This produces the traceback

#!python

Traceback (most recent call last):
File "C:\user_scripts\labscriptlib\example_experiment\connectiontable.py", line 8, in <module>
stop(0.1)
File "C:\pythonlib\labscript\labscript.py", line 1772, in stop
generate_code()
File "C:\pythonlib\labscript\labscript.py", line 1686, in generate_code
device.generate_code(hdf5_file)
File "C:\pythonlib\labscript_devices\PineBlaster.py", line 76, in generate_code
PseudoclockDevice.generate_code(self, hdf5_file)
File "C:\pythonlib\labscript\labscript.py", line 763, in generate_code
Device.generate_code(self, hdf5_file)
File "C:\pythonlib\labscript\labscript.py", line 276, in generate_code
device.generate_code(hdf5_file)
File "C:\pythonlib\labscript\labscript.py", line 659, in generate_code
Device.generate_code(self, hdf5_file)
File "C:\pythonlib\labscript\labscript.py", line 276, in generate_code
device.generate_code(hdf5_file)
File "C:\pythonlib\labscript\labscript.py", line 276, in generate_code
device.generate_code(hdf5_file)
File "C:\pythonlib\labscript_devices\NI_PCI_6733.py", line 31, in generate_code
parent.NIBoard.generate_code(self, hdf5_file)
File "C:\pythonlib\labscript_devices\NIBoard.py", line 56, in generate_code
times = pseudoclock.times[clockline]
KeyError: <labscript.labscript.ClockLine object at 0x07153530>

Adding two AnalogOuts to the connection table allows it to be successfully compiled.

We should fix this, but we also need to make sure that BLACS isn't going to get upset if an experiment is submitted with a device that has no outputs.

philipstarkey commented 7 years ago

Original comment by Jan Werkmann (Bitbucket: PhyNerd, GitHub: PhyNerd).


I also ran into this bug when only adding Analoge Inputs to NI-Cards in the connectiontable. By adding a output everything behaved as expected.

This can cause a great amount of confusion if you reduce your experiment scripts connection table to only the inputs and outputs that you need and suddenly everything stops working.