~dhogan/ift

24ddc56fe314fe9b8747eda82b0258b9040e6075 — Daniel Hogan 1 year, 3 months ago b889baf
improve plotting
1 files changed, 15 insertions(+), 63 deletions(-)

M plot.py
M plot.py => plot.py +15 -63
@@ 3,70 3,22 @@
import matplotlib.pyplot as plt
import numpy as np

sherlock1 = np.genfromtxt('data',delimiter='\t')
kif3, kif17, sse, _, _, _ = np.loadtxt('data', delimiter='\t', unpack=True)

sherlockSSE = sherlock1[:, 2]

numpnts = 141
kif3start = 0.19
kif17start = 0.19
resolution3 = 0.001
resolution17 = 0.001
kif3array  = np.arange(kif3start,  kif3start+(numpnts*resolution3),
resolution3)
kif17array = np.arange(kif17start, kif17start+(numpnts*resolution17),
resolution17)

imgx = np.append(kif3array, np.amax(kif3array)+resolution3)-resolution3/2
imgy = np.append(kif17array,
np.amax(kif17array)+resolution17)-resolution17/2


numpnts = 141
z = np.resize(sherlockSSE, [numpnts, numpnts])

zratio = z/np.amin(z)

minindex = np.unravel_index(np.argmax(1/zratio), (1/zratio).shape)


levels=[0.95]
dx = 0.001
dy = 0.001
n = 141

kif3array  = np.resize(kif3,  [n, n]) - dx/2
kif17array = np.resize(kif17, [n, n]) - dy/2
ssearray   = np.resize(sse,   [n, n])
ssearray   = np.amin(ssearray)/ssearray

# Plot
plt.viridis()
fig = plt.figure(figsize=(8,8))
fig.subplots_adjust(bottom=0.1, left=0.1)
plt.pcolormesh(imgx, imgy, 1/zratio)
plt.colorbar( shrink=0.80)
plt.plot(kif3array[minindex[1]], kif17array[minindex[0]], 'ow' )
plt.contour(kif3array, kif17array, 1/zratio, levels, linewidths=2,
colors=('w', 'w'))
plt.rcParams.update({'font.size': 14})
plt.ylabel(r'$K_{ON, KIF17}$'+' (s' +r'$^{-1}$' + ')')
plt.xlabel(r'$K_{ON, KIF3}$'+' (s' +r'$^{-1}$' + ')')
plt.xticks([0.23, 0.27, 0.31])
plt.yticks([0.23, 0.27, 0.31])
plt.axis([0.2195, 0.3305, 0.2195, 0.3305])
plt.axes().set_aspect('equal')
plt.savefig('sherlock_40_20000_5perc.pdf')


# Find indices for min values along contour
zbelow =((1/zratio)<0.9)+0
minkif3index = np.argmin(np.amin(zbelow, axis=0)) -1
maxkif3index = 141 - np.argmin(np.amin(zbelow, axis=0)[::-1])
minkif17index = np.argmin(np.amin(zbelow, axis=1)) - 1
maxkif17index = 141 - np.argmin(np.amin(zbelow, axis=1)[::-1])

# Confidence intervals
print(kif3array[minkif3index])
print(kif3array[maxkif3index])
print(kif17array[minkif17index])
print(kif17array[maxkif17index])

# Errors
kif3array[minkif3index]-kif3array[minindex[1]]
kif3array[maxkif3index]-kif3array[minindex[1]]
kif17array[minkif17index]-kif17array[minindex[0]]
kif17array[maxkif17index]-kif17array[minindex[0]]
plt.pcolormesh(kif3array, kif17array, ssearray, vmin=0, rasterized=True)
plt.colorbar(label=r'Inverse normalized SSE')
plt.plot(0.244, 0.258, 'ow')
plt.xlabel(r'$k_\mathrm{3AB,on}\ \left(\mathrm{s}^{-1}\right)$')
plt.ylabel(r'$k_\mathrm{17,on}\ \left(\mathrm{s}^{-1}\right)$')
plt.axis([0.20-dx/2, 0.32+dx/2, 0.20-dy/2, 0.32+dy/2])
plt.savefig('ift_heatmap.pdf', bbox_inches='tight')