From d233eb9dcc44a6ffe08b3d5f6e2031433edaaa99 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 7 Nov 2021 20:21:26 +0100 Subject: add --voltage-only, --current-only. Up to 24 Hz sample rate now! --- README.md | 2 +- bin/korad-logger | 26 +++++++++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f1cb5ea..c3ebdd2 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ through voltage/current slopes for automated I-V curve measurements. It has been successfully used with "RND 320-KA3005P" (single-channel) and "RND 320-KA3305P" (dual-channel) supplies. Observed attributes: -* Time resolution: **a few Hz** +* Time resolution: 10 .. 24 Hz * Voltage range: 0 .. 30 V * Voltage resolution: 10 mV * Current range: 0 .. 5 A diff --git a/bin/korad-logger b/bin/korad-logger index 2b540a0..93a4005 100755 --- a/bin/korad-logger +++ b/bin/korad-logger @@ -253,6 +253,8 @@ def measure_data( voltage_range=(None, None, None), current_range=(None, None, None), on_off=False, + log_voltage=True, + log_current=True, ): global terminate_measurement @@ -311,12 +313,18 @@ def measure_data( print("# Timestamp Voltage Current", file=output_handle) while not terminate_measurement: ts = time.time() - current = korad.get_current() - voltage = korad.get_voltage() + if log_current: + current = korad.get_current() + else: + current = None + if log_voltage: + voltage = korad.get_voltage() + else: + voltage = None if voltage is not None and current is not None: print(f"{ts:.3f} {voltage:5.2f} {current:5.3f}", file=output_handle) elif voltage is not None: - print(f"{ts:.3f} {voltage:5.2f} NaN", file=output_handle) + print(f"{ts:.3f} {voltage:5.2f} NaN", file=output_handle) elif current is not None: print(f"{ts:.3f} NaN {current:5.3f}", file=output_handle) else: @@ -527,6 +535,11 @@ def main(): metavar="START STOP STEP", help="Vary voltage limit from START to STOP over the course of the measurement. Adjust by STEP V per second.", ) + parser.add_argument( + "--voltage-only", + action="store_true", + help="Log voltage only (ignore current readings). Useful to increase sample rate for CC measurements.", + ) parser.add_argument( "--current-limit", type=float, @@ -538,6 +551,11 @@ def main(): metavar="START STOP STEP", help="Vary current limit from START to STOP over the course of the measurement. Adjust by STEP A per second.", ) + parser.add_argument( + "--current-only", + action="store_true", + help="Log current only (ignore current readings). Useful to increase sample rate for CV measurements.", + ) parser.add_argument( "--on-off", action="store_true", @@ -600,6 +618,8 @@ def main(): voltage_range=voltage_range, current_range=current_range, on_off=args.on_off, + log_voltage=not args.current_only, + log_current=not args.voltage_only, ) data = parse_data(log_data, skip=args.skip, limit=args.limit) -- cgit v1.2.3