From a069c0fab77e2ac7bdf16e9069ef0149493f0df7 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Wed, 24 Jul 2024 23:28:04 -0400 Subject: added dummy method for switching to fast acquisition and back --- qolab/hardware/scope/_basic.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/qolab/hardware/scope/_basic.py b/qolab/hardware/scope/_basic.py index 751026d..261e947 100644 --- a/qolab/hardware/scope/_basic.py +++ b/qolab/hardware/scope/_basic.py @@ -157,6 +157,34 @@ class Scope(BasicInstrument): self.setRun(old_run_status) # start running if it was old run state return allTraces + def restorePriorToFastGrab(self, chNum, old_config): + """Restore relevant channel/scope settings prior to fast grab tune up.""" + logger.info("method restorePriorToFastGrab is not implemented") + + def switchToFastGrab(self, chNum): + """Switch scope to the fastest mode for trace delivery. + + Intended to be used in chanAutoScale methods where speed + transfer is more important than fidelity. It is good + idea to implement function ``restorePriorToFastGrab(chan, old_config)`` + to be used in conjunction with ``switchToFastGrab``. + + To be fast, it should aim to decrease data transfer time, + i.e. reduce number of transferred point. + It also need to be interface dependent. GPIB and USB are known + to be quite slow when compared to network connection. + + So try to be smart in hardware dependent classes. + + Return + ------ + old_config : dictionary + old config with settings necessary to restore initial state + """ + + logger.info("machinery for switchToFastGrab is not implemented") + return self.getConfig() + def chanAutoScale(self, chNum, margin=0.125, timeout=5): """Auto scale channel to fit signal on screen. @@ -174,6 +202,7 @@ class Scope(BasicInstrument): at top and bottom for 8 division scope. """ + old_config = self.switchToFastGrab(chNum) starttime = time.time() deadline = starttime + timeout timespan = self.getTimePerDiv() * self.horizDivOnScreen @@ -222,6 +251,7 @@ class Scope(BasicInstrument): # we converge, there is no point to improve break scaled_corectly = False + self.restorePriorToFastGrab(chNum, old_config) if time.time() > deadline: logger.warning( f"Scope did not make proper channel {chNum} scaling within {timeout=} sec." -- cgit v1.2.3