-
Notifications
You must be signed in to change notification settings - Fork 40
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
Is there a "reset instrument to defaults from yaml file" function or similar? #83
Comments
Sorry for the delay but I think we have no such thing. You may be able to use CLS to achieve something similar but we could also envision adding a custom method. |
No worries! After all, I still haven't addressed pyvisa/pyvisa-py#374 lol I assume that, at it's core, Where is this dictionary-like data structure defined? I'd imagine that a custom method on the Resource Manager or perhaps the individual Resource is probably easy to implement. |
TLDR: calling I spent a bit of time debugging why this happens. As far as I can see the state is kept in the Device class The device class is in turn stored as a member of the Devices class which is As the Device is loaded via I did not trace all objects that keep a reference to the visa library but it could be that the resource_manager is the only object that does this so closing the resource manager would under some circumstances trigger the visalib to be garbage collected explaining the observations above (the mentioned registry in VisaLibraryBase is a WeakValueDict so it does it self add to the refcount) |
Thanks for investigating this @jenshnielsen Since it seems a needed feature, I would welcome a PR in that direction. |
Is there a function/method that will reset a simulated instrument to the defaults defined in the yaml file?
What I'd like to be able to do is basically:
Does such a method exist? Closing the resource and/or the resource manager does not reset things (this might be related to #82).
Steps to Reproduce
Create this YAML file. I called it "doug_example.yaml":
Create this Python file. I called it "doug_example.py":
Run
python doug_example.py
and get this output:The text was updated successfully, but these errors were encountered: