aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qolab/hardware/scope/_basic.py19
-rw-r--r--qolab/hardware/scope/sds1104x.py21
2 files changed, 23 insertions, 17 deletions
diff --git a/qolab/hardware/scope/_basic.py b/qolab/hardware/scope/_basic.py
index c0a6f13..e67e6af 100644
--- a/qolab/hardware/scope/_basic.py
+++ b/qolab/hardware/scope/_basic.py
@@ -10,9 +10,24 @@ from qolab.data.trace import TraceSetSameX
def calcSparsingAndNumPoints(self, availableNpnts=None, maxRequiredPoints=None):
+ """Calculate sparcing and number of sparced points.
+
+ Parameters
+ ----------
+ availableNpnts: int or None
+ Number of available points. If set to None exit with error
+ maxRequiredPoints: int or (None)
+ number of requested points after decimation.
+ If availableNpnts< maxRequiredPoints*2,
+ decimation is impossible and we will get up to factor of 2 more
+ than requested.
+
+ Return
+ ------
+ (sparsing, Npnts, availableNpnts, maxRequiredPoints)
+ """
if availableNpnts is None:
- # using channel 1 to get availableNpnts
- availableNpnts = self.getAvailableNumberOfPoints(1)
+ raise ValueError("Invalid availableNpnts value, must be int.")
if maxRequiredPoints is None:
maxRequiredPoints = self.maxRequiredPoints
diff --git a/qolab/hardware/scope/sds1104x.py b/qolab/hardware/scope/sds1104x.py
index 4ef4988..af63609 100644
--- a/qolab/hardware/scope/sds1104x.py
+++ b/qolab/hardware/scope/sds1104x.py
@@ -62,21 +62,6 @@ class SDS1104X(ScopeSCPI):
# it is not possible to do with this model directly
pass
- 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)
-
def getRawWaveform(
self, chNum, availableNpnts=None, maxRequiredPoints=None, decimate=True
):
@@ -107,6 +92,9 @@ class SDS1104X(ScopeSCPI):
to use ``decimate=True``.
"""
+ if availableNpnts is None:
+ # using channel 1 to get availableNpnts
+ availableNpnts = self.getAvailableNumberOfPoints(1)
(
sparsing,
Npnts,
@@ -291,6 +279,9 @@ class SDS1104X(ScopeSCPI):
return (tr, availableNpnts)
def getTimeTrace(self, availableNpnts=None, maxRequiredPoints=None):
+ if availableNpnts is None:
+ # using channel 1 to get availableNpnts
+ availableNpnts = self.getAvailableNumberOfPoints(1)
(
sparsing,
Npnts,