aboutsummaryrefslogtreecommitdiff
path: root/qolab/hardware/scope
diff options
context:
space:
mode:
Diffstat (limited to 'qolab/hardware/scope')
-rw-r--r--qolab/hardware/scope/_basic.py18
1 files 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()<deadline):
+ while (not scaled_corectly) and (time.time() < deadline):
tr = self.getTrace(chNum)
vPerDiv = self.getChanVoltsPerDiv(chNum)
offset = self.getChanVoltageOffset(chNum)
@@ -182,26 +182,26 @@ class Scope(BasicInstrument):
y = tr.y.values
tr_max = y.max()
tr_min = y.min()
- screen_portion = (y.max - y.min) / vPerDiv / self.vertDivOnScreen
top_margin = (v_max - tr_max) / v_range
bottom_margin = (tr_min - v_min) / v_range
is_top_margin_good = (top_margin > 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()