def evaluate(theta, x, y, c): bindingF = x q, w, j = theta pVals = np.zeros(bindingF.shape) fVals = np.zeros(bindingF.shape) for i, bf in enumerate(bindingF): p, _, _ = act.bindingFinder((0, q, w), bf) pVals[i] = p fVals[i] = act.fN((p, q, w))[1] model = models.meanL(c, fVals, j) return model
def plotterCran(minB,maxB,model,cRan,q,w,j): for c in cRan: bFhighRes = np.linspace(minB,maxB,num=100,endpoint=True) fHR = np.zeros(100) for i,x in enumerate(bFhighRes): p = model.bindingFinder((0,q,w),x)[0] fHR[i] = model.fN((p,q,w))[1] mlHighRes = models.meanL(c*molarConv,fHR,j) plt.plot(bFhighRes,mlHighRes/100,label=str(c)+'$\mu M$') plt.xlabel('Cofilin Binding Fraction') plt.ylabel('Filament length ($\mu m$)') plt.legend(loc=0) plt.show()
def plotterModels(ax, minB,maxB,model,c,qR,wR,jR,modelStr,bindF): for aa in range(len(qR)): q = qR[aa] j = jR[aa] w = wR[aa] q *= -1 w *= -1 bFhighRes = np.linspace(minB,maxB,num=100,endpoint=True) fHR = np.zeros(100) for i,x in enumerate(bFhighRes): p = model.bindingFinder((0,q,w),x)[0] fHR[i] = model.fN((p,q,w))[1] mlHighRes = models.meanL(c*molarConv,fHR,j) ax.plot(bFhighRes,mlHighRes,label=modelStr[aa])
def plottermodelRan(minB,maxB,model,c,qR,wR,jR): for aa in range(len(qR)): q = qR[aa] j = jR[aa] w = wR[aa] bFhighRes = np.linspace(minB,maxB,num=100,endpoint=True) fHR = np.zeros(100) for i,x in enumerate(bFhighRes): p = model.bindingFinder((0,q,w),x)[0] fHR[i] = model.fN((p,q,w))[1] mlHighRes = models.meanL(c*molarConv,fHR,j) plt.plot(bFhighRes,mlHighRes/100,label='('+str(q)+','+str(w)+','+str(j)+')') plt.xlabel('Cofilin Binding Fraction') plt.ylabel('Filament length ($\mu m$)') plt.legend(loc=0) plt.show()
def plotterModels(minB,maxB,modelss,c,qR,wR,jR,modelStr,bindF,length,dl): for aa in range(len(qR)): q = qR[aa] j = jR[aa] w = wR[aa] bFhighRes = np.linspace(minB,maxB,num=100,endpoint=True) fHR = np.zeros(100) for i,x in enumerate(bFhighRes): p = modelss[aa].bindingFinder((0,q,w),x)[0] fHR[i] = modelss[aa].fN((p,q,w))[1] mlHighRes = models.meanL(c*molarConv,fHR,j) plt.plot(bFhighRes,mlHighRes/100,label=modelStr[aa]+' ('+str(q)+','+str(w)+','+str(j)+')') plt.scatter(bindingF,length/100) plt.errorbar(bindingF,length/100,yerr=dl/100,ls='dotted') plt.xlabel('Cofilin Binding Fraction') plt.ylabel('Filament length ($\mu m$)') plt.legend(loc=0) plt.show()
rights)): if l != -3 or r != 0: continue q, w, j = params bFhighRes = np.linspace(min(bindingF), max(bindingF), num=100, endpoint=True) fHR = np.zeros(100) for i, x in enumerate(bFhighRes): p = act.bindingFinder((0, q, w), x)[0] fHR[i] = act.fN((p, q, w))[1] print(x, p, q, w, act.fN((p, q, w))) if i % 10 == 0: print(p) mlHighRes = models.meanL(c, fHR, j) if abs(l) < abs(r): line, = ax.plot(bFhighRes, mlHighRes, linewidth=1, label=label, linestyle='-') elif abs(l) == abs(r): line, = ax.plot(bFhighRes, mlHighRes, linewidth=1, label=label, linestyle='-.') else: line, = ax.plot(bFhighRes, mlHighRes,
q_mcmc, w_mcmc, j_mcmc, [ 0, 0, reducedChiSquared((q_mcmc[0], w_mcmc[0], j_mcmc[0]), bindingF, length, dl, c) ] ])) fig = corner(samples, labels=["$Q$", "$W$", "$J$", "$\ln\,f$"]) fig.savefig(modelSTR + '_' + 'triangle' + s + '.png') plt.close('all') plt.scatter(bindingF, length) plt.errorbar(bindingF, length, yerr=dl) bFhighRes = np.linspace(min(bindingF), max(bindingF), num=100, endpoint=True) fHR = np.zeros(100) for i, x in enumerate(bFhighRes): p = act.bindingFinder((0, q_mcmc[0], w_mcmc[0]), x)[0] fHR[i] = act.fN((p, q_mcmc[0], w_mcmc[0]))[1] if i % 10 == 0: print(p) mlHighRes = models.meanL(c, fHR, j_mcmc[0]) plt.plot(bFhighRes, mlHighRes) plt.xlabel('Cofilin Binding Fraction') plt.ylabel('Filament length ($\mu m$)') plt.title(name) plt.savefig(modelSTR + '_' + 'fig.pdf', dpi=100) exit()