def _showEmanCtf(self, paramName=None): program = eman2.Plugin.getProgram('e2ctf.py') args = '--allparticles --minptcl=0 --minqual=0' args += ' --gui --constbfactor=-1.0 --sf=auto' hostConfig = self.protocol.getHostConfig() # Create the steps executor executor = StepExecutor(hostConfig) self.protocol.setStepsExecutor(executor) # Finally run the protocol self.protocol.runJob(program, args, cwd=self.protocol._getExtraPath(), numberOfMpi=1, numberOfThreads=1) # Open dialog to request confirmation to overwrite output saveChanges = askYesNo( "Save output changes?", "Do you want to overwrite output particles with new CTF values?\n" "This may take a while depending on the set size.", self.getTkRoot()) if saveChanges: self.protocol.createOutputStep() showInfo("Output updated", "Output particles were updated with new CTF values.", self.getTkRoot())
def _showBfactorVols(self, paramName=None): volsBfactor = [] guinierPlots = [] volumes = self._volFileNames('reconstructedFileNamesIters') for vol in volumes: volBfactor = vol + '.bfactor' volsBfactor.append(volBfactor) args = '-i %(vol)s --sampling %(samplingRate)s --maxres %(maxRes)s -o %(volBfactor)s ' + self.correctBfactorExtraCommand.get( ) maxRes = self.maxRes.get() samplingRate = self.protocol.resolSam args = args % locals() hostConfig = self.protocol.getHostConfig() # Create the steps executor executor = StepExecutor(hostConfig) self.protocol.setStepsExecutor(executor) # Finally run the protocol self.protocol.runJob("xmipp_volume_correct_bfactor", args, numberOfMpi=1) guinierPlots.append(self._showGuinier(volBfactor)) return self._showVolumes(volsBfactor) + guinierPlots
def _runEulerXplor(self, paramName=None): program = Plugin.getProgram('e2eulerxplor.py') hostConfig = self.protocol.getHostConfig() # Create the steps executor executor = StepExecutor(hostConfig) self.protocol.setStepsExecutor(executor) # Finally run the protocol self.protocol.runJob(program, "", cwd=self.protocol._getExtraPath(), numberOfMpi=1, numberOfThreads=1) return []
def _runAnalysis(self, paramName=None): program = Plugin.getProgram('analyze') args = ' %s %d --Apix %0.3f' % ( self.protocol._getFileName("output_dir"), self._epoch, self.protocol._getSampling()) hostConfig = self.protocol.getHostConfig() # Create the steps executor executor = StepExecutor(hostConfig) self.protocol.setStepsExecutor(executor) # Finally run the protocol self.protocol.runJob(program, args, env=Plugin.getEnviron(), cwd=None)
def test_basicObjectOutput(self): """Test the list with several Complex""" fn = self.getOutputPath("protocol.sqlite") mapper = SqliteMapper(fn, globals()) prot = ProtOutputTest(mapper=mapper, n=2, workingDir=self.getOutputPath('')) # Add and old style output, not in the outputs dictionary prot.output1 = EMObject() self.assertFalse(prot._useOutputList.get(), "useOutputList wrongly initialized") outputs = [output for output in prot.iterOutputAttributes()] self.assertTrue(1, len(outputs)) prot._stepsExecutor = StepExecutor(hostConfig=None) prot.run() self.assertEqual(prot._steps[0].getStatus(), STATUS_FINISHED) # Check there is an output self.assertOutput(prot) outputs = [output for output in prot.iterOutputAttributes()] # We are intentionally ignoring a protocol with output (EMObject) # That has been continued, We do not find a real case now. self.assertEqual(1, len(outputs), msg="Integer output not registered properly.") outputs = [output for output in prot.iterOutputAttributes(Integer)] # Test passing a filter self.assertEqual(1, len(outputs), msg="Integer not matched when filtering outputs.") # Test with non existing class outputs = [output for output in prot.iterOutputAttributes(DataSet)] # Test passing a class self.assertEqual(0, len(outputs), msg="Filter by class in iterOutputAttributes does " "not work.") self.assertTrue(prot._useOutputList.get(), "useOutputList not activated")
def test_StepExecutor(self): """Test the list with several Complex""" fn = self.getOutputPath("protocol.sqlite") mapper = SqliteMapper(fn, globals()) prot = MyProtocol(mapper=mapper, n=2, workingDir=self.getOutputPath('')) prot._stepsExecutor = StepExecutor(hostConfig=None) prot.run() self.assertEqual(prot._steps[0].getStatus(), STATUS_FINISHED) mapper2 = SqliteMapper(fn, globals()) prot2 = mapper2.selectById(prot.getObjId()) self.assertEqual(prot.endTime.get(), prot2.endTime.get())
def _extraWork(): program = Plugin.getProgram('').split()[:-1] # remove cryodrgn command fn = self.protocol._getFileName('output_notebook', epoch=self._epoch) program.append('jupyter notebook %s' % os.path.basename(fn)) if os.path.exists(fn): fnDir = os.path.dirname(fn) hostConfig = self.protocol.getHostConfig() executor = StepExecutor(hostConfig) self.protocol.setStepsExecutor(executor) self.protocol.runJob(" ".join(program), '', env=Plugin.getEnviron(), cwd=fnDir) else: self.showError('Jupyter notebook not found! Have you run analysis?')
def _showEmanPlot(self, paramName=None): program = eman2.Plugin.getProgram('e2tiltvalidate.py') args = "--path=TiltValidate_01 --radcut=%0.2f --gui --planethres=%0.2f" % ( self.radcut.get(), self.planethres.get()) if self.colozaxis: args += " --colorzaxis" hostConfig = self.protocol.getHostConfig() # Create the steps executor executor = StepExecutor(hostConfig) self.protocol.setStepsExecutor(executor) # Finally run the protocol self.protocol.runJob(program, args, cwd=self.protocol._getExtraPath(), numberOfMpi=1, numberOfThreads=1) return []