def plot1D(self, ctfSet, ctfId): ctfModel = ctfSet[ctfId] psdFn = ctfModel.getPsdFile() fn = os.path.join( pwutils.removeExt(psdFn).replace("_ctf", "") + '_EPA.log') xplotter = EmPlotter(windowTitle='GCTF results') plot_title = '%s # %d\n' % (ctfSet.getTsId(), ctfId) + getPlotSubtitle(ctfModel) a = xplotter.createSubPlot(plot_title, 'Resolution (Angstroms)', 'CTF') a.invert_xaxis() version = Plugin.getActiveVersion() curves = [1, 4, 5] if version == '1.18' else [1, 3, 4] for i in curves: _plotCurve(a, i, fn) xplotter.showLegend([ 'simulated CTF', # 'equiphase avg.', # 'bg', # only for v1.18 'equiphase avg. - bg', 'cross correlation' ]) a.grid(True) return xplotter
def createCtfPlot(ctfSet, ctfId): """ Create EmPlotter instance. """ ctfModel = ctfSet[ctfId] psdFn = ctfModel.getPsdFile() fn = removeExt(psdFn) + "_avrot.txt" xplotter = EmPlotter(windowTitle='CTFFind results') plot_title = getPlotSubtitle(ctfModel) a = xplotter.createSubPlot(plot_title, 'Spacial frequency (1/A)', 'Amplitude (or cross-correlation)') legendName = ['Amplitude spectrum', 'CTF Fit', 'Quality of fit'] _plotCurves(a, fn) xplotter.showLegend(legendName, loc='upper right') a.set_ylim([-0.1, 1.1]) a.grid(True) xplotter.show()
def _showGuinier(self, volume): nrefs = len(self._refsList) gridsize = self._getGridSize(nrefs) guinierFn = volume + ".guinier" d2 = self._getGuinierValue(guinierFn, 0) legends = ["lnFweighted ln(F)", "corrected ln(F)", "model"] xplotter = EmPlotter(*gridsize, windowTitle='Guinier Plots') subPlot = xplotter.createSubPlot(basename(volume), 'd^-2(A^-2)', 'ln(F)', yformat=False) for i, legend in enumerate(legends): y = self._getGuinierValue(guinierFn, i + 2) subPlot.plot(d2, y) xplotter.showLegend(legends) subPlot.grid(True) return xplotter
def createCtfPlot(ctfSet, ctfId): ctfModel = ctfSet[ctfId] psdFn = ctfModel.getPsdFile() fn = pwutils.removeExt(psdFn) + "_EPA.log" xplotter = EmPlotter(windowTitle='CTF Fitting') plot_title = getPlotSubtitle(ctfModel) a = xplotter.createSubPlot(plot_title, 'Resolution (Angstroms)', 'CTF') a.invert_xaxis() version = Plugin.getActiveVersion() curves = [1, 4, 5] if version == '1.18' else [1, 3, 4] for i in curves: _plotCurve(a, i, fn) xplotter.showLegend([ 'simulated CTF', # 'equiphase avg.', # 'bg', # only for v1.18 'equiphase avg. - bg', 'cross correlation' ]) a.grid(True) xplotter.show()
def _showFSC(self, paramName=None): threshold = self.resolutionThresholdFSC.get() iterations = self._getIterations() groups = self._getGroups() if self.isGoldStdProt(): template = 'fscdoc_m_%02d.stk' title = 'Masked FSC' else: template = 'fscdoc_%02d.stk' title = 'FSC' if self.groupFSC == 0: # group by iterations files = [(it, self._getFinalPath(template % it)) for it in iterations] legendPrefix = 'iter' else: it = iterations[-1] # show only last iteration legendPrefix = 'group' def group(f): # retrieve the group number return int(f.split('_')[-1].split('.')[0]) groupFiles = glob(self._getFinalPath('ofscdoc_%02d_???.stk' % it)) groupFiles.sort() files = [(group(f), f) for f in groupFiles if group(f) in groups] if not files: # empty files return [ self.errorMessage("Please select valid groups to display", title="Wrong groups selection") ] plotter = EmPlotter(x=1, y=1, windowTitle='Resolution FSC') a = plotter.createSubPlot(title, 'Angstroms^-1', 'FSC', yformat=False) legends = [] for it, fscFile in files: if os.path.exists(fscFile): self._plotFSC(a, fscFile) legends.append('%s %d' % (legendPrefix, it)) else: print("Missing file: ", fscFile) # plot final FSC curve (from BP) if self.groupFSC == 0 and not self.isGoldStdProt(): lastIter = self.protocol._getLastIterNumber() if lastIter in iterations: fscFinalFile = self._getFinalPath('ofscdoc_%02d.stk' % lastIter) if os.path.exists(fscFinalFile): self._plotFSC(a, fscFinalFile) legends.append('final') if threshold < self.maxfsc: a.plot([self.minInv, self.maxInv], [threshold, threshold], color='black', linestyle='--') plotter.showLegend(legends) a.grid(True) return [plotter]