From e7fee12153059f003be4091ebe5200077d3f6a8c Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Mon, 22 Jul 2024 15:44:21 -0400 Subject: improvement in chanAutoScale --- qolab/hardware/scope/_basic.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/qolab/hardware/scope/_basic.py b/qolab/hardware/scope/_basic.py index 4e546ac..c39ef1f 100644 --- a/qolab/hardware/scope/_basic.py +++ b/qolab/hardware/scope/_basic.py @@ -170,9 +170,9 @@ class Scope(BasicInstrument): """ starttime = time.time() - deadline = starttime+timeout + deadline = starttime + timeout scaled_corectly = False - while (not scaled_corectly) and (time.time() margin / 2) and (top_margin < margin) - is_bottom_margin_good = (bottom_margin > margin / 2) and (bottom_margin < margin) + is_bottom_margin_good = (bottom_margin > margin / 2) and ( + bottom_margin < margin + ) if (is_bottom_margin_good) and (is_top_margin_good): scaled_corectly = True break - offset = (tr_max+tr_min)/2 - vPerDiv = (tr_max -tr_min)/(self.vertDivOnScreen*(1-margin*1.5)) + offset = -(tr_max + tr_min) / 2 + vPerDiv = (tr_max - tr_min) / (self.vertDivOnScreen * (1 - margin * 1.5)) self.setChanVoltageOffset(chNum, offset) self.setChanVoltsPerDiv(chNum, vPerDiv) scaled_corectly = False - if (time.time()>deadline): + if time.time() > deadline: logger.warning( - f"Scope did not make proper channel {chNum} scaling within {timeout=} sec, try to increase it." + f"Scope did not make proper channel {chNum} scaling within {timeout=} sec." ) - def plot(self, **kwargs): allTraces = self.getAllTraces(**kwargs) allTraces.plot() -- cgit v1.2.3