You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider adding a function to wait until osci stopped its measurement:
def wait_until_stopped(self, max_seconds=20, warn=True):
'''Queries for the running status of run-control until the osci is in state stopped.
Does this for a maximum number of seconds, afterwards it leaves the function to not query
forever.
:param max_seconds: define how long to wait max, defaults to 20
:type max_seconds: int or str, optional
:param warn: decide, if a warning shall be logged after time is over, defaults to True
:type warn: bool
:return: if it stopped after condition change or after maximum number of seconds
:rtype: bool
'''
# Wait a maximum number of seconds to prevent looping forever
for i in range(int(max_seconds)):
try:
operation_register = int(self.query_raw(':OPERegister:CONDition?'))
except VisaIOError:
time.sleep(1)
continue
# We need the value from bit 3 of operation register
# It tells us if the oscilloscope is running (not stopped)
running = bool((operation_register >> 3) & 1)
if not running:
logger.info(f'Osci: Stopped after {i} seconds.')
return True
time.sleep(1)
if warn:
logger.warn(f'Osci: Waited {max_seconds}s to switch to status "stop", did not work.')
return False
The text was updated successfully, but these errors were encountered:
Consider adding a function to wait until osci stopped its measurement:
The text was updated successfully, but these errors were encountered: