diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2024-07-19 22:52:20 -0400 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2024-07-19 22:52:20 -0400 |
commit | 6c79b95ab8727dac763f213f050c7839e51fee38 (patch) | |
tree | 29a0afbca5856cb39803cd87aa70f824bb01689f /qolab/hardware/scope | |
parent | fe3229225717b94663ac3af0ca13ac1de87e5895 (diff) | |
download | qolab-6c79b95ab8727dac763f213f050c7839e51fee38.tar.gz qolab-6c79b95ab8727dac763f213f050c7839e51fee38.zip |
better warnings
Diffstat (limited to 'qolab/hardware/scope')
-rw-r--r-- | qolab/hardware/scope/rigolds1054z.py | 17 |
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: |