def insertAlignStackRunIntoDatabase(self, alignimagicfile): apDisplay.printMsg("Inserting CL2D Run into DB") ### setup alignment run alignrunq = appiondata.ApAlignRunData() alignrunq['runname'] = self.runparams['runname'] alignrunq['path'] = appiondata.ApPathData(path=os.path.abspath(self.params['rundir'])) uniquerun = alignrunq.query(results=1) # if uniquerun: # apDisplay.printError("Run name '"+self.runparams['runname']+"' and path already exist in database") ### setup cl2d run cl2dq = appiondata.ApCL2DRunData() cl2dq['runname'] = self.runparams['runname'] cl2dq['run_seconds'] = self.runparams['runtime'] cl2dq['fast'] = self.runparams['fast'] self.cl2dqdata=cl2dq ### finish alignment run alignrunq['cl2drun'] = cl2dq alignrunq['hidden'] = False alignrunq['runname'] = self.runparams['runname'] alignrunq['description'] = self.runparams['description'] alignrunq['lp_filt'] = self.runparams['lowpass'] alignrunq['hp_filt'] = self.runparams['highpass'] alignrunq['bin'] = self.runparams['bin'] ### setup alignment stack alignstackq = appiondata.ApAlignStackData() if self.runparams['align'] is True: ### option to create aligned stack alignstackq['imagicfile'] = alignimagicfile alignstackq['avgmrcfile'] = "average.mrc" alignstackq['refstackfile'] = "part"+self.params['timestamp']+"_level_%02d_.hed"%(self.Nlevels-1) alignstackq['iteration'] = self.runparams['maxiter'] alignstackq['path'] = appiondata.ApPathData(path=os.path.abspath(self.params['rundir'])) alignstackq['alignrun'] = alignrunq ### check to make sure files exist if self.runparams['align'] is True: ### option to create aligned stack alignimagicfilepath = os.path.join(self.params['rundir'], alignstackq['imagicfile']) if not os.path.isfile(alignimagicfilepath): apDisplay.printError("could not find stack file: "+alignimagicfilepath) avgmrcfile = os.path.join(self.params['rundir'], alignstackq['avgmrcfile']) if not os.path.isfile(avgmrcfile): apDisplay.printError("could not find average mrc file: "+avgmrcfile) refstackfile = os.path.join(self.params['rundir'], alignstackq['refstackfile']) if not os.path.isfile(refstackfile): apDisplay.printError("could not find reference stack file: "+refstackfile) alignstackq['stack'] = apStack.getOnlyStackData(self.runparams['stackid']) alignstackq['boxsize'] = self.boxsize alignstackq['pixelsize'] = apStack.getStackPixelSizeFromStackId(self.runparams['stackid'])*self.runparams['bin'] alignstackq['description'] = self.runparams['description'] alignstackq['hidden'] = False alignstackq['num_particles'] = self.runparams['numpart'] ### insert if self.params['commit'] is True: alignstackq.insert() self.alignstackdata = alignstackq return
def insertCL2DParamsIntoDatabase(self): ### setup cl2d run cl2dq = appiondata.ApCL2DRunData() cl2dq['runname'] = self.runparams['runname'] cl2dq['run_seconds'] = self.runparams['runtime'] cl2dq['fast'] = self.runparams['fast'] cl2dq[ 'REF|projectdata|projects|project'] = apProject.getProjectIdFromStackId( self.params['stackid']) cl2dq['timestamp'] = self.params['timestamp'] cl2dq['path'] = appiondata.ApPathData( path=os.path.abspath(self.params['rundir'])) cl2dq['finished'] = True cl2dq['max-iter'] = self.params['maxiter'] cl2dq['num-ref'] = self.params['numrefs'] if self.params['correlation'] is True: cl2dq['correlation'] = True cl2dq['correntropy'] = False else: cl2dq['correlation'] = False cl2dq['correntropy'] = True if self.params['classical'] is True: cl2dq['classical_multiref'] = True cl2dq['intracluster_multiref'] = False else: cl2dq['classical_multiref'] = False cl2dq['intracluster_multiref'] = True ### insert if commit is true if self.params['commit'] is True: cl2dq.insert() self.cl2dqdata = cl2dq
def getCL2DJob(self): cl2djobq = appiondata.ApCL2DRunData() cl2djobq['runname'] = self.runparams['runname'] cl2djobq['path'] = appiondata.ApPathData(path=os.path.abspath(self.runparams['rundir'])) cl2djobq['REF|projectdata|projects|project'] = apProject.getProjectIdFromStackId(self.runparams['stackid']) cl2djobq['timestamp'] = self.params['timestamp'] cl2djobdata = cl2djobq.query(results=1) if not cl2djobdata: return None return cl2djobdata[0]