def visualize(self): if self.getRunState() == SqliteDb.RUN_FINISHED: from protlib_utils import runShowJ runShowJ("classes@"+self.workingDirPath("classes.xmd"), extraParams=" --columns %d" % self.SomXdim) else: from protlib_gui_ext import showWarning showWarning("Warning", "The algorithm has not finished yet", parent=self.master)
def launchProjSubPlots(self, selectedPlots): ''' Launch some plots for a Projection Matching protocol run ''' import numpy as np _log = self.Log xplotter=None self._plot_count = 0 def doPlot(plotName): return plotName in selectedPlots file_name_tmp = join(self.CtfGroupDirectoryName, self.CtfGroupRootName) +'Info.xmd' file_name = join(self.PrevRun.WorkingDir, file_name_tmp) if exists(file_name): auxMD = MetaData("numberGroups@"+file_name) self.NumberOfCtfGroups = auxMD.getValue(MDL_COUNT,auxMD.firstObject()) else: self.NumberOfCtfGroups = 1 if doPlot('DisplayReference'): for indexCtf in range(1, self.NumberOfCtfGroups+1): file_name = self.getFilename('SubtractedStack', ctf=indexCtf)+'ref' if exists(file_name): try: runShowJ(file_name) except Exception, e: showError("Error launching java app", str(e), self.master)
def visualizeReferences(self): refs = self.getFilename('iter_refs', iter=lastIteration(self)) if xmippExists(refs): try: runShowJ(refs, extraParams="--mode metadata --render first") except Exception, e: showError("Error launching java app", str(e), self.master)
def visualize(self): from protlib_utils import runShowJ if os.path.exists(self.OutMask): runShowJ(self.OutMask) fnMasked=self.workingDirPath("volume_masked.vol") if os.path.exists(fnMasked): runShowJ(fnMasked)
def visualize(self): from protlib_utils import runShowJ fnSubset="" if self.WhatToShow=="Classes": fnSubset="" elif self.WhatToShow=="Class Cores": fnSubset="_core" elif self.WhatToShow=="Class Stable Cores": fnSubset="_stable_core" levelFiles=glob.glob(os.path.join(self.ExtraDir,"level_??/level_classes%s.xmd"%fnSubset)) if levelFiles: levelFiles.sort() lastLevelFile=levelFiles[-1] if self.DoShowLast: runShowJ("classes@"+lastLevelFile) else: listOfLevels = getListFromRangeString(self.LevelsToShow) lastLevel=int(re.search('level_(\d\d)',lastLevelFile).group(1)) if max(listOfLevels)<=lastLevel: files = ""; for level in listOfLevels: fn=os.path.join(self.ExtraDir,"level_%02d/level_classes%s.xmd"%(level,fnSubset)) if os.path.exists(fn): files+="classes_sorted@"+fn+" " if files!="": runShowJ(files) if self.DoShowHierarchy: fnHierarchy=self.getFilename("hierarchy",subset=fnSubset) if os.path.exists(fnHierarchy): from protlib_gui_ext import showTextfileViewer showTextfileViewer(fnHierarchy,[fnHierarchy])
def visualize(self): if self.DoShowList: fnVolumes = self.workingDirPath('volumesProposed.xmd') runShowJ(fnVolumes) if self.VolumesToShow!="": listOfVolumes = getListFromRangeString(self.VolumesToShow) for volume in listOfVolumes: fnRoot=self.workingDirPath('volumeProposed%05d'%int(volume)) os.system("xmipp_chimera_client -i %s.vol --mode projector 256 --angulardist %s.xmd"%(fnRoot,fnRoot))
def visualize(self): if self.DoShowList: fnVolumes = self.workingDirPath('proposedVolumes.xmd') runShowJ(fnVolumes) if self.VolumesToShow!="": listOfVolumes = getListFromRangeString(self.VolumesToShow) for volume in listOfVolumes: fnRoot=os.path.join(WorkingDir,'Structure00000_core_extended','proposedVolume%05d'%volume) os.system("xmipp_chimera_client -i %s.vol --mode projector 256 --angulardist %s.xmd"%(fnRoot,fnRoot))
def display3D(self, filename): if xmippExists(filename): #Chimera if self._visualizeVolumesMode == 'chimera': runChimeraClient(filename) else: try: runShowJ(filename, extraParams=' --dont_wrap ') except Exception, e: showError("Error launching xmipp_showj: ", str(e), self.master)
def visualize(self): summaryFile = self.getFilename('micrographs') if not exists(summaryFile): # Try to create partial summary file summaryFile = summaryFile.replace(self.WorkingDir, self.TmpDir) buildSummaryMetadata(self.WorkingDir, self.Input['micrographs'], summaryFile, self.MDL_TYPE) if exists(summaryFile): self.regenerateSummary(summaryFile) runShowJ(summaryFile, extraParams = "--mode metadata --render psd psdEnhanced image1 image2 --order psd psdEnhanced image1 image2 --zoom 50") else: showWarning('Warning', 'There are not results yet',self.master)
def launchVisualize(self,selectedPlots): def doPlot(plotName): return plotName in selectedPlots if self.StructureType=="EM": if doPlot('DisplayPseudoAtom'): runChimera(self.workingDirPath("chimera.cmd")) if doPlot('DisplayPseudoApproximation'): runShowJ(self.InputStructure+" "+self.getFilename("extra_pseudoatoms")+"_approximation.vol") if doPlot('DisplayModes'): runShowJ(self.workingDirPath('modes.xmd')) if doPlot('DisplayMaxDistanceProfile'): fnProfile=os.path.join("extra","maxAtomShifts.xmd") os.system("xmipp_metadata_plot -i "+self.workingDirPath(fnProfile)+' -y nmaAtomShift --title "Maximum atom shifts" &') if doPlot('DisplayDistanceProfile'): fnProfile=os.path.join("extra","distanceProfiles","vec%d"%int(self.DisplaySingleMode)+".xmd") os.system("xmipp_metadata_plot -i "+self.workingDirPath(fnProfile)+' -y nmaAtomShift --title "Atom shifts for mode '+\ self.DisplaySingleMode+'" &')
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()
def visualize(self): fnFSC=self.workingDirPath("fsc.xmd") if os.path.exists(fnFSC): if self.DisplayFSC and self.DoFSC: os.system('xmipp_metadata_plot -i %s -x resolutionFreqFourier -y resolutionFRC --title "Fourier Shell Correlation" --xtitle "1/Angstroms" &'%fnFSC) if self.DisplayDPR and self.DoFSC: os.system('xmipp_metadata_plot -i %s -x resolutionFreqFourier -y resolutionDPR --title "Differential Phase Residual" --xtitle "1/Angstroms" &'%fnFSC) fnStructure=self.workingDirPath("structureFactor.xmd") if os.path.exists(fnStructure): if self.DisplayStructureFactor and self.DoStructureFactor: os.system('xmipp_metadata_plot -i %s -x resolutionFreqFourier -y resolutionLogStructure --title "Structure factor" --xtitle "Frequency (1/A)" --ytitle "Log(StructureFactor)" &'%fnStructure) if self.DisplayGuinier: if self.UseMatlab: os.system("matlab -r \"xmipp_show_structure_factor(\'"+self.WorkingDir+"\')\"") else: os.system('xmipp_metadata_plot -i %s -x resolutionFreqFourier2 -y resolutionLogStructure --title "Guinier plot" --xtitle "Frequency (1/A^2)" --ytitle "Log(StructureFactor)" &'%fnStructure) fnSSNR=self.workingDirPath("ssnr.xmd") if os.path.exists(fnSSNR): if self.DisplaySSNR and self.DoSSNR: os.system('xmipp_metadata_plot -i %s -x resolutionFreqFourier -y resolutionSSNR --title "Spectral SNR" --xtitle "Frequency (1/A)" --ytitle "SNR" &'%fnSSNR) fnVSSNR=self.workingDirPath("vssnr.vol") if os.path.exists(fnVSSNR): if self.DisplayVSSNR and self.DoVSSNR: runShowJ(fnVSSNR)
def visualize(self): micsFn = self.getFilename('micrographs') if exists(micsFn): from protlib_utils import runShowJ runShowJ(micsFn)
def visualize(self): from protlib_utils import runShowJ import glob files=glob.glob(self.workingDirPath('images*.xmd')) if files: runShowJ(" ".join(files))
def visualize(self): from protlib_utils import runShowJ fnVolume=self.workingDirPath('volume.vol') if os.path.exists(fnVolume): runShowJ(fnVolume)
def visualize(self): from protlib_utils import runShowJ fn=self.workingDirPath('results.xmd') if os.path.exists(fn): runShowJ(fn)
def visualize(self): fnAligned = 'classes_aligned@' + self.workingDirPath('classes.xmd') runShowJ(fnAligned, extraParams="--mode metadata --render first") os.system('xmipp_chimera_client -i '+self.Volume+' --mode projector 256 &')
def visualize(self): runShowJ(self.workingDirPath(VOLUMES))
def visualize(self): from protlib_utils import runShowJ fnOut=self.workingDirPath("volume_aligned.vol") if os.path.exists(fnOut): runShowJ(fnOut)
def visualize(self): runShowJ(self.fnOut)
def visualize(self): if not os.path.exists(self.outputFile): from protlib_gui_ext import showWarning showWarning("Error", "There is no result yet",self.master) else: runShowJ(self.outputFile)
def visualize(self): runShowJ("classes@%s" % self.extraPath("kerdensom_classes.xmd"), extraParams="--mode rotspectra --columns %d" % self.SomXdim)
def visualize(self): summaryFile = self.getFilename('micrographs') if exists(summaryFile): runShowJ(summaryFile, extraParams = "--mode metadata") else: showWarning('Warning', 'There are not results yet',self.master)
for indexCtf in range(1, self.NumberOfCtfGroups+1): file_name = self.getFilename('SubtractedStack', ctf=indexCtf)+'exp' if exists(file_name): try: runShowJ(file_name) except Exception, e: showError("Error launching java app", str(e), self.master) if doPlot('DisplaySubtracted'): for indexCtf in range(1, self.NumberOfCtfGroups+1): file_name = self.getFilename('SubtractedStack', ctf=indexCtf) print "DisplaySubtracted file_name: ", file_name if exists(file_name): try: runShowJ(file_name) except Exception, e: showError("Error launching java app", str(e), self.master) if xplotter: xplotter.show() def createFilenameTemplates(self): extraParams = {'ReferenceVolumeName': 'reference_volume.vol', 'ProjSubDir': "ProjSub", 'LocalCurrentAngles': 'sub_current_angles.doc', 'LocalCurrentAnglesCtfGroups': 'sub_current_angles_ctfgroups.doc', 'CtfGroupDirectory': "CtfGroups", 'CtfGroupRootName': "ctf",
def visualize(self): resultMd = self.workingDirPath('tomograms.xmd') if os.path.exists(resultMd): from protlib_utils import runShowJ runShowJ(resultMd, extraParams='--mode gallery') pass
def visualize(self): fn = self.getFilename('images') if exists(fn): from protlib_utils import runShowJ runShowJ(fn)
def visualize(self): from protlib_utils import runShowJ if os.path.exists(self.fnSym): runShowJ(self.fnSym)
def visualize(self): summaryFile = self.getFilename("micrographs") if os.path.exists(summaryFile): from protlib_utils import runShowJ runShowJ(summaryFile)
def visualize(self): from protlib_utils import runShowJ fnClasses=self.workingDirPath('classes.xmd') if os.path.exists(fnClasses): runShowJ(fnClasses)
def visualize(self): fnImages = self.workingDirPath("images.xmd") runShowJ(fnImages, extraParams="--mode metadata --render first")