diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2024-07-20 17:50:36 -0400 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2024-07-20 17:50:36 -0400 |
commit | bd959db874b0441e95bf7838589f6424a3561a81 (patch) | |
tree | efcc038b496819341743023f1abe30cd6de7cccb /qolab/hardware/scope/_basic.py | |
parent | ec71f9b969d21c6f78e56eee960ee95de7422167 (diff) | |
download | qolab-bd959db874b0441e95bf7838589f6424a3561a81.tar.gz qolab-bd959db874b0441e95bf7838589f6424a3561a81.zip |
move calcSparsingAndNumPoints to a separate function
Diffstat (limited to 'qolab/hardware/scope/_basic.py')
-rw-r--r-- | qolab/hardware/scope/_basic.py | 16 |
1 files changed, 16 insertions, 0 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. |