-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redefinition of digital outputs (at least) is silent #52
Comments
Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington). Thanks for the report! I noticed the same thing recently. The NI DAQmx class isn't checking that the 'connection' strings of its children are unique, so both children get added and the instructions that get saved correspond to the second one that was added, since although the children are stored as a list, the code does this before saving instructions: digitals = {}
for device in self.child_devices:
...
elif isinstance(device, (DigitalOut, StaticDigitalOut)):
digitals[device.connection] = device
... So it's iterating over the list but only the second device with a duplicate connection string survives in the dict it constructs. The previous NI DAQmx code looks like it did the exact same thing, although at least it was more self-aware about it: def add_device(self,output):
# TODO: check there are no duplicates, check that connection
# string is formatted correctly.
IntermediateDevice.add_device(self,output) And I suspect the problem is widespread in labscript. We should modify I'll patch this for the NI DAQmx devices, which do check the format of the |
Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington). Whilst the second DO defined is the one whose instructions will actually be saved, I think the first one is the one BLACS will use for its label, since this is determined by their order in the connection table, which as far as I can tell is also order of definition (no dicts anywhere, just lists) - anyway dicts in Python 3.6+ are ordered by insertion order too. So what you're seeing doesn't totally make sense to me but in any case we should just disallow duplicates and that will fix it whatever's going on. |
Original report (archived issue) by Lincoln Turner (Bitbucket: lincolndturner, GitHub: lincolnturner).
We unintentionally had in our connection table:
and later in the connection table
We edited the Bq_cap_charge line to give it another name, and this made the BLACS tab button change labels from Bq_cap_charge to lf_amp_shutdown.
This smells like a dict-keys ordering issue where adding new DOs with the same port/line just adds keys to a dict and it is fairly arbitrary what key gets displayed in BLACS…?
Presumably the fix should be an error, or at least a warning, if the line is already attached to a label?
The text was updated successfully, but these errors were encountered: