aboutsummaryrefslogtreecommitdiff
path: root/qolab/hardware
diff options
context:
space:
mode:
Diffstat (limited to 'qolab/hardware')
-rw-r--r--qolab/hardware/scope/rigolds1054z.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/qolab/hardware/scope/rigolds1054z.py b/qolab/hardware/scope/rigolds1054z.py
index b7b4b91..0bed7e9 100644
--- a/qolab/hardware/scope/rigolds1054z.py
+++ b/qolab/hardware/scope/rigolds1054z.py
@@ -177,6 +177,7 @@ class RigolDS1054z(ScopeSCPI):
while strt <= Npnts:
stp = strt - 1 + chunk_size
stp = min(stp, Npnts)
+ chunk_size = stp-strt+1
# reading requested number of points in chunks
self.write(f":WAVeform:STARt {strt}")
self.write(f":WAVeform:STOP {stp}")
@@ -190,6 +191,13 @@ class RigolDS1054z(ScopeSCPI):
chunk_size=(chunk_size + 100),
)
if len(wfRawChunk) == 0:
+ print("WARNING: Got empty chunk! Redoing.")
+ continue # we need to repeat chunk read
+ if len(wfRawChunk) != chunk_size:
+ print("Warning: Expected chunk with length" +
+ f" {chunk_size} but got {len(wfRawChunk)}")
+ print(f"Warning: Current pointers are {strt=} {stp=} with {chunk_size=}")
+ print("Warning: Redoing, chunk reading.")
continue # we need to repeat chunk read
wfRaw[strt - 1 : stp] = wfRawChunk
"""
@@ -205,12 +213,13 @@ class RigolDS1054z(ScopeSCPI):
strt += chunk_size
errorFreeChunkSize.append(chunk_size)
chunk_size = min(maxreadable, int(chunk_size * 1.1))
- strt += chunk_size
- except VisaIOError:
+ except VisaIOError as err:
+ print(f"{err=}")
errCnt += 1
errorProneChunkSize.append(chunk_size)
- print(f"ERROR count is {errCnt} while reading raw chunk the scope")
- print(f"Current pointers are {strt=} {stp=} with {chunk_size=}")
+ print(f"Warning: count is {errCnt} while reading raw chunk the scope")
+ print(f"Warning: Current pointers are {strt=} {stp=} with {chunk_size=}")
+ print("Warning: Redoing, chunk reading.")
if len(errorFreeChunkSize) > 10:
chunk_size = int(np.mean(errorFreeChunkSize))
else: