summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-11-06 18:38:13 +0100
committerDaniel Friesel <derf@finalrewind.org>2021-11-06 18:38:13 +0100
commit0ee2ff5678c9ec282fce365aae111c3e491b8f1e (patch)
treeb098de6a90760677b3f4167091bcc0e752ba4272 /bin
parentf1862410517d617d3115948cbe58d4767590ff94 (diff)
add voltage vs current (and vice versa, and power) plots
Diffstat (limited to 'bin')
-rwxr-xr-xbin/kaxxxxp-viewer27
1 files changed, 25 insertions, 2 deletions
diff --git a/bin/kaxxxxp-viewer b/bin/kaxxxxp-viewer
index 1a0bb5e..93467ea 100755
--- a/bin/kaxxxxp-viewer
+++ b/bin/kaxxxxp-viewer
@@ -364,6 +364,7 @@ def plot_data(data, mode):
markersize=1,
)
plt.legend(handles=[datahandle, meanhandle])
+ plt.xlabel("Time [s]")
plt.ylabel("Voltage [V]")
elif mode == "I":
@@ -376,6 +377,7 @@ def plot_data(data, mode):
markersize=1,
)
plt.legend(handles=[datahandle, meanhandle])
+ plt.xlabel("Time [s]")
plt.ylabel("Current [A]")
elif mode == "P":
@@ -390,6 +392,27 @@ def plot_data(data, mode):
markersize=1,
)
plt.legend(handles=[datahandle, meanhandle])
+ plt.xlabel("Time [s]")
+ plt.ylabel("Power [W]")
+
+ elif mode == "UI":
+ plt.plot(data[:, 1], data[:, 2], "bs", markersize=1)
+ plt.xlabel("Voltage [V]")
+ plt.ylabel("Current [A]")
+
+ elif mode == "UP":
+ plt.plot(data[:, 1], data[:, 1] * data[:, 2], "bs", markersize=1)
+ plt.xlabel("Voltage [V]")
+ plt.ylabel("Power [W]")
+
+ elif mode == "IU":
+ plt.plot(data[:, 2], data[:, 1], "bs", markersize=1)
+ plt.xlabel("Current [A]")
+ plt.ylabel("Voltage [V]")
+
+ elif mode == "IP":
+ plt.plot(data[:, 2], data[:, 1] * data[:, 2], "bs", markersize=1)
+ plt.xlabel("Current [A]")
plt.ylabel("Power [W]")
plt.show()
@@ -529,8 +552,8 @@ def main():
parser.add_argument(
"--plot",
metavar="UNIT",
- choices=["U", "I", "P"],
- help="Plot voltage / current / power over time",
+ choices=["U", "I", "P", "UI", "UP", "IU", "IP"],
+ help="Plot voltage / current / power over time or voltage vs current / current vs voltage",
)
parser.add_argument(
"duration", type=int, nargs="?", help="Measurement duration in seconds"