summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/korad-logger10
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/korad-logger b/bin/korad-logger
index d73cff0..2b540a0 100755
--- a/bin/korad-logger
+++ b/bin/korad-logger
@@ -270,8 +270,6 @@ def measure_data(
signal.signal(signal.SIGQUIT, graceful_exit)
korad = KA320(port, channel)
- start_ts = time.time()
-
if filename is not None:
output_handle = open(filename, "w+")
else:
@@ -307,6 +305,8 @@ def measure_data(
else:
print(f"Starting data acquisition. Press Ctrl+C to stop.")
+ start_ts = time.time()
+
print("# Device: " + korad.get_id(), file=output_handle)
print("# Timestamp Voltage Current", file=output_handle)
while not terminate_measurement:
@@ -352,6 +352,12 @@ def measure_data(
output = output_handle.read()
output_handle.close()
+ # exclude header
+ output_len = len(output.splitlines()) - 2
+ print(
+ f"Logged {output_len:d} samples in {ts - start_ts:.0f} seconds (mean sample rate: {output_len / (ts - start_ts) :.1f} Hz)"
+ )
+
return output