How to give subclasses of Instrument similar behavior as find_or_create_instrument #6081
Replies: 1 comment
-
I actually think we should implement this for all instruments which I was toying with in #4038 but it not something that I have had the time to pursue and will not have for some time. I would however be happy to review a pr that implements that in general. To make that work I think we need to implement some kind of E.g. for visa I would:
As for why your specific code does not work:
In other words doing |
Beta Was this translation helpful? Give feedback.
-
I'm one of the developers of Quantify and we have a few classes that inherit from
Instrument
, but they don't always correspond to physical Instruments. They are more used as containers for qcodes parameters and submodules. So we would like to be able to be able to run multiple constructor calls without running into "Instrument with already exists" type of errors.I am aware of the
find_or_create_instrument
function, but I'd like to have a similar behavior on the subclasses themselves. I've tried a few things but nothing seems to work out.For example,
gives me the following error trace:
I also tried overloading
__call__
and usingfind_or_create_instrument
inside__new__
but no success yet. Do you have any ideas how to get this done?thank you :)
Beta Was this translation helpful? Give feedback.
All reactions