Add function for operation complete status check to VisaInstrument
This PR proposes a function in VisaInstrument class that checks the Operation Complete Query (OPC) bit and ensures that the operation is complete, i.e., the bit is set to 0. The suggested function repeatedly returns the content of the Event Status Register (ESR) and clears it.
Subsumes and closes #1168.
@jenshnielsen @astafan8
Codecov Report
Merging #1733 into master will decrease coverage by
0.02%. The diff coverage is41.66%.
@@ Coverage Diff @@
## master #1733 +/- ##
==========================================
- Coverage 70.38% 70.36% -0.03%
==========================================
Files 152 152
Lines 18859 18870 +11
==========================================
+ Hits 13274 13277 +3
- Misses 5585 5593 +8
I wonder what happens if this is used after a short command that has already finished by the time this is executed. In my understanding that would mean that the opc bit has already been set and is cleared by *ESR? and the instrument will then probably deadlock?
It seems to me that the correct way would be.
self.ask_raw("*ESR?")
self.write("startpotentiallyslowcmd")
while int(self.ask_raw("*ESR?").strip())%2==0:
time.sleep(sleep_time)
This cannot be done easily since it's across multiple function calls in qcodes but perhaps the call to self.ask_raw("*ESR?") should simply not be here?
@astafan8 This still needs testing on real instruments so i am bumping this to 0.10
It seems like if this should be done it should be done using the pyvisa event handling https://pyvisa.readthedocs.io/en/latest/introduction/event_handling.html
Hi guys! Thanks for finishing this. I am having problem to sign in to my account (Gatebuilder). Let me know if I need to do anything!