-
Notifications
You must be signed in to change notification settings - Fork 55
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
Bugfix for Germ Selection Line Labels and Instrument Specifier Type Error Bug #508
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor issue with an errant print statement, and a question for you on the conventions surrounding the change in processorspec.py. See comments below.
@@ -405,8 +405,8 @@ def instrument_specifier(self, name): | |||
------- | |||
str or dict | |||
""" | |||
if name in self.nonstd_instruments: | |||
return self.nonstd_instruments[name] | |||
if tuple(name) in self.nonstd_instruments.keys(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the convention here that the keys of nonstd_instruments are always tuples? If other hashable types are allowed this should be written so as to accept those options too. One way to do so would be to use the get method for dictionaries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I can answer this. I took a look at the unit test that was failing on this branch and it confirms that there was and intention for these to also have the option for string valued keys. See here.
We could rewrite this to account for both options at the level of this method, but the thing is it should be necessary to cast the name to a tuple here. If you're fixing this because you ran into a problem here it suggests to me that something upstream of this method is using malformed inputs, or has inadvertently hardcoded in the expectation that this is always a string (and not a tuple). My preference would be to track this down, but if folks would rather patch this to accept both strings and tuples (casting if needed) to get this working I won't push back too hard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@coreyostrove What would a string valued key look like? The tuple valued key is ('Iz', 'Q0') for example. Currently, the problem is cropping up from processor_spec.instrument_names returns (['Iz', 'Q0'],) which is neither of the acceptable formats. This ultimately breaks QILGST.
Changes the default behavior of casting with the 'auto' keyword to use the map forward simulator. Update germ selection to automatically convert to a matrix forward simulator as needed.
Fix tests that were broken by the switch to using map as the default forward simulator. Either update tests to support map natively, or for ones that rely on matrix make sure that is the simulator being used.
Remove a few unit tests that made reference or relied on an old model method that no longer exists. These tests were already being skipped (or had the sections referencing this old method commented out), so this doesn't actually affect anything other than making stuff cleaner.
Start the process of fleshing out missing documentation related to processor specification requirements for state preparations and POVMs, and also introduce some minor updates to the model construction code to allow for more general application to qudit models, and more synched up string specifier conventions.
Continue the quest to properly document the convention expected for various non-standard operation specifiers. In this commit there are additional details added regarding instruments specifically. There are also changes made to the implementation of the instrument builder in the model construction code which fills in gaps between the supported specifier options for preps and POVM effects to ensure parity/consistency. Also does away with some limitations in the specifier length when using 2-tuples of prep and effect specifiers.
Hey @pcwysoc and anyone else tracking this PR, I've just pushed some changes to this branch unceremoniously hijacking it with some scope creep. The quest to answer the innocuous seeming question you posed above "What would a string valued key look like?" brought to bear the fact that this part of the code regarding the expected structure/formats for nonstandard operation specifiers (i.e. the contents of things like I've also made some more substantive changes as well, introducing some additional (previously unsupported) specifier options to improve the consistency across the various nonstandard operations. E.g. Previously string-based effect specifiers (which I didn't know existed before this exercise) only supported strings of the form "E" where is some integer to be parsed into the correctly based number representing a particular standard basis state. But for preps we also supported another format for such strings where we specify the bitstring directly. This has been updated so that effects and preps have similar behavior. There are other changes along these lines that have been made. I can also now fairly confidently answer your question:
The use of tuples for instrument names or as keys in the pyGSTi/pygsti/models/modelconstruction.py Line 883 in 551b157
Unfortunately what this means is that in my opinion the only proper way to fix this (without nested layers of duct-tape) is to pull the trigger on implementing availability resolution support for instruments (obviating the need for the tuple key hack). That'll probably be a pain, but fwiw we'd already identified this as something which would eventually need to happen #417. |
Bugfix for #507 and instrument specifier type error bug.