-
Notifications
You must be signed in to change notification settings - Fork 318
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
Instrument driver organization and access #20
Comments
@alexcjohnson, Related to drivers that work with multiple instrument models, there will also be drivers that share many features but ommit / extend on a base set of features, how would one go about this? |
Yes, subclassing should serve this purpose well. class AcmeModel1(AcmeBase):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs):
self.add_parameter('only_in_model1', ...)
del self.parameters['not_in_model1']
# and same for functions |
I guess subclassing is indeed the obvious answer but does this mean they get a separate file? I guess it does not improve readability to have a separate file for an instrument driver that is a subclass and only contains 2 functions and 1 extra parameter. Altough I guess at the end it is more about findability of the drivers themselves. Maybe this is a crazy idea but perhaps we cannot find the best possible solution at this point in time because we are not actually experiencing the problem yet. Maybe we should just stick to the most simple solution for now, being flat (or company named folders) with no fancy redirecting imports and revisit this issue once we hit ~30+ drivers or so. I guess then we have all the edge cases needed to find the most suitable approach. |
🌟 💯 🌟 Lets keep the company subdirectories, because changing that would be painful later. But beyond that, Thinking further about this, We're probably all going to be totally fine with this as long as qcodes is installed in development mode; there won't be too many drivers, and all the users will know where the code is and how to look around in it for drivers. The problems are likely to come when it stabilizes and new people install it as a regular package: lots of times people don't even know where on disk these packages are, and anyway we'd rather they not hunt around in there but have nice ways to discover drivers from within Python. So we have some time... but one way to do this without forcing us into any particular structure now (including things like one class per file, directory names matching file / class names) would be to make a driver "registry" - perhaps in the
Obviously there are a lot of things we could do with that, but the point is, there IS a solution that doesn't force any additional constraints on us right now, so we can keep the structure as it is currently, ie well organized for us as coders, and shelve further discussion for now. |
* Fix: always save png Also when interrupted as requested * Fix: Matplot always step color on new trace to match qtplot
* Fix: always save png Also when interrupted as requested * Fix: Matplot always step color on new trace to match qtplot
* Fix: always save png Also when interrupted as requested * Fix: Matplot always step color on new trace to match qtplot
* Fix: always save png Also when interrupted as requested * Fix: Matplot always step color on new trace to match qtplot
* Fix: always save png Also when interrupted as requested * Fix: Matplot always step color on new trace to match qtplot
* Fix: always save png Also when interrupted as requested * Fix: Matplot always step color on new trace to match qtplot
* Fix: always save png Also when interrupted as requested * Fix: Matplot always step color on new trace to match qtplot
* Fix: always save png Also when interrupted as requested * Fix: Matplot always step color on new trace to match qtplot
* Fix: always save png Also when interrupted as requested * Fix: Matplot always step color on new trace to match qtplot
* Fix: always save png Also when interrupted as requested * Fix: Matplot always step color on new trace to match qtplot
* Fix: always save png Also when interrupted as requested * Fix: Matplot always step color on new trace to match qtplot
* Fix: always save png Also when interrupted as requested * Fix: Matplot always step color on new trace to match qtplot
* Fix: always save png Also when interrupted as requested * Fix: Matplot always step color on new trace to match qtplot
* Fix: always save png Also when interrupted as requested * Fix: Matplot always step color on new trace to match qtplot
* Fix: always save png Also when interrupted as requested * Fix: Matplot always step color on new trace to match qtplot
* Fix: always save png Also when interrupted as requested * Fix: Matplot always step color on new trace to match qtplot
* Fix: always save png Also when interrupted as requested * Fix: Matplot always step color on new trace to match qtplot
* Fix: always save png Also when interrupted as requested * Fix: Matplot always step color on new trace to match qtplot
* Fix: always save png Also when interrupted as requested * Fix: Matplot always step color on new trace to match qtplot
* Fix: always save png Also when interrupted as requested * Fix: Matplot always step color on new trace to match qtplot
* Fix: always save png Also when interrupted as requested * Fix: Matplot always step color on new trace to match qtplot
Ported from the discussion here
Several related issues:
File organization
The options here seem to be:
User access
The explicit option will of course always work. Assuming we do company subdirectories:
But this is awfully verbose, and also doesn't help users find the driver they need, particularly if the company name is ambiguous. We could import drivers in
__init__.py
files to shorten this to:but then we're importing all drivers all the time, which could be a big drag on the system. We could make a custom importer, so users could do:
That would let us only import drivers we need, alias company names (so
qcodes.instruments.HP_34401A
would be the same driver asqcodes.instruments.Keysight_34401A
, good for backward compatibility). Users could find drivers withdir(qcodes.instruments)
or tab completion (we'd have to implement__dir__
) but the correspondence between this and the directory structure would be implicit, particularly for aliased companies.Drivers that work with multiple instrument models
This should certainly be encouraged! Already, @AdriaanRol 's
RS_SGS100A
driver works not only for the RS_SGS100A but also for the RS_SMB100A.Do we name these drivers to indicate this (something like
RS_S100A_series
)? Do we create wrapper files? Then users wouldn't need to know that they were using the same driver, but maybe they should?The text was updated successfully, but these errors were encountered: