def _visualizeAvgPMAX(self): addRelionLabels() mdIters = MetaData() iterations = range(self.firstIter(), self._visualizeLastIteration+1) labels = [MDL_AVGPMAX, MDL_PMAX] colors = ['g', 'b'] prefixes = self._getPrefixes() for it in iterations: # range (firstIter,self._visualizeLastIteration+1): #alwaya list all iteration objId = mdIters.addObject() mdIters.setValue(MDL_ITER, it, objId) for i, prefix in enumerate(prefixes): fn = 'model_general@'+ self.getFilename(prefix + 'model', iter=it) md = MetaData(fn) pmax = md.getValue(MDL_AVGPMAX, md.firstObject()) mdIters.setValue(labels[i], pmax, objId) fn = self.getFilename('all_avgPmax_xmipp') mdIters.write(fn) #self.display2D(fn, extraParams='--label_relion') //do not display table since labels are confussing xplotter = XmippPlotter() xplotter.createSubPlot("Avg PMax per Iterations", "Iterations", "Avg PMax") for label, color in zip(labels, colors): xplotter.plotMd(mdIters, MDL_ITER, label, color) if len(prefixes) > 1: xplotter.showLegend(prefixes) xplotter.show(True)
def _visualizeDisplayResolutionPlotsSSNR(self): names = [] windowTitle = {} prefixes = self._getPrefixes() n = len(prefixes) * self._visualizeNrefs gridsize = self._getGridSize(n) addRelionLabels() activateMathExtensions() xplotter = XmippPlotter(*gridsize) for prefix in prefixes: for ref3d in self._visualizeRef3Ds: plot_title = 'Resolution SSNR %s, for Class %s' % (prefix, ref3d) a = xplotter.createSubPlot(plot_title, 'Armstrongs^-1', 'log(SSNR)', yformat=False) blockName = 'model_class_%d@' % ref3d legendName = [] for it in self._visualizeIterations: file_name = blockName + self.getFilename(prefix + 'model', iter=it) #file_name = self.getFilename('ResolutionXmdFile', iter=it, ref=ref3d) self._plotSSNR(a, file_name) legendName.append('iter %d' % it) xplotter.showLegend(legendName) a.grid(True) xplotter.show(True)
def _visualizeDisplayResolutionPlotsFSC(self): self.ResolutionThreshold = float(self.parser.getTkValue('ResolutionThreshold')) n = self._visualizeNrefs * len(self._getPrefixes()) gridsize = self._getGridSize(n) activateMathExtensions() addRelionLabels() xplotter = XmippPlotter(*gridsize, windowTitle='Resolution FSC') for prefix in self._getPrefixes(): for ref3d in self._visualizeRef3Ds: plot_title = prefix + 'class %s' % ref3d a = xplotter.createSubPlot(plot_title, 'Armstrongs^-1', 'FSC', yformat=False) legends = [] blockName = 'model_class_%d@' % ref3d for it in self._visualizeIterations: model_star = blockName + self.getFilename(prefix + 'model', iter=it) if self._plotFSC(a, model_star): legends.append('iter %d' % it) xplotter.showLegend(legends) if self.ResolutionThreshold < self.maxFrc: a.plot([self.minInv, self.maxInv],[self.ResolutionThreshold, self.ResolutionThreshold], color='black', linestyle='--') a.grid(True) xplotter.show(True)
def run(self): from xmipp import MetaData, str2Label from protlib_gui_figure import XmippPlotter md = MetaData(self.getParam('-i')) if self.checkParam('--xlabel'): xlabel = self.getParam('--xlabel') mdLabelX = str2Label(xlabel) else: xlabel = "" mdLabelX = None if self.checkParam('--xtitle'): xlabel = self.getParam('--xtitle') ylabels = self.getParam('--ylabel').split() if self.checkParam('--ytitle'): ylabel = self.getParam('--ytitle') else: ylabel = ylabels[0] colors, lenColors = self.getList('--colors', ['g', 'b', 'r', 'y', 'c', 'm', 'k']) markers, lenMarkers = self.getList('--markers') styles, lenStyles = self.getList('--style') if self.checkParam('--nbins'): nBins = self.getIntParam('--nbins') else: nBins = None title = self.getParam('--title') xplotter = XmippPlotter() xplotter.createSubPlot(title, xlabel, ylabel) for i, l in enumerate(ylabels): c = colors[i % lenColors] m = markers[i % lenMarkers] if m == "none": m = None s = styles[i % lenStyles] if s == "none": s = None xplotter.plotMd(md, mdLabelX, str2Label(l), color=c, marker=m, linestyle=s, nbins=nBins) # if nbins is present do an histogram legendLocation = self.getParam('--legend') if legendLocation != 'none': xplotter.showLegend(ylabels, loc=legendLocation.replace('_', ' ')) xplotter.show()
def run(self): from xmipp import MetaData, str2Label from protlib_gui_figure import XmippPlotter md = MetaData(self.getParam('-i')) if self.checkParam('--xlabel'): xlabel = self.getParam('--xlabel') mdLabelX = str2Label(xlabel) else: xlabel = "" mdLabelX = None if self.checkParam('--xtitle'): xlabel = self.getParam('--xtitle') ylabels = self.getParam('--ylabel').split() if self.checkParam('--ytitle'): ylabel = self.getParam('--ytitle') else: ylabel = ylabels[0] colors, lenColors = self.getList('--colors', ['g', 'b', 'r', 'y', 'c', 'm', 'k']) markers, lenMarkers = self.getList('--markers') styles, lenStyles = self.getList('--style') if self.checkParam('--nbins'): nBins = self.getIntParam('--nbins') else: nBins = None title = self.getParam('--title') xplotter = XmippPlotter() xplotter.createSubPlot(title, xlabel, ylabel) for i, l in enumerate(ylabels): c = colors[i % lenColors] m = markers[i % lenMarkers] if m == "none": m = None s = styles[i % lenStyles] if s == "none": s = None xplotter.plotMd(md, mdLabelX, str2Label(l), color=c, marker=m, linestyle=s, nbins=nBins)#if nbins is present do an histogram legendLocation = self.getParam('--legend') if legendLocation != 'none': xplotter.showLegend(ylabels, loc=legendLocation.replace('_', ' ')) xplotter.show()
def visualize(self): if self.ExperimentalSAXS=="": fnInt=self.workingDirPath("pseudoatoms00.int") else: fnInt=self.workingDirPath("pseudoatoms00.fit") import numpy x=numpy.loadtxt(fnInt,skiprows=1) xplotter = XmippPlotter(*[1,1],windowTitle="SAXS Curves") a = xplotter.createSubPlot('SAXS curves', 'Armstrongs^-1', 'log(SAXS)', yformat=False) a.plot(x[:,0], numpy.log(x[:,1])) a.plot(x[:,0], numpy.log(x[:,2])) if self.ExperimentalSAXS=="": xplotter.showLegend(['SAXS in solution','SAXS in vacuo']) else: xplotter.showLegend(['Experimental SAXS','SAXS from volume']) xplotter.draw() xplotter.show()