def discreet(py, pt, *string, **kwargs): mode = kwargs.get('mode', 'limit') (m6, m7, m12, m1, n1) = prc.evmode(mode, py) t = [pt, pt, pt, pt] px = [ prc.discr(py[1], m1, n1), prc.discr(py[6], m6), prc.discr(py[7], m7), prc.discr(py[12], m12) ] colour = [c.blood, 'navy', c.darkorange, c.green] label = ['IKKa', 'NF$\kappa$B', 'A20', 'NF$\kappa$B:I$\kappa$B'] lstyle = ['-', '--', '-.', ':'] xlim = (-1, 6) ps.figa(t, px, colour, label, xlim=xlim, title=string, linestyle=lstyle, xlabel='t$\\ /\\ $h', ylabel='c$\\ / \\ $ a.u.', label=True, path='../../graphics/discreet{}.png'.format(kwargs.get('mode', '')), DPI=500)
def discrTalk(py, pt, **kwargs): mode = kwargs.get('mode', 'limit') (m6, m7, m12, m1, n1) = prc.evmode(mode) t = [pt, pt, pt, pt] xlim = (-1, 6) lstyle = ['--', '-', (0, (1, 1))] xlab = 'Time' ylab = 'Activity' MAX7 = np.amax(py[7]) TH7 = m7 / MAX7 plt.style.use('seaborn-paper') seaborn.set_context("talk") fig, ax = plt.subplots(1, 1) px3 = [ps.hline(TH7, pt), prc.discr(py[7], m7), prc.norm(py[7])] colour3 = [c.plum, c.gold, c.orange] for i, j in enumerate(px3): ax.plot(t[i] - 101, j, c=colour3[i], linestyle=lstyle[i]) ax.set_title('A20') ax.set_xlim(xlim) ax.set_yticks([]) ax.set_xticks([]) ax.set_xlabel(xlab) ax.set_ylabel(ylab) ax.yaxis.set_zorder(3) fig.tight_layout() plt.savefig('../../graphics/discrTalk{}{}.png'.format( kwargs.get('strg', ''), mode), dpi=500) plt.close()
def discreetmedian(py, pt, *string): t = [pt, pt, pt, pt] px = [ prc.discr(py[6], np.median(py[6])), prc.discr(py[1], np.median(py[1])), prc.discr(py[7], np.median(py[7])), prc.discr(py[12], np.median(py[12])) ] colour = ['navy', c.blood, c.darkorange, c.green] label = ['NF$\kappa$B', 'IKKa', 'A20', 'NF$\kappa$B:I$\kappa$B'] lstyle = ['-', '-', '-', '-'] xlim = (-1, 6) ps.figa(t, px, colour, label, xlim=xlim, title=string, linestyle=lstyle, xlabel='t$\\ /\\ $h', ylabel='c$\\ / \\ $ a.u.', label=True, path='../../graphics/discreetmedian.png', DPI=500)
def discr(py,**kwargs): mode=kwargs.get('mode','limit') y=[] for i in range(0,len(py)): if mode=='limit': if i==1: y.append(np.array(prc.discr(py[i],mod.limit1(i),mod.limitKO(i)))) else: y.append(np.array(prc.discr(py[i],mod.limit1(i)))) elif mode=='mean': if i==1: y.append(np.array(prc.discr(py[i],mod.meanpy(i)/2,mod.meanpy(i)))) else: y.append(np.array(prc.discr(py[i],mod.meanpy(i)))) elif mode =='half': if i==1: y.append(np.array(prc.discr(py[i],(mod.limit0(i)+mod.limit1(i))/2,(mod.limit0(i)+mod.limitKO(i))/2))) else: y.append(np.array(prc.discr(py[i],(mod.limit0(i)+mod.limit1(i))/2))) elif mode=='hmean': if i==1: y.append(np.array(prc.discr(py[i],(mod.limit0(i)+mod.meanpy(i))/2,(mod.limit0(i)+mod.meanKO(i))/2))) else: y.append(np.array(prc.discr(py[i],(mod.limit0(i)+mod.meanpy(i))/2))) elif mode=='custom': if i==1: y.append(np.array(prc.discr(py[i],(mod.limit0(i)+mod.limit1(i))/2,mod.mean24(i)))) else: y.append(np.array(prc.discr(py[i],mod.mean24(i)))) elif mode=='custom2': if i==1: y.append(np.array(prc.discr(py[i],(mod.limit0(1)+mod.limit1(1))/2,mod.mean24(1)))) elif i==7: y.append(np.array(prc.discr(py[i],((mod.limit0(7)+mod.limit1(7))/2)))) else: y.append(np.array(prc.discr(py[i],mod.mean24(i)))) elif mode=='custom3':#median, hlim if i==1: y.append(np.array(prc.discr(py[i],(mod.limit0(i)+mod.limit1(i))/2,mod.median(i)))) else: y.append(np.array(prc.discr(py[i],mod.median(i)))) y=np.stack(y) return y
def discrnor(py, pt, **kwargs): mode = kwargs.get('mode', 'limit') (m6, m7, m12, m1, n1) = prc.evmode(mode) t = [pt, pt, pt, pt] xlim = (-1, 6) label = ['Normalisation', 'Discretisation', '$\\vartheta$'] lstyle = ['-', '--', '-.', '-.'] tick = [0, 0.5, 1] mtick = [0.25, 0.75] xlab = '$t$ in h' ylab = '$c$ in nM' ylab2 = 'Activity' c1 = c.plum c2 = c.deeppink MAX6 = np.amax(py[6]) TH6 = m6 / MAX6 MAX12 = np.amax(py[12]) TH12 = m12 / MAX12 MAX7 = np.amax(py[7]) TH7 = m7 / MAX7 MAX1 = np.amax(py[1]) TH1_1 = m1 / MAX1 TH1_2 = n1 / MAX1 thresh1 = Line2D([0], [0], color=c1, lw=1, linestyle='-.') thresh2 = Line2D([0], [0], color=c2, lw=1, linestyle=':') l1 = Line2D([0], [0], color='black', lw=1, linestyle='-') l2 = Line2D([0], [0], color='black', lw=1, linestyle='--') plt.style.use('seaborn-paper') fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2) px1 = [prc.norm(py[6]), prc.discr(py[6], m6), ps.hline(TH6, pt)] colour1 = ['navy', c.dodgerblue, c1] for i, j in enumerate(px1): ax3.plot(t[i] - 101, j, c=colour1[i], linestyle=lstyle[i]) ax3.set_title('NF$\kappa$B') ax3.set_xlim(xlim) ax3.set_yticks(tick) ax3.set_yticks(TH6, minor=True) ax3.set_yticklabels([ 0, np.around(MAX6 * 500, decimals=1), np.around(MAX6 * 1000, decimals=1) ]) ax3.set_yticklabels([np.around(MAX6 * TH6[0] * 1000, decimals=1)], minor=True) ax3.set_xlabel(xlab) ax3.set_ylabel(ylab) ax32 = ax3.twinx() ax32.yaxis.tick_right() NUL = ax32.transData.inverted().transform(ax3.transData.transform( (0, 0)))[1] ONE = ax32.transData.inverted().transform(ax3.transData.transform( (1, 1)))[1] ax32.set_yticks([NUL, ONE]) ax32.set_yticklabels([0, 1]) ax32.set_ylabel(ylab2) px2 = [prc.norm(py[12]), prc.discr(py[12], m12), ps.hline(TH12, pt)] colour2 = [c.green, c.lime, c1] for i, j in enumerate(px2): ax2.plot(t[i] - 101, j, c=colour2[i], linestyle=lstyle[i]) ax2.set_title('I$\kappa$B') ax2.set_xlim(xlim) ax2.set_yticks(tick) ax2.set_yticks(TH12, minor=True) ax2.set_yticklabels([ 0, np.around(MAX12 * 500, decimals=1), np.around(MAX12 * 1000, decimals=1) ]) ax2.set_yticklabels([np.around(MAX12 * TH12[0] * 1000, decimals=1)], minor=True) ax2.set_xlabel(xlab) ax2.set_ylabel(ylab) ax22 = ax2.twinx() ax22.yaxis.tick_right() NUL = ax22.transData.inverted().transform(ax2.transData.transform( (0, 0)))[1] ONE = ax22.transData.inverted().transform(ax2.transData.transform( (1, 1)))[1] ax22.set_yticks([NUL, ONE]) ax22.set_yticklabels([0, 1]) ax22.set_ylabel(ylab2) #lstyle[-2]=':' px3 = [prc.norm(py[7]), prc.discr(py[7], m7), ps.hline(TH7, pt)] colour3 = [c.darkorange, c.gold, c1] for i, j in enumerate(px3): ax4.plot(t[i] - 101, j, c=colour3[i], linestyle=lstyle[i]) ax4.set_title('A20') ax4.set_xlim(xlim) ax4.set_yticks(tick) ax4.set_yticks(TH7, minor=True) ax4.set_yticklabels([ 0, np.around(MAX7 * 500, decimals=1), np.around(MAX7 * 1000, decimals=1) ]) ax4.set_yticklabels([np.around(MAX7 * TH7[0] * 1000, decimals=1)], minor=True) ax4.yaxis.get_ticklabels(minor=True)[0].set_verticalalignment('top') ax4.yaxis.get_ticklabels()[1].set_verticalalignment('baseline') ax4.set_xlabel(xlab) ax4.set_ylabel(ylab) ax42 = ax4.twinx() ax42.yaxis.tick_right() NUL = ax42.transData.inverted().transform(ax4.transData.transform( (0, 0)))[1] ONE = ax42.transData.inverted().transform(ax4.transData.transform( (1, 1)))[1] ax42.set_yticks([NUL, ONE]) ax42.set_yticklabels([0, 1]) ax42.set_ylabel(ylab2) px4 = [ prc.norm(py[1]), prc.discr(py[1], m1, n1), ps.hline(TH1_1, pt), ps.hline(TH1_2, pt) ] colour4 = [c.blood, 'r', c2, c1] for i, j in enumerate(px4): ax1.plot(t[i] - 101, j, c=colour4[i], linestyle=lstyle[i]) ax1.set_title('IKK') ax1.set_xlim(xlim) ax1.set_yticks(tick) ax1.set_yticks(np.append(TH1_1, TH1_2), minor=True) ax1.set_yticklabels([ '', np.around(MAX1 * 500, decimals=1), np.around(MAX1 * 1000, decimals=1) ]) ax1.set_yticklabels([ np.around(MAX1 * TH1_1[0] * 1000, decimals=1), np.around(MAX1 * TH1_2[0] * 1000, decimals=1) ], minor=True) ax1.set_xlabel(xlab) ax1.set_ylabel(ylab) ax1.yaxis.get_ticklabels(minor=True)[0].set_verticalalignment('top') ax1.yaxis.get_ticklabels(minor=True)[1].set_verticalalignment('baseline') ax12 = ax1.twinx() ax12.yaxis.tick_right() NUL = ax12.transData.inverted().transform(ax1.transData.transform( (0, 0)))[1] HALF = ax12.transData.inverted().transform( ax1.transData.transform((0, 0.5)))[1] ONE = ax12.transData.inverted().transform(ax1.transData.transform( (1, 1)))[1] ax12.set_yticks([NUL, HALF, ONE]) ax12.set_yticklabels([0, 1, 2]) ax12.set_ylabel(ylab2) handles = [l1, l2, thresh1, thresh2] labels = [ 'Simulation', 'Discretisation', '$\\vartheta_\mathrm{mean}$', '$\\vartheta_\mathrm{half}$' ] for ax in fig.axes: plt.setp(ax.get_yticklabels(which='both'), fontsize=7) plt.setp(ax.get_xticklabels(which='both'), fontsize=7) ax.tick_params(direction='in') ax.yaxis.set_zorder(3) fig.legend(handles, labels, loc=(.4, 0.47), fontsize=6, framealpha=1, prop={'size': 7}, edgecolor='k', ncol=2) fig.tight_layout() plt.savefig('../../graphics/discrnor{}{}.png'.format( kwargs.get('strg', ''), mode), dpi=500) plt.close()
def discr(py, pt, **kwargs): mode = kwargs.get('mode', 'limit') (m6, m7, m12, m1, n1) = prc.evmode(mode) t = [pt, pt, pt, pt] xlim = (-1, 6) label = ['Simulation', 'Discretisation', '$\\vartheta$'] lstyle = ['-', '--', ':'] tick = [0, 0.5, 1] xlab = '$t$ in h' ylab = '$c$ in nM' ylab2 = 'Activity' MAX7 = np.amax(py[7]) TH7 = m7 / MAX7 plt.style.use('seaborn-paper') fig, ax = plt.subplots(1, 1) fig.set_size_inches(3.2, 2.2) px3 = [prc.norm(py[7]), prc.discr(py[7], m7), ps.hline(TH7, pt)] colour3 = [c.darkorange, c.gold, c.deeppink] for i, j in enumerate(px3): ax.plot(t[i] - 101, j, c=colour3[i], linestyle=lstyle[i], label=label[i]) ax.set_title('A20') ax.set_xlim(xlim) ax.set_yticks(tick) ax.set_yticks(TH7, minor=True) ax.set_yticklabels([ 0, np.around(MAX7 * 500, decimals=1), np.around(MAX7 * 1000, decimals=1) ]) ax.set_yticklabels([np.around(MAX7 * TH7[0] * 1000, decimals=1)], minor=True) ax.yaxis.get_ticklabels(minor=True)[0].set_verticalalignment('top') ax.yaxis.get_ticklabels()[1].set_verticalalignment('baseline') ax.set_xlabel(xlab) ax.set_ylabel(ylab) ax.legend(loc=(0.5, 0.1), prop={'size': 6}, framealpha=0, fontsize=3, edgecolor=None) ax2 = ax.twinx() ax2.yaxis.tick_right() NUL = ax2.transData.inverted().transform(ax.transData.transform((0, 0)))[1] ONE = ax2.transData.inverted().transform(ax.transData.transform((1, 1)))[1] ax2.set_yticks([NUL, ONE]) ax2.set_yticklabels([0, 1]) ax2.set_ylabel(ylab2) for ax in fig.axes: plt.setp(ax.get_yticklabels(which='both'), fontsize=7) plt.setp(ax.get_xticklabels(which='both'), fontsize=7) ax.tick_params(direction='in') ax.yaxis.set_zorder(3) fig.tight_layout() plt.savefig('../../graphics/discr{}{}.png'.format(kwargs.get('strg', ''), mode), dpi=500) plt.close()
def discrnorTalk(py, pt, **kwargs): mode = kwargs.get('mode', 'limit') (m6, m7, m12, m1, n1) = prc.evmode(mode) t = [pt, pt, pt, pt] xlim = (-1, 6) lstyle = ['--', '-', (0, (1, 1))] width = [1, 2, 2] tick = [0, 0.5, 1] mtick = [0.25, 0.75] xlab = 'Time' ylab = 'Activity' c1 = c.plum c2 = c.deeppink MAX6 = np.amax(py[6]) TH6 = m6 / MAX6 MAX12 = np.amax(py[12]) TH12 = m12 / MAX12 MAX7 = np.amax(py[7]) TH7 = m7 / MAX7 MAX1 = np.amax(py[1]) TH1_1 = m1 / MAX1 TH1_2 = n1 / MAX1 plt.style.use('seaborn-paper') seaborn.set_context("talk") fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2) px1 = [ps.hline(TH6, pt), prc.discr(py[6], m6), prc.norm(py[6])] colour1 = [c1, c.dodgerblue, 'navy'] for i, j in enumerate(px1): ax3.plot(t[i] - 101, j, c=colour1[i], linestyle=lstyle[i], linewidth=width[i]) ax3.set_title('NF$\kappa$B') ax3.set_xlim(xlim) ax3.set_yticks([]) ax3.set_xticks([]) ax3.set_xlabel(xlab) ax3.set_ylabel(ylab) px2 = [ps.hline(TH12, pt), prc.discr(py[12], m12), prc.norm(py[12])] colour2 = [c1, c.lime, c.green] for i, j in enumerate(px2): ax2.plot(t[i] - 101, j, c=colour2[i], linestyle=lstyle[i], linewidth=width[i]) ax2.set_title('I$\kappa$B') ax2.set_xlim(xlim) ax2.set_yticks([]) ax2.set_xticks([]) ax2.set_xlabel(xlab) ax2.set_ylabel(ylab) px3 = [ps.hline(TH7, pt), prc.discr(py[7], m7), prc.norm(py[7])] colour3 = [c1, c.gold, c.darkorange] if mode == 'custom2': colour3[0] = c2 lstyle[0] = '-.' for i, j in enumerate(px3): ax4.plot(t[i] - 101, j, c=colour3[i], linestyle=lstyle[i], linewidth=width[i]) ax4.set_title('A20') ax4.set_xlim(xlim) ax4.set_yticks([]) ax4.set_xticks([]) ax4.set_xlabel(xlab) ax4.set_ylabel(ylab) if mode == 'custom2': lstyle.insert(1, '-.') else: lstyle.insert(0, '-.') width.insert(0, 1) px4 = [ ps.hline(TH1_1, pt), ps.hline(TH1_2, pt), prc.discr(py[1], m1, n1), prc.norm(py[1]) ] colour4 = [c2, c1, 'r', c.blood] for i, j in enumerate(px4): ax1.plot(t[i] - 101, j, c=colour4[i], linestyle=lstyle[i], linewidth=width[i]) ax1.set_title('IKK') ax1.set_xlim(xlim) ax1.set_yticks([]) ax1.set_xticks([]) ax1.set_xlabel(xlab) ax1.set_ylabel(ylab) fig.tight_layout() plt.savefig('../../graphics/discrnorTalk{}{}.png'.format( kwargs.get('strg', ''), mode), dpi=500) plt.close()