From 730a583d8a66ff5e4103696ac1977db7b20282b1 Mon Sep 17 00:00:00 2001 From: Blaise Thompson Date: Tue, 13 Nov 2018 19:01:47 -0600 Subject: 2018-11-13 19:01 --- data/2018-11-08/workup_ohm.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 data/2018-11-08/workup_ohm.py (limited to 'data/2018-11-08/workup_ohm.py') diff --git a/data/2018-11-08/workup_ohm.py b/data/2018-11-08/workup_ohm.py new file mode 100644 index 0000000..95ebc42 --- /dev/null +++ b/data/2018-11-08/workup_ohm.py @@ -0,0 +1,33 @@ +import numpy as np +import matplotlib.pyplot as plt + +# get data +xi, yi = np.genfromtxt('ohm.txt').T + +# prepare figure +plt.figure() +ax = plt.gca() + +# raw +ax.plot(xi, yi) +ax.grid() +ax.set_xlim(0, 500) +ax.set_ylim(0, 5 * 1.1) +ax.set_xlabel('set point') +ax.set_ylabel('measured', color='C0') +ax.set_xscale('symlog') + +# diff +ax = ax.twinx() +error = yi - (xi*0.01) +error /= xi +error *= 100 # to percent +error = np.abs(error) # absolute value +print(error) +ax.plot(xi, error, c="C1") +ax.set_ylabel('percent error', color='C1') +ax.grid() +ax.set_ylim(0, 0.3 * 1.1) +ax.set_yticks(np.linspace(0, 0.3, 6)) + +plt.savefig('ohm_symlog.png') -- cgit v1.2.3