aboutsummaryrefslogtreecommitdiff
path: root/qolab
diff options
context:
space:
mode:
Diffstat (limited to 'qolab')
-rw-r--r--qolab/hardware/scope/_basic.py16
-rw-r--r--qolab/hardware/scope/sds1104x.py6
2 files changed, 19 insertions, 3 deletions
diff --git a/qolab/hardware/scope/_basic.py b/qolab/hardware/scope/_basic.py
index 1ceecbc..c0a6f13 100644
--- a/qolab/hardware/scope/_basic.py
+++ b/qolab/hardware/scope/_basic.py
@@ -9,6 +9,22 @@ from qolab.hardware.basic import BasicInstrument
from qolab.data.trace import TraceSetSameX
+def calcSparsingAndNumPoints(self, availableNpnts=None, maxRequiredPoints=None):
+ if availableNpnts is None:
+ # using channel 1 to get availableNpnts
+ availableNpnts = self.getAvailableNumberOfPoints(1)
+ if maxRequiredPoints is None:
+ maxRequiredPoints = self.maxRequiredPoints
+
+ if availableNpnts <= maxRequiredPoints * 2:
+ Npnts = availableNpnts
+ sparsing = 1
+ else:
+ sparsing = int(np.floor(availableNpnts / maxRequiredPoints))
+ Npnts = int(np.floor(availableNpnts / sparsing))
+ return (sparsing, Npnts, availableNpnts, maxRequiredPoints)
+
+
class Scope(BasicInstrument):
"""Minimal class to implement a scope.
diff --git a/qolab/hardware/scope/sds1104x.py b/qolab/hardware/scope/sds1104x.py
index 12763ce..4ef4988 100644
--- a/qolab/hardware/scope/sds1104x.py
+++ b/qolab/hardware/scope/sds1104x.py
@@ -3,7 +3,7 @@ Created by Eugeniy E. Mikhailov 2021/11/29
"""
from qolab.hardware.basic import BasicInstrument
-from ._basic import ScopeSCPI
+from ._basic import ScopeSCPI, calcSparsingAndNumPoints
from qolab.hardware.scpi import response2numStr
from qolab.data.trace import Trace, TraceXY
import numpy as np
@@ -112,7 +112,7 @@ class SDS1104X(ScopeSCPI):
Npnts,
availableNpnts,
maxRequiredPoints,
- ) = self.calcSparsingAndNumPoints(availableNpnts, maxRequiredPoints)
+ ) = calcSparsingAndNumPoints(availableNpnts, maxRequiredPoints)
if decimate:
Npnts = availableNpnts # get all of them and decimate later
if (sparsing == 1 and Npnts == availableNpnts) or decimate:
@@ -296,7 +296,7 @@ class SDS1104X(ScopeSCPI):
Npnts,
availableNpnts,
maxRequiredPoints,
- ) = self.calcSparsingAndNumPoints(availableNpnts, maxRequiredPoints)
+ ) = calcSparsingAndNumPoints(availableNpnts, maxRequiredPoints)
sampleRate = self.getSampleRate()
timePerDiv = self.getTimePerDiv()
trigDelay = self.getTrigDelay()