update to include datapoints
This commit is contained in:
parent
6675b0074b
commit
6af430ce14
|
@ -8,15 +8,12 @@ import VisTools.plotting as vt
|
||||||
import uncertainties as unc
|
import uncertainties as unc
|
||||||
import uncertainties.unumpy as unp
|
import uncertainties.unumpy as unp
|
||||||
|
|
||||||
import statsmodels.api as sm
|
|
||||||
from statsmodels.stats.outliers_influence import summary_table as st
|
|
||||||
|
|
||||||
plt.ioff()
|
plt.ioff()
|
||||||
plt.style.use('bmh')
|
plt.style.use('bmh')
|
||||||
fig, axarr = plt.subplots(
|
fig, axarr = plt.subplots(
|
||||||
2,
|
2,
|
||||||
1,
|
1,
|
||||||
figsize=(9, 8),
|
figsize=(10, 8),
|
||||||
gridspec_kw = {'height_ratios':[4,1]}
|
gridspec_kw = {'height_ratios':[4,1]}
|
||||||
)
|
)
|
||||||
plt.subplots_adjust(hspace=.5)
|
plt.subplots_adjust(hspace=.5)
|
||||||
|
@ -26,6 +23,7 @@ fits = np.array([])
|
||||||
errs = np.array([])
|
errs = np.array([])
|
||||||
colors = np.array([])
|
colors = np.array([])
|
||||||
|
|
||||||
|
data['dv_pit48/v'] /= 2
|
||||||
data['Dv'] = data['v_pit48/v'] - data['v_set/v']
|
data['Dv'] = data['v_pit48/v'] - data['v_set/v']
|
||||||
data['Dvk'] = data['v_keith/v'] - data['v_set/v']
|
data['Dvk'] = data['v_keith/v'] - data['v_set/v']
|
||||||
print(data)
|
print(data)
|
||||||
|
@ -36,10 +34,10 @@ def plot_and_linfit(col: str,fil, l: str):
|
||||||
p = axarr[0].errorbar(
|
p = axarr[0].errorbar(
|
||||||
data[fil]['v_set/v'],
|
data[fil]['v_set/v'],
|
||||||
data[fil][col],
|
data[fil][col],
|
||||||
alpha = 0,
|
alpha = 0.3,
|
||||||
label=None,
|
label=None,
|
||||||
# fmt='.',
|
fmt='.',
|
||||||
# antialiased=True
|
antialiased=True
|
||||||
)
|
)
|
||||||
|
|
||||||
vals = vt.lm_plot(
|
vals = vt.lm_plot(
|
||||||
|
@ -55,13 +53,16 @@ def plot_and_linfit(col: str,fil, l: str):
|
||||||
|
|
||||||
return vals, p
|
return vals, p
|
||||||
|
|
||||||
plot_and_linfit('Dvk', data.cycles == 0, 'ref')
|
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
val, p = plot_and_linfit('Dv', data.cycles == i, 'scaler: {}'.format(i))
|
val, p = plot_and_linfit(
|
||||||
|
'Dv',
|
||||||
|
data.cycles == i,
|
||||||
|
'$f_{}={{m:.3f}}\\cdot x{{c:+.3f}}V$'.format(i))
|
||||||
fits = np.append(fits, val[0])
|
fits = np.append(fits, val[0])
|
||||||
#errs = np.append(errs, np.sqrt(pcov[0][0]))
|
#errs = np.append(errs, np.sqrt(pcov[0][0]))
|
||||||
#colors = np.append(colors, p[0].get_color() )
|
#colors = np.append(colors, p[0].get_color() )
|
||||||
|
|
||||||
|
plot_and_linfit('Dvk', data.cycles == 0, 'reference measurement')
|
||||||
|
|
||||||
print(fits[0].n)
|
print(fits[0].n)
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
|
@ -77,14 +78,16 @@ axarr[0].set_xlabel('V$_{set}$/V')
|
||||||
#axarr[0].set_title("PowerIt ADC Calibration: dependency on measurement cycles")
|
#axarr[0].set_title("PowerIt ADC Calibration: dependency on measurement cycles")
|
||||||
axarr[0].set_ylabel('$\Delta$V$_{IN}$ / V')
|
axarr[0].set_ylabel('$\Delta$V$_{IN}$ / V')
|
||||||
|
|
||||||
axarr[1].set_xlabel('sampleTicks scaler')
|
axarr[1].set_xlabel('scaler value')
|
||||||
axarr[1].set_ylabel('$\Delta(\Delta$V$_{IN})$')
|
axarr[1].set_ylabel('$m = \Delta$Gain')
|
||||||
axarr[0].legend(bbox_to_anchor=(0, -.28,1, 1), loc="lower left",
|
axarr[0].legend(
|
||||||
mode="expand", borderaxespad=0, ncol=5)
|
bbox_to_anchor=(0, -.29,1, 1),
|
||||||
#plt.tight_layout()
|
loc="lower left",
|
||||||
plt.savefig("./" + __file__[:-3].split("_")[1] + ".pdf", dpi=1000, bbox_inches='tight')
|
mode="expand",
|
||||||
|
borderaxespad=0,
|
||||||
|
ncol=3)
|
||||||
|
plt.savefig(
|
||||||
|
"./" + __file__[:-3].split("_")[1] + ".pdf",
|
||||||
|
dpi=1000,
|
||||||
|
bbox_inches='tight')
|
||||||
|
|
||||||
|
|
||||||
ss, d, ss2 = st(sm.OLS(data[data.cycles == 0]['v_pit48/v'], data[data.cycles == 0]['v_set/v']).fit(), alpha=.05)
|
|
||||||
|
|
||||||
low_ci, high_ci = d[:,4:6].T
|
|
||||||
|
|
Loading…
Reference in New Issue