def run(self, results): par = self.getValueOfParameter("parameter") i = int(self.getValueOfParameter("iteration number")) title = self.getValueOfParameter("title") if(par==""): return False if(i >= results.__len__()): return False dialogform = Dialog(QApplication.activeWindow()) fig = Figure((5.0, 4.0), dpi=100) ax = SubplotZero(fig, 1, 1, 1) fig.add_subplot(ax) for n in ["top", "right"]: ax.axis[n].set_visible(False) for n in ["bottom", "left"]: ax.axis[n].set_visible(True) x = results[i].getResults(par) if(not(x.__len__())): return False ax.boxplot(x, notch=0, sym='+', vert=1, whis=1.5) ax.set_title(title) dialogform.showFigure(fig) return True
def run(self, results): par = self.getValueOfParameter("parameter") i = int(self.getValueOfParameter("iteration number")) title = self.getValueOfParameter("title") if(par==""): return False if(i >= results.__len__()): return False dialogform = Dialog(QApplication.activeWindow()) fig = Figure((5.0, 4.0), dpi=100) ax = SubplotZero(fig, 1, 1, 1) fig.add_subplot(ax) for n in ["top", "right"]: ax.axis[n].set_visible(False) for n in ["bottom", "left"]: ax.axis[n].set_visible(True) x = results[i].getResults(par) if(not(x.__len__())): return False ax.hist(x, 100, normed=1) ax.set_xlabel('Error') ax.set_ylabel('Probability') ax.grid(True) ax.set_title(title) dialogform.showFigure(fig) return True
def run(self, results): par1 = self.getValueOfParameter("parameter 1") par2 = self.getValueOfParameter("parameter 2") i = int(self.getValueOfParameter("iteration number")) title = self.getValueOfParameter("title") if(par1==""): return False if(par2==""): return False if(i >= results.__len__()): return False dialogform = Dialog(QApplication.activeWindow()) fig = Figure((5.0, 4.0), dpi=100) ax = SubplotZero(fig, 1, 1, 1) fig.add_subplot(ax) for n in ["top", "right"]: ax.axis[n].set_visible(False) for n in ["bottom", "left"]: ax.axis[n].set_visible(True) y1 = results[i].getResults(par1) y2 = results[i].getResults(par2) if(not(y1.__len__())): return False if(not(y2.__len__())): return False ax.plot(range(0,y1.__len__()),y1,color='r') ax.plot(range(0,y2.__len__()),y2,color='b') ax.set_title(title) leg = ax.legend((par1, par2), 'upper center', shadow=True) frame = leg.get_frame() frame.set_facecolor('0.80') # set the frame face color to light gray # matplotlib.text.Text instances for t in leg.get_texts(): t.set_fontsize('small') # the legend text fontsize # matplotlib.lines.Line2D instances for l in leg.get_lines(): l.set_linewidth(1.5) # the legend line width dialogform.showFigure(fig) return True
def run(self, results): par1 = self.getValueOfParameter("parameter 1") par2 = self.getValueOfParameter("parameter 2") i = int(self.getValueOfParameter("iteration number")) title = self.getValueOfParameter("title") if(par1==""): return False if(par2==""): return False if(i >= results.__len__()): return False dialogform = Dialog(QApplication.activeWindow()) fig = Figure((5.0, 4.0), dpi=100) ax = SubplotZero(fig, 1, 1, 1) fig.add_subplot(ax) for n in ["top", "right"]: ax.axis[n].set_visible(False) for n in ["bottom", "left"]: ax.axis[n].set_visible(True) x = results[i].getResults(par1) y = results[i].getResults(par2) if(not(x.__len__())): return False if(not(y.__len__())): return False ax.plot(x,y,'.') #plot middle xm = range(math.floor(min(ax.axis())),math.floor(max(ax.axis())+1),1) ax.plot(xm,xm) ax.set_xlabel(par1) ax.set_ylabel(par2) ax.set_title(title) dialogform.showFigure(fig) return True
def run(self, results): par1 = self.getValueOfParameter("parameter 1") par2 = self.getValueOfParameter("parameter 2") title = self.getValueOfParameter("title") if(par1==""): return False if(par2==""): return False x = pycalimero.doublevector(); y = pycalimero.doublevector(); for i in results: x.append(i.getResults(par1)[0]) y.append(i.getResults(par2)[0]) dialogform = Dialog(QApplication.activeWindow()) fig = Figure((5.0, 4.0), dpi=100) ax = SubplotZero(fig, 1, 1, 1) fig.add_subplot(ax) for n in ["top", "right"]: ax.axis[n].set_visible(False) for n in ["bottom", "left"]: ax.axis[n].set_visible(True) if(not(x.__len__())): return False if(not(y.__len__())): return False ax.plot (x, y, '.') ax.set_title(title) dialogform.showFigure(fig) return True
def main(path, name): from numpy import linspace, loadtxt d = SimulatedData(path) psth = d.spike_time.psth() from mpl_toolkits.axes_grid.axislines import SubplotZero import matplotlib.pyplot as plt f1 = plt.figure(figsize=[6,8]) ax = SubplotZero(f1, 411) f1.add_subplot(ax) psth.plot_raster(ax) ax = SubplotZero(f1, 412) f1.add_subplot(ax) psth.plot_rate(ax, smoothed=True) ax = SubplotZero(f1, 413) f1.add_subplot(ax) dat = loadtxt(d.path['ML response']) t = linspace(0, 5000, dat.size) ax.plot(t, dat, 'k') for direction in ["left", "right", "top", "bottom"]: ax.axis[direction].set_visible(False) logging.info(str(dir(ax.axis["bottom"]))) # ax.axis["bottom"].major_ticklabels=[] ax.set_title("ML") ax = SubplotZero(f1, 414) f1.add_subplot(ax) dat = loadtxt(d.path['HHLS response']) t = linspace(0, 5000, dat.size) ax.plot(t, dat, 'k') for direction in ["left", "right", "top"]: ax.axis[direction].set_visible(False) ax.axis["bottom"].set_label("Time (ms)") ax.set_title("HHLS") f1.subplots_adjust(hspace=0.47, top=0.95, bottom=0.05) f2 = plt.figure(figsize=[4,4]) ax = SubplotZero(f2, 111) f2.add_subplot(ax) mf = psth.hist_mean_rate(ax, bins=linspace(0,8,20)) ax.set_title({"highvar": "High variance", "lowvar": "Low variance"}[name]) print "Mean firing rate =", mf.mean(), "Hz", "(", mf.std(),")" plt.show()
ax1 = fig.add_subplot(gs[:6, 1], aspect='equal') # dipole moment ill. ax1.axis('off') ax1.set_title('extracellular potential') ax2 = fig.add_subplot(gs[:6, 2], aspect='equal') # dipole moment ill. ax2.axis('off') ax2.set_title('magnetic field') # ax3 = fig.add_subplot(gs[0, 3], aspect='equal') # spherical shell model ill. # ax3.set_title('4-sphere volume conductor') # ax4 = fig.add_subplot(gs[1, 3], # aspect='equal' # ) # MEG/EEG forward model ill. # ax4.set_title('EEG and MEG signal detection') ax3 = SubplotZero(fig, gs[7:, 0]) fig.add_subplot(ax3) ax3.set_title('4-sphere volume conductor', verticalalignment='bottom') ax4 = fig.add_subplot(gs[7:, 1]) # EEG ax4.set_title('scalp electric potential $\phi_\mathbf{p}(\mathbf{r})$') ax5 = fig.add_subplot(gs[7:, 2], sharey=ax4) # MEG # ax5.set_title('scalp magnetic field') #morphology - line sources for panels A and B zips = [] xz = cell.get_idx_polygons() for x, z in xz: zips.append(zip(x, z)) for ax in [ax0]: polycol = PolyCollection(zips, linewidths=(0.5), edgecolors='k', facecolors='none',
fontsize=16, fontweight='demibold', transform=ax.transAxes) plotting.remove_axis_junk(ax) t = np.arange(p_net.shape[1])*PSET.dt*PSET.decimate_q inds = (t >= T[0]) & (t <= T[1]) ax.plot(t[inds], p_net[i, inds], 'k', lw=1) ax.set_ylabel(ylabel) ax.set_xticklabels([]) # panel F. Illustration of 4-sphere volume conductor model geometry ax = SubplotZero(fig, gs[2, 1]) fig.add_subplot(ax) ax.set_title('four-sphere volume conductor model') for direction in ["xzero"]: ax.axis[direction].set_visible(True) for direction in ["left", "right", "bottom", "top"]: ax.axis[direction].set_visible(False) theta = np.linspace(0, np.pi, 31) # draw some circles: for i, r, label in zip(range(4), PSET.foursphereParams['radii'], ['brain', 'CSF', 'skull', 'scalp']): ax.plot(np.cos(theta)*r, np.sin(theta)*r, 'C{}'.format(i), label=label + r', $r_%i=%i$ mm' % (i+1, r / 1000), clip_on=False) # draw measurement points
ax1 = fig.add_subplot(gs[:6, 1], aspect='equal') # dipole moment ill. ax1.axis('off') ax1.set_title('extracellular potential') ax2 = fig.add_subplot(gs[:6, 2], aspect='equal') # dipole moment ill. ax2.axis('off') ax2.set_title('magnetic field') # ax3 = fig.add_subplot(gs[0, 3], aspect='equal') # spherical shell model ill. # ax3.set_title('4-sphere volume conductor') # ax4 = fig.add_subplot(gs[1, 3], # aspect='equal' # ) # MEG/EEG forward model ill. # ax4.set_title('EEG and MEG signal detection') ax3 = SubplotZero(fig, gs[7:, 0]) fig.add_subplot(ax3) ax3.set_title('4-sphere volume conductor', verticalalignment='bottom') ax4 = fig.add_subplot(gs[7:, 1]) # EEG ax4.set_title('scalp electric potential $\phi_\mathbf{p}(\mathbf{r})$') ax5 = fig.add_subplot(gs[7:, 2], sharey=ax4) # MEG # ax5.set_title('scalp magnetic field') #morphology - line sources for panels A and B zips = [] xz = cell.get_idx_polygons() for x, z in xz: zips.append(zip(x, z)) for ax in [ax0]: polycol = PolyCollection(zips, linewidths=(0.5), edgecolors='k', facecolors='none',
verticalalignment='center', fontsize=16, fontweight='demibold', transform=ax.transAxes) plotting.remove_axis_junk(ax) t = np.arange(p_net.shape[1]) * PSET.dt * PSET.decimate_q inds = (t >= T[0]) & (t <= T[1]) ax.plot(t[inds], p_net[i, inds], 'k', lw=1) ax.set_ylabel(ylabel) ax.set_xticklabels([]) # panel F. Illustration of 4-sphere volume conductor model geometry ax = SubplotZero(fig, gs[2, 1]) fig.add_subplot(ax) ax.set_title('four-sphere volume conductor model') for direction in ["xzero"]: ax.axis[direction].set_visible(True) for direction in ["left", "right", "bottom", "top"]: ax.axis[direction].set_visible(False) theta = np.linspace(0, np.pi, 31) # draw some circles: for i, r, label in zip(range(4), PSET.foursphereParams['radii'], ['brain', 'CSF', 'skull', 'scalp']): ax.plot(np.cos(theta) * r, np.sin(theta) * r, 'C{}'.format(i),