def update_asset(inv): asset = inv.what asset.holder = inv.who asset.inventoried = inv.when asset.current = inv.where asset.status = inv.how methods.save()
def edit_self(): if g.user: fname = request.form.get('fname') lname = request.form.get('lname') phone = request.form.get('phone') email = request.form.get('email') annon = request.form.get('annon') annon = bool(annon) if annon else None g.user.fname = fname if fname else g.user.fname g.user.lname = lname if lname else g.user.lname g.user.phone = phone if phone else g.user.phone g.user.email = email if email else g.user.email g.user.annon = annon if annon else g.user.annon methods.save() return view.success(dict(g.user))
def edit_user(id): if check_auth(auth.UserModifyWorld): user = model.User.query.filter_by(uid=id).first() if user: grp = request.form.get('grp') grp = int(grp) if grp else grp user.grp = grp if grp else user.grp perm = request.form.get('perm') perm = int(perm) if perm else perm user.perm = perm if perm else user.perm methods.save() return view.success(dict(user)) else: return view.dne('user') else: return view.keep_away()
def refresh(self): if self.napsterbot: self.threads = self.napsterbot.get_nbthreads() if not self.napsterbot.stopped: self.napsterbot.check_threads() new_logs = self.napsterbot.check_logs() for log in new_logs: self.Console_Output.insert(tk.END, log) self.Console_Output.see("end") if float(self.Console_Output.index('end')) > 100: self.Console_Output.delete('1.0', '2.0') self.streams = self.save[ 'streams'] + self.napsterbot.get_nbstreams() self.earnings = self.streams * 0.019 nm.save({ 'streams': self.streams, 'earnings': self.earnings }, 'save') self.Lbl_Threads.configure( text='Threads: {}'.format(self.threads)) self.Lbl_Streams.configure( text='Streams: {}'.format(self.streams)) self.Lbl_Earnings.configure( text='Earnings: {:.2f}$'.format(self.earnings))
# scale = np.min(mean) / np.min(simulated) print('Scaling factor: ' + str(scale)) # # Create plot # pl.figure() pl.xlabel('V [mV]') pl.ylabel('Peak I$_{CaL}$ [A/F]') pl.ylim(-10, 1) methods.fill(vsteps_mv, p25, p75, 'red') pl.plot(vsteps_mv, mean, 'o-', label='Experiment (mean, n=' + str(ncells) + ')', color='#B22400') pl.plot(vsteps * 1e3, simulated, label='Simulation') pl.plot(vsteps * 1e3, simulated * scale, label='Fitted simulation') pl.legend(loc='lower center', fontsize=9, ncol=3, handlelength=1.5, handletextpad=0.5) pl.tight_layout() # Store methods.save('figure1b') print('Figure saved to ' + methods.FIGURES)
# Create colormap cmap = matplotlib.cm.get_cmap('viridis') norm = matplotlib.colors.Normalize(min(vsteps), max(vsteps)) # Create plot pl.figure(figsize=(methods.FIGSIZE[0] * 2.1, methods.FIGSIZE[1] * 1.3)) n = len(CURRENTS) n2 = int(np.ceil(n * 0.5)) for i, current in enumerate(CURRENTS): pl.subplot(2, n2, i + 1) if i >= n * 0.5: pl.xlabel('Time [ms]') if i % n2 == 0: pl.ylabel('I [A/F]') pl.title(LABELS[current]) for i, v in enumerate(vsteps): pl.plot(log.time() * 1e3, log[current, i], color=cmap(norm(v)), label=str(v * 1e3) + ' mV') pl.tight_layout() pl.legend(bbox_to_anchor=(1.05, 0), loc='lower left', borderaxespad=0.) #plt.figlegend( lines, labels, loc = 'lower center', ncol=5, labelspacing=0. ) methods.save('figureS2') print('Figures saved to ' + methods.FIGURES) #pl.show()
pl.plot(sim_time, mid, lw=3, label='Fitted models (' + ('median' if MEDIAN else 'mean') + ', n=' + str(n) + ')') #for ap in sim_aps: # pl.plot(sim_time, ap, color='tab:orange', alpha=0.25, lw=2) # Show APD line pl.axhline(PT, ls='--', color='gray', label=str(PT)) # Add legend pl.legend(loc='upper right') # Store methods.save('figure4a' if PT == 0.1 else 'figure104a') # # Figure 4b: Plot histogram of normalised APDs # pl.figure() pl.xlabel('APD$_{' + ('90' if PT == 0.1 else '50') + '}$ [ms]') pl.ylabel('Probability density') if PT == 0.1: pl.xlim(150, 500) elif PT == 0.5: pl.xlim(100, 375) bins = np.arange(0, 600, 25) pl.hist(
# # Plot histogram of peak current # pl.figure() pl.xlabel('Peak outward current [A/F]') pl.ylabel('Probability density') #pl.xlim(125, 575) #pl.ylim(0, 0.011) for peak in sorted(peaks): print(' ' + str(peak)) bins = np.arange(0, 70, 5) pl.hist( peaks, normed=True, bins=bins, label='Peak outward current', color='tab:green', edgecolor='tab:green', alpha=0.5, ) methods.save('figureS6') print('Figure S6 saved to ' + methods.FIGURES) #pl.show()
('median' if MEDIAN else 'mean') + ', n=' + str(min(nmodels)) + '-' + str(max(nmodels)) + ')') # Show points with alternans if False: for star in set(stars): x = star[0] * 0.95 y = mid[detailed.index(star[0])] + 25 pl.plot(x, y, '*', color='tab:orange') # Set y-axis limits if PT == 0.5: ax1.set_ylim(25, 1000) ax2.set_ylim(25, 1000) else: ax1.set_ylim(100, 1100) ax2.set_ylim(100, 1100) # Fix legend for quinidine figure if drug == 'quinidine': pl.legend(bbox_to_anchor=(0.58, 0.99)) else: pl.legend(loc=legends[idrug]) # Store figure methods.save(figures[idrug]) print('Figures saved to ' + methods.FIGURES + ' (plus apds)') #pl.show()
#pl.ylim(-85, 40) for i, long_id in enumerate(outward.ORDER): short_id = table['short_id'][i] axes[4].plot(aps.time()*1e3, aps['inaca.INaCa', i], color=cmap(norm(order[i])), label=short_id) #pl.tight_layout() axes[5].set_ylabel('I$_{Kr}$ [A/F]') #pl.ylim(-85, 40) for i, long_id in enumerate(outward.ORDER): short_id = table['short_id'][i] axes[5].plot(aps.time()*1e3, aps['ikr.IKr', i], color=cmap(norm(order[i])), label=short_id) fig.subplots_adjust(hspace=0) #plt.setp([a.get_xticklabels() for a in fig.axes[:-1]], visible=False) #pl.savefig('iall.png',bbox_inches='tight') for a in axes: pl.setp(a.get_yticklabels()[0], visible=False) pl.setp(a.get_yticklabels()[-1], visible=False) pl.setp(axes[5].get_yticklabels()[-2], visible=False) methods.save('figureS7') print('Figure S7 saved to ' + methods.FIGURES) #pl.show()
for i, v in enumerate(outward.VSTEPS_mV): total_i = np.zeros(time.shape) for current in outward.CURRENTS: total_i += data[current, i] total.append(total_i) # # Plot # cmap = matplotlib.cm.get_cmap('viridis') norm = matplotlib.colors.Normalize(0, len(total)) pl.figure() pl.xlabel('Time [ms]') pl.ylabel('Outward current [A/F]') pl.ylim(-6, 2) for i, current in enumerate(total): vm = outward.VSTEPS_mV[i] pl.plot(time, current, color=cmap(norm(i)), label=str(vm) + ' mV') pl.legend(loc='lower right', ncol=5, columnspacing=1.2, fontsize=9, handlelength=1.5, handletextpad=0.5) methods.save('figureS4') print('Figure S4 saved to ' + methods.FIGURES) #pl.show()
def stop_command(self): nm.save({'streams': self.streams, 'earnings': self.earnings}, 'save') self.napsterbot.stop() self.bot_thread.join() self.Lbl_Status.configure(text='OFF')
def __init__(self): try: self.save = nm.load('save') except: self.save = {'streams': 0, 'earnings': 0} nm.save(self.save, 'save') self.napsterbot = '' self.accounts_path = '' self.proxies_path = '' self.tracks_path = '' self.threads = 0 self.streams = 0 self.earnings = 0 self.top = tk.Tk() w = 700 h = 500 ws = self.top.winfo_screenwidth() hs = self.top.winfo_screenheight() x = (ws / 2) - (w / 2) y = (hs / 2) - (h / 2) self.top.geometry('%dx%d+%d+%d' % (w, h, x, y)) self.top.resizable(True, False) self.top.minsize(w, h) self.top.maxsize(w + 200, h) self.top.title('Omega Napster') self.top.configure(background="#2d2d2d") self.top.attributes("-topmost", True) # Frame Principale self.Frm_Main = tk.Frame(self.top) self.Frm_Main.place(relx=0.0, rely=-0.02, relheight=0.99, relwidth=0.994) self.Frm_Main.configure(relief="groove") self.Frm_Main.configure(background="#2d2d2d") # Frame Haut-Gauche self.Frm_UpLeft = tk.Frame(self.Frm_Main) self.Frm_UpLeft.place(relx=0.029, rely=0.04, relheight=0.303, relwidth=0.481) self.Frm_UpLeft.configure(relief='ridge') self.Frm_UpLeft.configure(borderwidth="3") self.Frm_UpLeft.configure(relief="ridge") self.Frm_UpLeft.configure(background="#1b1b1b") self.Frm_UpLeft.configure(highlightbackground="#000000") self.Frm_UpLeft.configure(highlightcolor="#000000") self.Lbl_Accounts = tk.Label(self.Frm_UpLeft) self.Lbl_Accounts.place(relx=0.06, rely=0.133, height=29, width=90) self.Lbl_Accounts.configure(activebackground="#ffffff") self.Lbl_Accounts.configure(activeforeground="black") self.Lbl_Accounts.configure(anchor='n') self.Lbl_Accounts.configure(background="#3f3f3f") self.Lbl_Accounts.configure(disabledforeground="#a3a3a3") self.Lbl_Accounts.configure( font="-family {Calibri} -size 12 -weight bold") self.Lbl_Accounts.configure(foreground="#ffffff") self.Lbl_Accounts.configure(highlightbackground="#d9d9d9") self.Lbl_Accounts.configure(highlightcolor="black") self.Lbl_Accounts.configure(relief="ridge") self.Lbl_Accounts.configure(text='''Accounts:''') self.Lbl_Accounts_File = tk.Label(self.Frm_UpLeft) self.Lbl_Accounts_File.place(relx=0.328, rely=0.147, height=25, width=120) self.Lbl_Accounts_File.configure(activebackground="#f9f9f9") self.Lbl_Accounts_File.configure(activeforeground="black") self.Lbl_Accounts_File.configure(background="#e6e6e6") self.Lbl_Accounts_File.configure(borderwidth="0") self.Lbl_Accounts_File.configure(disabledforeground="#a3a3a3") self.Lbl_Accounts_File.configure(font="-family {Calibri} -size 10") self.Lbl_Accounts_File.configure(foreground="#000000") self.Lbl_Accounts_File.configure(highlightbackground="#d9d9d9") self.Lbl_Accounts_File.configure(highlightcolor="black") self.Lbl_Accounts_File.configure(relief="ridge") self.Lbl_Accounts_File.configure(text='None') self.Btn_Accounts = tk.Button(self.Frm_UpLeft) self.Btn_Accounts.place(relx=0.716, rely=0.14, height=25, width=70) self.Btn_Accounts.configure(activebackground="#ececec") self.Btn_Accounts.configure(activeforeground="#000000") self.Btn_Accounts.configure(anchor='n') self.Btn_Accounts.configure(background="#3f3f3f") self.Btn_Accounts.configure(disabledforeground="#a3a3a3") self.Btn_Accounts.configure( font="-family {Calibri} -size 10 -weight bold -underline 1") self.Btn_Accounts.configure(foreground="#ffffff") self.Btn_Accounts.configure(highlightbackground="#d9d9d9") self.Btn_Accounts.configure(highlightcolor="black") self.Btn_Accounts.configure(pady="0") self.Btn_Accounts.configure(relief="groove") self.Btn_Accounts.configure(text='''Browse''') self.Btn_Accounts.configure( command=partial(self.browseFiles, 'accounts')) self.Lbl_Proxies = tk.Label(self.Frm_UpLeft) self.Lbl_Proxies.place(relx=0.06, rely=0.4, height=29, width=90) self.Lbl_Proxies.configure(activebackground="#ffffff") self.Lbl_Proxies.configure(activeforeground="black") self.Lbl_Proxies.configure(anchor='n') self.Lbl_Proxies.configure(background="#3f3f3f") self.Lbl_Proxies.configure(disabledforeground="#a3a3a3") self.Lbl_Proxies.configure( font="-family {Calibri} -size 12 -weight bold") self.Lbl_Proxies.configure(foreground="#ffffff") self.Lbl_Proxies.configure(highlightbackground="#d9d9d9") self.Lbl_Proxies.configure(highlightcolor="black") self.Lbl_Proxies.configure(relief="ridge") self.Lbl_Proxies.configure(text='''Proxies:''') self.Lbl_Proxies_File = tk.Label(self.Frm_UpLeft) self.Lbl_Proxies_File.place(relx=0.328, rely=0.407, height=25, width=120) self.Lbl_Proxies_File.configure(activebackground="#f9f9f9") self.Lbl_Proxies_File.configure(activeforeground="black") self.Lbl_Proxies_File.configure(background="#e6e6e6") self.Lbl_Proxies_File.configure(borderwidth="0") self.Lbl_Proxies_File.configure(disabledforeground="#a3a3a3") self.Lbl_Proxies_File.configure(font="-family {Calibri} -size 10") self.Lbl_Proxies_File.configure(foreground="#000000") self.Lbl_Proxies_File.configure(highlightbackground="#d9d9d9") self.Lbl_Proxies_File.configure(highlightcolor="black") self.Lbl_Proxies_File.configure(relief="ridge") self.Lbl_Proxies_File.configure(text='None') self.Btn_Proxies = tk.Button(self.Frm_UpLeft) self.Btn_Proxies.place(relx=0.716, rely=0.4, height=25, width=70) self.Btn_Proxies.configure(activebackground="#ececec") self.Btn_Proxies.configure(activeforeground="#000000") self.Btn_Proxies.configure(anchor='n') self.Btn_Proxies.configure(background="#3f3f3f") self.Btn_Proxies.configure(disabledforeground="#a3a3a3") self.Btn_Proxies.configure( font="-family {Calibri} -size 10 -weight bold -underline 1") self.Btn_Proxies.configure(foreground="#ffffff") self.Btn_Proxies.configure(highlightbackground="#d9d9d9") self.Btn_Proxies.configure(highlightcolor="black") self.Btn_Proxies.configure(pady="0") self.Btn_Proxies.configure(relief="groove") self.Btn_Proxies.configure(text='''Browse''') self.Btn_Proxies.configure( command=partial(self.browseFiles, 'proxies')) self.Lbl_Tracks = tk.Label(self.Frm_UpLeft) self.Lbl_Tracks.place(relx=0.06, rely=0.667, height=29, width=90) self.Lbl_Tracks.configure(activebackground="#ffffff") self.Lbl_Tracks.configure(activeforeground="black") self.Lbl_Tracks.configure(anchor='n') self.Lbl_Tracks.configure(background="#3f3f3f") self.Lbl_Tracks.configure(disabledforeground="#a3a3a3") self.Lbl_Tracks.configure( font="-family {Calibri} -size 12 -weight bold") self.Lbl_Tracks.configure(foreground="#ffffff") self.Lbl_Tracks.configure(highlightbackground="#d9d9d9") self.Lbl_Tracks.configure(highlightcolor="black") self.Lbl_Tracks.configure(relief="ridge") self.Lbl_Tracks.configure(text='''Tracks:''') self.Lbl_Tracks_File = tk.Label(self.Frm_UpLeft) self.Lbl_Tracks_File.place(relx=0.328, rely=0.673, height=25, width=120) self.Lbl_Tracks_File.configure(activebackground="#f9f9f9") self.Lbl_Tracks_File.configure(activeforeground="black") self.Lbl_Tracks_File.configure(background="#e6e6e6") self.Lbl_Tracks_File.configure(borderwidth="0") self.Lbl_Tracks_File.configure(disabledforeground="#a3a3a3") self.Lbl_Tracks_File.configure(font="-family {Calibri} -size 10") self.Lbl_Tracks_File.configure(foreground="#000000") self.Lbl_Tracks_File.configure(highlightbackground="#d9d9d9") self.Lbl_Tracks_File.configure(highlightcolor="black") self.Lbl_Tracks_File.configure(relief="ridge") self.Lbl_Tracks_File.configure(text='None') self.Btn_Tracks = tk.Button(self.Frm_UpLeft) self.Btn_Tracks.place(relx=0.716, rely=0.667, height=25, width=70) self.Btn_Tracks.configure(activebackground="#ececec") self.Btn_Tracks.configure(activeforeground="#000000") self.Btn_Tracks.configure(anchor='n') self.Btn_Tracks.configure(background="#3f3f3f") self.Btn_Tracks.configure(disabledforeground="#a3a3a3") self.Btn_Tracks.configure( font="-family {Calibri} -size 10 -weight bold -underline 1") self.Btn_Tracks.configure(foreground="#ffffff") self.Btn_Tracks.configure(highlightbackground="#d9d9d9") self.Btn_Tracks.configure(highlightcolor="black") self.Btn_Tracks.configure(pady="0") self.Btn_Tracks.configure(relief="groove") self.Btn_Tracks.configure(text='''Browse''') self.Btn_Tracks.configure(command=partial(self.browseFiles, 'tracks')) self.Frm_DownRight = tk.Frame(self.Frm_Main) self.Frm_DownRight.place(relx=0.33, rely=0.364, relheight=0.636, relwidth=0.654) self.Frm_DownRight.configure(relief='ridge') self.Frm_DownRight.configure(borderwidth="2") self.Frm_DownRight.configure(relief="ridge") self.Frm_DownRight.configure(background="#1b1b1b") self.Console_Output = scroll.ScrolledText(self.Frm_DownRight) self.Console_Output.place(relx=0.022, rely=0.032, relheight=0.933, relwidth=0.954) self.Console_Output.configure(background="#5f5f5f") self.Console_Output.configure(borderwidth="2") self.Console_Output.configure(font="-family {Calibri} -size 11") self.Console_Output.configure(foreground="black") self.Console_Output.configure(highlightbackground="#d9d9d9") self.Console_Output.configure(highlightcolor="black") self.Console_Output.configure(insertbackground="black") self.Console_Output.configure(padx="8") self.Console_Output.configure(relief="ridge") self.Console_Output.configure(selectbackground="black") self.Console_Output.configure(selectforeground="white") self.Console_Output.configure(wrap="none") self.Frm_DownLeft = tk.Frame(self.Frm_Main) self.Frm_DownLeft.place(relx=0.029, rely=0.364, relheight=0.636, relwidth=0.28) self.Frm_DownLeft.configure(relief='ridge') self.Frm_DownLeft.configure(borderwidth="2") self.Frm_DownLeft.configure(relief="ridge") self.Frm_DownLeft.configure(background="#1b1b1b") self.Frm_DownLeft.configure(highlightbackground="#d9d9d9") self.Frm_DownLeft.configure(highlightcolor="black") self.Lbl_Threads = tk.Label(self.Frm_DownLeft) self.Lbl_Threads.place(relx=0.103, rely=0.063, height=29, width=150) self.Lbl_Threads.configure(activebackground="#ffffff") self.Lbl_Threads.configure(activeforeground="black") self.Lbl_Threads.configure(anchor='nw') self.Lbl_Threads.configure(background="#3f3f3f") self.Lbl_Threads.configure(disabledforeground="#a3a3a3") self.Lbl_Threads.configure( font="-family {Calibri} -size 12 -weight bold") self.Lbl_Threads.configure(foreground="#ffffff") self.Lbl_Threads.configure(highlightbackground="#d9d9d9") self.Lbl_Threads.configure(highlightcolor="black") self.Lbl_Threads.configure(padx="5") self.Lbl_Threads.configure(relief="ridge") self.Lbl_Threads.configure(text='Threads: {}'.format(self.threads)) self.Lbl_Streams = tk.Label(self.Frm_DownLeft) self.Lbl_Streams.place(relx=0.103, rely=0.19, height=29, width=150) self.Lbl_Streams.configure(activebackground="#ffffff") self.Lbl_Streams.configure(activeforeground="black") self.Lbl_Streams.configure(anchor='nw') self.Lbl_Streams.configure(background="#3f3f3f") self.Lbl_Streams.configure(disabledforeground="#a3a3a3") self.Lbl_Streams.configure( font="-family {Calibri} -size 12 -weight bold") self.Lbl_Streams.configure(foreground="#ffffff") self.Lbl_Streams.configure(highlightbackground="#d9d9d9") self.Lbl_Streams.configure(highlightcolor="black") self.Lbl_Streams.configure(padx="5") self.Lbl_Streams.configure(relief="ridge") self.Lbl_Streams.configure( text='Streams: {}'.format(self.save['streams'])) self.Lbl_Earnings = tk.Label(self.Frm_DownLeft) self.Lbl_Earnings.place(relx=0.103, rely=0.317, height=29, width=150) self.Lbl_Earnings.configure(activebackground="#ffffff") self.Lbl_Earnings.configure(activeforeground="black") self.Lbl_Earnings.configure(anchor='nw') self.Lbl_Earnings.configure(background="#3f3f3f") self.Lbl_Earnings.configure(disabledforeground="#a3a3a3") self.Lbl_Earnings.configure( font="-family {Calibri} -size 12 -weight bold") self.Lbl_Earnings.configure(foreground="#ffffff") self.Lbl_Earnings.configure(highlightbackground="#d9d9d9") self.Lbl_Earnings.configure(highlightcolor="black") self.Lbl_Earnings.configure(padx="5") self.Lbl_Earnings.configure(relief="ridge") self.Lbl_Earnings.configure( text='Earnings: {:.2f}$'.format(self.save['earnings'])) self.Frm_UpRight = tk.Frame(self.Frm_Main) self.Frm_UpRight.place(relx=0.532, rely=0.04, relheight=0.303, relwidth=0.451) self.Frm_UpRight.configure(relief='ridge') self.Frm_UpRight.configure(borderwidth="3") self.Frm_UpRight.configure(relief="ridge") self.Frm_UpRight.configure(background="#1b1b1b") self.Frm_UpRight.configure(highlightbackground="#d9d9d9") self.Frm_UpRight.configure(highlightcolor="black") self.Btn_Start = tk.Button(self.Frm_UpRight) self.Btn_Start.place(relx=0.096, rely=0.2, height=44, width=107) self.Btn_Start.configure(activebackground="#ececec") self.Btn_Start.configure(activeforeground="#000000") self.Btn_Start.configure(background="#114a0b") self.Btn_Start.configure(disabledforeground="#a3a3a3") self.Btn_Start.configure( font="-family {Calibri} -size 18 -weight bold") self.Btn_Start.configure(foreground="#000000") self.Btn_Start.configure(highlightbackground="#d9d9d9") self.Btn_Start.configure(highlightcolor="black") self.Btn_Start.configure(pady="0") self.Btn_Start.configure(relief="groove") self.Btn_Start.configure(text='''START''') self.Btn_Start.configure(command=self.start_command) self.Btn_Stop = tk.Button(self.Frm_UpRight) self.Btn_Stop.place(relx=0.548, rely=0.2, height=44, width=107) self.Btn_Stop.configure(activebackground="#ececec") self.Btn_Stop.configure(activeforeground="#000000") self.Btn_Stop.configure(background="#6c0003") self.Btn_Stop.configure(disabledforeground="#a3a3a3") self.Btn_Stop.configure(font="-family {Calibri} -size 18 -weight bold") self.Btn_Stop.configure(foreground="#000000") self.Btn_Stop.configure(highlightbackground="#d9d9d9") self.Btn_Stop.configure(highlightcolor="black") self.Btn_Stop.configure(pady="0") self.Btn_Stop.configure(relief="groove") self.Btn_Stop.configure(text='''STOP''') self.Btn_Stop.configure(command=self.stop_command) self.Lbl_Status = tk.Label(self.Frm_UpRight) self.Lbl_Status.place(relx=0.318, rely=0.6, height=30, width=114) self.Lbl_Status.configure(background="#444444") self.Lbl_Status.configure(disabledforeground="#a3a3a3") self.Lbl_Status.configure(font="-family {Calibri} -size 13") self.Lbl_Status.configure(foreground="#ffffff") self.Lbl_Status.configure(text='OFF')
#!/usr/bin/env python # # Python code to generate Figure S5: Outward current fit to three cells. # from __future__ import print_function import sys import methods import methods.outward as outward import matplotlib.pyplot as pl # # Fit all outward current experiments (or used cached result) # force = '--force' in sys.argv table, cells = outward.fit_all(force) # # Plot # for i, long_id in enumerate(outward.ORDER): print('Plotting fit for cell ' + long_id) result = outward.select(table, cells, i) outward.plot_experiment(*result) methods.save('all-outward-fits/' + long_id + '_exp') outward.plot_simulation(*result) methods.save('all-outward-fits/' + long_id + '_sim') pl.close('all') print('Figures saved to ' + methods.FIGURES + ' all-outward-fits')
print('Scaling factor: ' + str(scale)) # # Create plot # pl.figure() pl.xlabel('V [mV]') pl.ylabel('Peak I$_{Na}$ [A/F]') pl.ylim(-235, 9) methods.fill(vsteps_mv, p25, p75, 'red') pl.plot(vsteps_mv, mean, 'o-', label='Experiment (mean, n=' + str(ncells) + ')', color='#B22400') pl.plot(vsteps * 1e3, simulated, label='Simulation') pl.plot(vsteps * 1e3, simulated * scale, label='Fitted simulation') pl.legend(loc='lower center', fontsize=9, ncol=3, columnspacing=1.3, handlelength=1.5, handletextpad=0.5) pl.tight_layout() # Store methods.save('figure1a') #pl.show() print('Figure saved to ' + methods.FIGURES)
pl.xlabel('Time [ms]') pl.ylabel('V (normalised)') #pl.xlim(-50, 550) pl.xlim(-50,20000) pl.grid(True) # Plot tailored model APs n = len(sim_aps) for ap in sim_aps: try: whereap = sim_time[ap>-0.04][0] except: whereap = 0 try: tempidx = np.arange(len(ap))[ap>-0.04] whereend = [tempidx[i+1] for i in range(len(tempidx)-1) if tempidx[i+1]-tempidx[i]>1000][1] - 1000 except: whereend = -1000 pl.plot((sim_time-whereap)[:whereend], ap[:whereend], alpha=0.5, lw=2) #pl.legend(loc='upper right') #pl.show() methods.save('unpaced')
for (i, drug) in enumerate(allDrugs): try: sheet = xlsx.parse(drug) idx = np.array(sheet)[:, 0] control = np.array(sheet)[:, 1] applied = np.array(sheet)[:, 2] except: sheet = ods.sheets[drug] idx = np.array([int(i[0].value) for i in sheet.rows()]) control = np.array([i[1].value for i in sheet.rows()]) applied = np.array([i[2].value for i in sheet.rows()]) plt.figure() for (j, conc_id) in enumerate(CONC_ID): conc_idx = np.arange(np.max(idx))[((idx >= conc_id[0]) & (idx <= conc_id[1]))] plt.xlabel(r"concentration") plt.title(drug) if plotchange: plt.plot([j + 1] * len(conc_idx), applied[conc_idx] - control[conc_idx], 'ro') plt.ylabel(r"$\Delta$ cycle length [ms]") plt.xlim([0.1, 4.9]) methods.save('cyclelength_Diff_%s' % drug) else: plt.plot([j + 1] * len(conc_idx), applied[conc_idx], 'kx') plt.plot([0] * len(conc_idx), control[conc_idx], 'kx') plt.ylabel(r"cycle length [ms]") plt.xlim([-0.9, 4.9]) methods.save('cyclelength_%s' % drug) #plt.show()
# # Order cells by APD at -20mV # tmin = 100 vapd = -20 i = np.where(cells[0][0] > tmin)[0][0] cells.sort(key = lambda cell: np.where(cell[1][i:] < vapd)[0][:1]) # # Create colormap # cmap = matplotlib.cm.get_cmap('inferno') norm = matplotlib.colors.Normalize(0, len(cells)) # # Plot # pl.figure() pl.ylim(-85, 40) for k, (ts, vs) in enumerate(cells): pl.plot(ts, vs, color=cmap(norm(k)), lw=0.5) pl.xlabel('Time [ms]') pl.ylabel('V [mV]') pl.tight_layout() methods.save('figure3b') print('Figure saved to ' + methods.FIGURES) #pl.show()
order = [np.where(v < vapd)[0][:1] for v in order] order = [v[0] if v else 2000 for v in order] order = np.argsort(np.argsort(order)) # # Create colormap # cmap = matplotlib.cm.get_cmap('viridis') norm = matplotlib.colors.Normalize(0, len(cells)) # # Plot and save # pl.figure() pl.xlabel('Time [ms]') pl.ylabel('V [mV]') pl.ylim(-85, 40) for i, long_id in enumerate(outward.ORDER): short_id = table['short_id'][i] pl.plot(aps.time() * 1e3, aps['membrane.V', i] * 1e3, color=cmap(norm(order[i])), label=short_id) pl.tight_layout() methods.save('figure3a') print('Figure saved to ' + methods.FIGURES) #pl.show()
# from __future__ import print_function import sys import methods import methods.outward as outward # # Fit all outward current experiments (or used cached result) # force = '--force' in sys.argv table, cells = outward.fit_all(force) # # Find cell by name # cell = outward.find('b3') # # Fit to data # # # Plot # result = outward.select(table, cells, cell) outward.plot_experiment(*result) methods.save('figure2a') outward.plot_simulation(*result) methods.save('figure2b') print('Figures 2a and 2b saved to ' + methods.FIGURES)