def html_view(self): """ see :mod:`ni.tools.html_view` """ view = View() model_prefix = self.name + "/" for key in self.configuration.__dict__: view.add(model_prefix + "#3/tabs/Configuration/table/"+key,self.configuration.__dict__[key]) return view
def html_view(self): view = View() data_prefix = "" for c in range(self.nr_conditions): cond_data = self.condition(c) with view.figure(data_prefix + "/tabs/Condition " + str(c) + "/Firing Rate/Plot/#4/Mean/tabs/Axis 0"): pl.plot(np.mean(np.array(cond_data.firing_rate()).transpose(),axis=0)) with view.figure(data_prefix + "/tabs/Condition " + str(c) + "/Firing Rate/Plot/#4/Mean/tabs/Axis 1"): pl.plot(np.mean(np.array(cond_data.firing_rate()).transpose(),axis=1)) with view.figure(data_prefix + "/tabs/Condition " + str(c) + "/Firing Rate/Plot/#4/Mean/tabs/Axis 1 (smoothed)"): pl.plot(gaussian_filter(np.mean(np.array(cond_data.firing_rate()).transpose(),axis=1),20)) for cell in range(cond_data.nr_cells): cell_data = cond_data.cell(cell) with view.figure(data_prefix + "/tabs/Condition " + str(c) + "/Spikes/tabs/Cell " + str(cell) + "/Plot"): pl.imshow(1-cell_data.data,interpolation='nearest',aspect=20,cmap='gray') return view
def html_view(self): """ Generates an html_view of this object. Example:: stats.html_view().render('stats_file.html') """ view = View() stat_prefix = "" for k in self.keys(): view.add( stat_prefix + "#2/tabs/Models/" + k.replace("/", "/tabs/"), k) node = self.getNode(k) for prop in node: if type(node[prop]) == np.float64: view.add( stat_prefix + "#2/tabs/Models/" + k.replace("/", "/tabs/") + "/#1/" + prop, prop + " = " + str(node[prop])) if type(node[prop]) == list: with view.figure(stat_prefix + "#2/tabs/Models/" + k.replace("/", "/tabs/") + "/Plots/tabs/" + prop): pl.plot(node[prop]) for d in self.getDimensions(): x = self.get(d) if type(x[0]) == np.string_: view.add(stat_prefix + "#2/tabs/Dimensions/tabs/" + d + "/", str(x)) elif len(x.shape) == 1: try: with view.figure("#2/tabs/Dimensions/tabs/" + d + "/#1"): pl.plot(x) except: view.add( stat_prefix + "#2/tabs/Dimensions/tabs/" + d + "/#1/failed", x) elif len(x.shape) == 2: try: with view.figure(stat_prefix + "#2/tabs/Dimensions/tabs/" + d + "/#1"): pl.plot(x) with view.figure(stat_prefix + "#2/tabs/Dimensions/tabs/" + d + "/#2"): pl.plot(x.transpose()) except: with view.figure(stat_prefix + "#2/tabs/Dimensions/tabs/" + d + "/#1/failed"): for xx in x: for xxx in xx: pl.plot(xxx) elif len(x.shape) == 3: try: with view.figure(stat_prefix + "#2/tabs/Dimensions/tabs/" + d + "/tabs/Axis 0/#1"): pl.plot(np.mean(x, axis=0)) with view.figure(stat_prefix + "#2/tabs/Dimensions/tabs/" + d + "/tabs/Axis 0/#2"): pl.plot(np.mean(x, axis=0).transpose()) with view.figure(stat_prefix + "#2/tabs/Dimensions/tabs/" + d + "/tabs/Axis 1/#1"): pl.plot(np.mean(x, axis=1)) with view.figure(stat_prefix + "#2/tabs/Dimensions/tabs/" + d + "/tabs/Axis 1/#2"): pl.plot(np.mean(x, axis=1).transpose()) with view.figure(stat_prefix + "#2/tabs/Dimensions/tabs/" + d + "/tabs/Axis 2/#1"): pl.plot(np.mean(x, axis=2)) with view.figure(stat_prefix + "#2/tabs/Dimensions/tabs/" + d + "/tabs/Axis 2/#2"): pl.plot(np.mean(x, axis=2).transpose()) except: view.add( stat_prefix + "#2/tabs/Dimensions/tabs/" + d + "/#1/failed", x) return view
def html_view(self): view = View() view.title = self.project.name + " / " + self.path.split("/")[-2] + " ni. toolbox session" #view.add("#0/Project",self.project) for job in self.job_status.keys(): if "pending" in self.job_status[job]: view.add("#1/Job Status/"+str(job)+"/table/pending", str(self.job_status[job]["pending"])) if "starting..." in self.job_status[job]: view.add("#1/Job Status/"+str(job)+"/table/starting", str(self.job_status[job]["starting..."])) if "done." in self.job_status[job]: view.add("#1/Job Status/"+str(job)+"/table/done", str(self.job_status[job]["done."])) if "running..." in self.job_status[job]: view.add("#1/Job Status/"+str(job)+"/table/running", str(self.job_status[job]["running..."])) if "failed." in self.job_status[job]: view.add("#1/Job Status/"+str(job)+"/table/failed", str(self.job_status[job]["failed."])) jobs = copy(self.jobs) for j in jobs.keys(): view.add("#2/Jobs/tabs/"+str(jobs[j].job_name)+"/tabs/"+str(j),jobs[j]) if jobs[j].status == "starting...": view.add("#2/Jobs/tabs/"+str(jobs[j].job_name)+"/tabs/"+str(j)+"/.style","background-color: lightyellow; color: yellow;") if jobs[j].status == "running...": view.add("#2/Jobs/tabs/"+str(jobs[j].job_name)+"/tabs/"+str(j)+"/.style","background-color: lightyellow; color: black;") if jobs[j].status == "failed.": view.add("#2/Jobs/tabs/"+str(jobs[j].job_name)+"/tabs/"+str(j)+"/.style","color: darkred;") if jobs[j].status == "done.": view.add("#2/Jobs/tabs/"+str(jobs[j].job_name)+"/tabs/"+str(j)+"/.style","color: darkgreen;") return view
def html_view(self): view = View() view.title = self.project.name + " / " + self.session.path.split("/")[-2] + "/" + str(self.job_name) + " " + str(self.job_number) + " ni. toolbox job" for k in self.__dict__.keys(): if k != "session" and k != "project": v = self.__dict__[k] view.add("/Info/table/"+str(k),v) if os.path.exists(self.path+"_results.html"): view.add("/Results","<a href=\""+"job_"+str(self.job_number)+"_"+"_results.html"+"\">results</a>") if os.path.exists(self.path+"results.html"): view.add("/Results","<a href=\""+"job_"+str(self.job_number)+"_"+"results.html"+"\">results</a>") if os.path.exists(self.path+"_log.txt"): view.add("/Log","<a href=\""+"job_"+str(self.job_number)+"_"+"_log.txt"+"\">log</a>") if os.path.exists(self.path+"_error.txt"): view.add("/Error","<a href=\""+"job_"+str(self.job_number)+"_"+"_error.txt"+"\">Error log</a>") if os.path.exists(self.path+"error.txt"): view.add("/Error","<a href=\""+"job_"+str(self.job_number)+"_error.txt"+"\">Error log</a>") return view
def html_view(self): """ see :mod:`ni.tools.html_view` """ view = View() model_prefix = self.model.name + "/" view.add(model_prefix + "#2/beta",self.beta) for key in self.configuration.__dict__: view.add(model_prefix + "#3/tabs/Configuration/table/"+key,self.configuration.__dict__[key]) view.add(model_prefix + "#3/tabs/Design","") prot_nr = 0 prototypes = self.plot_prototypes() for p in prototypes: prot_nr = prot_nr + 1 view.savefig(model_prefix + "#3/tabs/Prototypes/tabs/"+str(p), fig = prototypes[p]) prototypes = self.prototypes() if 'autohistory2d' in prototypes and 'autohistory' in prototypes: with view.figure(model_prefix + "#3/tabs/Prototypes/tabs/autohistory_2d+autohistory"): for i in range(prototypes["autohistory2d"].shape[2]): pl.plot(sum(prototypes["autohistory2d"],0)[i,:]+prototypes["autohistory"],'g:') pl.plot(prototypes["autohistory"],'b-') for c in self.design.components: if type(c) != str: with view.figure(model_prefix + "#3/tabs/Design/#2/tabs/"+c.header+"/#2/Splines"): splines = c.getSplines() if len(splines.shape) == 1: pl.plot(splines,'-o') elif len(splines.shape) == 2: if splines.shape[0] == 1 or splines.shape[1] == 1: pl.plot(splines,'-o') else: pl.plot(splines) elif len(splines.shape) == 3: for i in range(splines.shape[0]): pl.subplot(np.ceil(np.sqrt(splines.shape[0])),np.ceil(np.sqrt(splines.shape[0])),i+1) pl.imshow(splines[i,:,:],interpolation='nearest') else: view.add(model_prefix + "#3/tabs/Design/#2/tabs/##/component",str(c)) return view
def html_view(self): """ Generates an html_view of this object. Example:: stats.html_view().render('stats_file.html') """ view = View() stat_prefix = "" for k in self.keys(): view.add(stat_prefix + "#2/tabs/Models/"+k.replace("/","/tabs/"),k) node = self.getNode(k) for prop in node: if type(node[prop]) == np.float64: view.add(stat_prefix + "#2/tabs/Models/"+k.replace("/","/tabs/")+"/#1/"+prop,prop+" = "+str(node[prop])) if type(node[prop]) == list: with view.figure(stat_prefix + "#2/tabs/Models/"+k.replace("/","/tabs/")+"/Plots/tabs/"+prop): pl.plot(node[prop]) for d in self.getDimensions(): x = self.get(d) if type(x[0]) == np.string_: view.add(stat_prefix + "#2/tabs/Dimensions/tabs/"+d+"/",str(x)) elif len(x.shape) == 1: try: with view.figure("#2/tabs/Dimensions/tabs/"+d+"/#1"): pl.plot(x) except: view.add(stat_prefix + "#2/tabs/Dimensions/tabs/"+d+"/#1/failed",x) elif len(x.shape) == 2: try: with view.figure(stat_prefix + "#2/tabs/Dimensions/tabs/"+d+"/#1"): pl.plot(x) with view.figure(stat_prefix + "#2/tabs/Dimensions/tabs/"+d+"/#2"): pl.plot(x.transpose()) except: with view.figure(stat_prefix + "#2/tabs/Dimensions/tabs/"+d+"/#1/failed"): for xx in x: for xxx in xx: pl.plot(xxx) elif len(x.shape) == 3: try: with view.figure(stat_prefix +"#2/tabs/Dimensions/tabs/"+d+"/tabs/Axis 0/#1"): pl.plot(np.mean(x,axis=0)) with view.figure(stat_prefix + "#2/tabs/Dimensions/tabs/"+d+"/tabs/Axis 0/#2"): pl.plot(np.mean(x,axis=0).transpose()) with view.figure(stat_prefix + "#2/tabs/Dimensions/tabs/"+d+"/tabs/Axis 1/#1"): pl.plot(np.mean(x,axis=1)) with view.figure(stat_prefix + "#2/tabs/Dimensions/tabs/"+d+"/tabs/Axis 1/#2"): pl.plot(np.mean(x,axis=1).transpose()) with view.figure(stat_prefix + "#2/tabs/Dimensions/tabs/"+d+"/tabs/Axis 2/#1"): pl.plot(np.mean(x,axis=2)) with view.figure(stat_prefix + "#2/tabs/Dimensions/tabs/"+d+"/tabs/Axis 2/#2"): pl.plot(np.mean(x,axis=2).transpose()) except: view.add(stat_prefix + "#2/tabs/Dimensions/tabs/"+d+"/#1/failed",x) return view