aboutsummaryrefslogtreecommitdiff
path: root/qolab/hardware
diff options
context:
space:
mode:
Diffstat (limited to 'qolab/hardware')
-rw-r--r--qolab/hardware/scope/_basic.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/qolab/hardware/scope/_basic.py b/qolab/hardware/scope/_basic.py
index a5626c7..afc2913 100644
--- a/qolab/hardware/scope/_basic.py
+++ b/qolab/hardware/scope/_basic.py
@@ -8,6 +8,15 @@ import numpy as np
from qolab.hardware.scpi import SCPIinstr
from qolab.hardware.basic import BasicInstrument
from qolab.data.trace import TraceSetSameX
+import time
+import logging
+
+logging.basicConfig(
+ format="%(asctime)s %(levelname)8s %(name)s: %(message)s",
+ datefmt="%m/%d/%Y %H:%M:%S",
+)
+logger = logging.getLogger(__name__)
+logger.setLevel(logging.INFO)
def calcSparsingAndNumPoints(availableNpnts=None, maxRequiredPoints=None):
@@ -98,6 +107,30 @@ class Scope(BasicInstrument):
"""Either enable run or stop the acquisition."""
raise NotImplementedError("setRun function is not implemented")
+ def _waitUntillStop(self, timeout=0.1):
+ """Wait until scope in the stop state.
+
+ Just because we ask for a scope to stop, does not mean
+ that it is stopped. It can still wait for a trigger or untill
+ the time span is filled.
+
+ Parameter
+ ---------
+ timeout : float
+ timeout in seconds, default is 1 second
+ """
+ starttime = time.time()
+ deadline = starttime + timeout
+ while time.time() < deadline:
+ if self.getRun():
+ time.sleep(0.010)
+ else:
+ logger.debug(f"Scope stopped within {time.time()-starttime} seconds.")
+ return
+ logger.warning(
+ f"Scope did not reach STOP state within {timeout=} sec, try to increase it."
+ )
+
def getAllTraces(self, availableNpnts=None, maxRequiredPoints=None, decimate=True):
allTraces = TraceSetSameX("scope traces")
allTraces.config["tags"]["DAQ"] = self.getConfig()