Skip to content
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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

pcwysoc
Copy link

@pcwysoc pcwysoc commented Nov 27, 2024

Bugfix for #507 and instrument specifier type error bug.

@pcwysoc pcwysoc requested review from a team as code owners November 27, 2024 18:41
@pcwysoc pcwysoc self-assigned this Nov 27, 2024
Copy link
Contributor

@coreyostrove coreyostrove left a 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():
Copy link
Contributor

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.

Copy link
Contributor

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.

if ckt._static:
new_ckt = ckt.copy(editable=True)
new_ckt.line_labels = target_model.state_space.state_space_labels
print(new_ckt.line_labels)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nix this print statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants