Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 def _visualizeLikelihood(self):  
     for it in self._visualizeIterations:
         fn = self._getIterSortedData(it)
         md = MetaData(fn)
         self.display2D(fn)
         xplotter = XmippPlotter(windowTitle="max Likelihood particles sorting Iter_%d"%it)
         xplotter.createSubPlot("Particle sorting: Iter_%d" % it, "Particle number", "maxLL")
         xplotter.plotMd(md, False, mdLabelY=MDL_LL)
         xplotter.show(True)
Ejemplo n.º 3
0
    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()
Ejemplo n.º 4
0
 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()
Ejemplo n.º 5
0
    def visualize(self):
        fn = self.getFilename('images')        
        if exists(fn):
            from protlib_utils import runShowJ
            if getattr(self, 'TiltPairs', False):
                runShowJ(fn,extraParams="--mode metadata --render first")
            else:
                runShowJ(fn)

            from protlib_gui_figure import XmippPlotter
            from xmipp import MDL_ZSCORE
            md = MetaData(fn)
            if md.containsLabel(MDL_ZSCORE):
                #MD.sort(MDL_ZSCORE)
                xplotter = XmippPlotter(windowTitle="Zscore particles sorting")
                xplotter.createSubPlot("Particle sorting", "Particle number", "Zscore")
                xplotter.plotMd(md, False, mdLabelY=MDL_ZSCORE)
                xplotter.show()