def _doViewRawDeformation(self, components): # components = map(int, self.displayRawDeformation.get().split()) components = map(int, components.split()) dim = len(components) views = [] if dim > 0: modeList = [m - 1 for m in components] modeNameList = ['Mode %d' % m for m in components] missingList = [] if missingList: return [self.errorMessage("Invalid mode(s) *%s*\n." % (', '.join(missingList)), title="Invalid input")] # Actually plot plotter = XmippNmaPlotter(data=self.getData()) baseList = [basename(n) for n in modeNameList] if dim == 1: self.getData().XIND = modeList[0] plotter.plotArray1D("Histogram for %s" % baseList[0], "Deformation value", "Number of images") else: self.getData().YIND = modeList[1] if dim == 2: plotter.plotArray2D("%s vs %s" % tuple(baseList), *baseList) elif dim == 3: self.getData().ZIND = modeList[2] plotter.plotArray3D("%s %s %s" % tuple(baseList), *baseList) views.append(plotter) return views
def _doViewRawDeformation(self, components): # components = map(int, self.displayRawDeformation.get().split()) components = map(int, components.split()) dim = len(components) views = [] if dim > 0: modeList = [] modeNameList = [] missingList = [] for modeNumber in components: found = False md = xmipp.MetaData(self.protocol._getExtraPath('modes.xmd')) for i, objId in enumerate(md): modeId = md.getValue(xmipp.MDL_ORDER, objId) if modeNumber == modeId: modeNameList.append('Mode %d' % modeNumber) modeList.append(i) found = True break if not found: missingList.append(str(modeNumber)) if missingList: return [ self.errorMessage("Invalid mode(s) *%s*\n." % (', '.join(missingList)), title="Invalid input") ] # Actually plot plotter = XmippNmaPlotter(data=self.getData()) baseList = [basename(n) for n in modeNameList] if dim == 1: self.getData().XIND = modeList[0] plotter.plotArray1D("Histogram for %s" % baseList[0], "Deformation value", "Number of images") else: self.getData().YIND = modeList[1] if dim == 2: plotter.plotArray2D("%s vs %s" % tuple(baseList), *baseList) elif dim == 3: self.getData().ZIND = modeList[2] plotter.plotArray3D("%s %s %s" % tuple(baseList), *baseList) views.append(plotter) return views
def _doViewRawDeformation(self, components): # components = map(int, self.displayRawDeformation.get().split()) components = map(int, components.split()) dim = len(components) views = [] if dim > 0: modeList = [] modeNameList = [] missingList = [] for modeNumber in components: found = False md = xmipp.MetaData(self.protocol._getExtraPath('modes.xmd')) for i, objId in enumerate(md): modeId = md.getValue(xmipp.MDL_ORDER, objId) if modeNumber == modeId: modeNameList.append('Mode %d' % modeNumber) modeList.append(i) found = True break if not found: missingList.append(str(modeNumber)) if missingList: return [self.errorMessage("Invalid mode(s) *%s*\n." % (', '.join(missingList)), title="Invalid input")] # Actually plot plotter = XmippNmaPlotter(data=self.getData()) baseList = [basename(n) for n in modeNameList] if dim == 1: self.getData().XIND = modeList[0] plotter.plotArray1D("Histogram for %s" % baseList[0], "Deformation value", "Number of images") else: self.getData().YIND = modeList[1] if dim == 2: plotter.plotArray2D("%s vs %s" % tuple(baseList), *baseList) elif dim == 3: self.getData().ZIND = modeList[2] plotter.plotArray3D("%s %s %s" % tuple(baseList), *baseList) views.append(plotter) return views
def _doViewRawDeformation(self, components): # components = map(int, self.displayRawDeformation.get().split()) components = map(int, components.split()) dim = len(components) views = [] if dim > 0: modeList = [m - 1 for m in components] modeNameList = ['Mode %d' % m for m in components] missingList = [] if missingList: return [ self.errorMessage("Invalid mode(s) *%s*\n." % (', '.join(missingList)), title="Invalid input") ] # Actually plot plotter = XmippNmaPlotter(data=self.getData()) baseList = [basename(n) for n in modeNameList] if dim == 1: self.getData().XIND = modeList[0] plotter.plotArray1D("Histogram for %s" % baseList[0], "Deformation value", "Number of images") else: self.getData().YIND = modeList[1] if dim == 2: plotter.plotArray2D("%s vs %s" % tuple(baseList), *baseList) elif dim == 3: self.getData().ZIND = modeList[2] plotter.plotArray3D("%s %s %s" % tuple(baseList), *baseList) views.append(plotter) return views
def createShiftPlot(mdFn, title, ylabel): plotter = XmippNmaPlotter() plotter.createSubPlot(title, 'atom index', ylabel) plotter.plotMdFile(mdFn, None, xmipp.MDL_NMA_ATOMSHIFT) return plotter