Пример #1
0
    def initializeRefinementUploadVariables(self):
        ''' untars results, reads required parameters, establishes necessary objects for upload script '''

        apDisplay.printColor(
            "uploading refinement results for %s reconstruction routine" %
            (self.package), "cyan")

        ### establish directories and make an appion results directory
        self.basepath = os.path.abspath(self.params['rundir'])
        self.resultspath = os.path.abspath(
            os.path.join(self.params['rundir'],
                         str(self.package) + "_results"))
        if not os.path.isdir(self.resultspath):
            os.mkdir(self.resultspath)
        self.reconpath = os.path.abspath(
            os.path.join(self.params['rundir'],
                         self.runparams['reconstruction_working_dir']))

        ### get all stack parameters, map particles in reconstruction to particles in stack, get all model data
        self.stackdata = apStack.getOnlyStackData(self.runparams['stackid'])
        self.stackmapping = apRecon.partnum2defid(self.runparams['stackid'])
        self.modeldata = []
        if len(self.runparams['modelid'].split(",")) > 1:
            models = self.runparams['modelid'].split(",")
            for i in range(len(models)):
                self.modeldata.append(
                    appiondata.ApInitialModelData.direct_query(int(models[i])))
        else:
            self.modeldata.append(
                appiondata.ApInitialModelData.direct_query(
                    self.runparams['modelid']))

        return
	def start(self):
		"""
		this is the main component of the script
		where all the processing is done
		"""
		### initialize some variables
		self.runq = None
		self.apix = apStack.getStackPixelSizeFromStackId(self.params['stackid'])
		apDisplay.printMsg("Pixel size: %.5f"%(self.apix))
		self.boxsize = apStack.getStackBoxsize(self.params['stackid'])
		apDisplay.printMsg("Box size: %d"%(self.boxsize))

		self.checkResults()
		self.stackmapping = apRecon.partnum2defid(self.params['stackid'])
		self.numiter = self.getNumberOfIterations()
		for i in range(self.numiter):
			iternum = i+1
			apDisplay.printColor("\nUploading iteration %d of %d\n"%(iternum, self.numiter), "green")
			self.uploadIteration(iternum)

		reconrunid = apRecon.getReconRunIdFromNamePath(self.params['runname'], self.params['rundir'])
		if reconrunid:
			apDisplay.printMsg("calculating euler jumpers for recon="+str(reconrunid))
			eulerjump = apEulerJump.ApEulerJump()
			eulerjump.calculateEulerJumpsForEntireRecon(reconrunid, self.params['stackid'])
			apRecon.setGoodBadParticlesFromReconId(reconrunid)
		else:
			apDisplay.printWarning("Could not find recon run id")
    def initializeRefinementUploadVariables(self):
        """ untars results, reads required parameters, establishes necessary objects for upload script """

        apDisplay.printColor("uploading refinement results for %s reconstruction routine" % (self.package), "cyan")

        ### establish directories and make an appion results directory
        self.basepath = os.path.abspath(self.params["rundir"])
        self.resultspath = os.path.abspath(os.path.join(self.params["rundir"], str(self.package) + "_results"))
        if not os.path.isdir(self.resultspath):
            os.mkdir(self.resultspath)
        self.reconpath = os.path.abspath(
            os.path.join(self.params["rundir"], self.runparams["reconstruction_working_dir"])
        )

        ### get all stack parameters, map particles in reconstruction to particles in stack, get all model data
        self.stackdata = apStack.getOnlyStackData(self.runparams["stackid"])
        self.stackmapping = apRecon.partnum2defid(self.runparams["stackid"])
        self.modeldata = []
        if len(self.runparams["modelid"].split(",")) > 1:
            models = self.runparams["modelid"].split(",")
            for i in range(len(models)):
                self.modeldata.append(appiondata.ApInitialModelData.direct_query(int(models[i])))
        else:
            self.modeldata.append(appiondata.ApInitialModelData.direct_query(self.runparams["modelid"]))

        return
Пример #4
0
	def start(self):
		"""
		this is the main component of the script
		where all the processing is done
		"""
		### initialize some variables
		self.runq = None
		self.apix = apStack.getStackPixelSizeFromStackId(self.params['stackid'])
		apDisplay.printMsg("Pixel size: %.5f"%(self.apix))
		self.boxsize = apStack.getStackBoxsize(self.params['stackid'])
		apDisplay.printMsg("Box size: %d"%(self.boxsize))

		self.checkResults()
		self.stackmapping = apRecon.partnum2defid(self.params['stackid'])
		self.numiter = self.getNumberOfIterations()
		for i in range(self.numiter):
			iternum = i+1
			apDisplay.printColor("\nUploading iteration %d of %d\n"%(iternum, self.numiter), "green")
			self.uploadIteration(iternum)

		reconrunid = apRecon.getReconRunIdFromNamePath(self.params['runname'], self.params['rundir'])
		if reconrunid:
			apDisplay.printMsg("calculating euler jumpers for recon="+str(reconrunid))
			eulerjump = apEulerJump.ApEulerJump()
			eulerjump.calculateEulerJumpsForEntireRecon(reconrunid, self.params['stackid'])
			apRecon.setGoodBadParticlesFromReconId(reconrunid)
		else:
			apDisplay.printWarning("Could not find recon run id")
Пример #5
0
    def start(self):
        if self.params['rundir'] is None or not os.path.isdir(
                self.params['rundir']):
            apDisplay.printError("upload directory does not exist: " +
                                 str(self.params['rundir']))

        ### create temp directory for extracting data
        self.params['tmpdir'] = os.path.join(self.params['rundir'], "temp")
        apParam.createDirectory(self.params['tmpdir'], warning=True)

        ### make sure that the stack & model IDs exist in database
        emanJobFile = self.findEmanJobFile()
        self.params['stack'] = apStack.getOnlyStackData(self.params['stackid'])
        self.stackmapping = apRecon.partnum2defid(self.params['stackid'])
        self.params['model'] = appiondata.ApInitialModelData.direct_query(
            self.params['modelid'])
        self.params['boxsize'] = apStack.getStackBoxsize(
            self.params['stackid'])

        ### parse out the refinement parameters from the log file
        self.parseLogFile()

        ### parse out the message passing subclassification parameters from the job/log file
        if self.params['package'] == 'EMAN/MsgP':
            self.parseMsgPassingParams()

        ### convert class average files from old to new format
        self.convertClassAvgFiles()

        ### get a list of the files in the directory
        self.listFiles()

        ### create a refinementRun entry in the database
        self.insertRefinementRun()

        if self.params['euleronly'] is False:
            ### insert the Iteration info
            for iteration in self.iterationdatas:
                ### if only uploading one iteration, skip to that one
                if self.params['oneiter'] and int(
                        iteration['num']) != self.params['oneiter']:
                    continue
                ### if beginning at later iteration, skip to that one
                if self.params['startiter'] and int(
                        iteration['num']) < self.params['startiter']:
                    continue
                ### if beginning at later iteration, skip to that one
                if self.params['enditer'] and int(
                        iteration['num']) > self.params['enditer']:
                    continue
                apDisplay.printColor(
                    "\nUploading iteration " + str(iteration['num']) + " of " +
                    str(len(self.iterationdatas)) + "\n", "green")
                for i in range(75):
                    sys.stderr.write("#")
                sys.stderr.write("\n")
                self.insertIteration(iteration)

        ### calculate euler jumps
        if self.params['commit'] is True:
            reconrunid = self.params['refineRun'].dbid
            stackid = self.params['stack'].dbid
            if self.params['oneiter'] is None and len(self.iterationdatas) > 1:
                apDisplay.printMsg("calculating euler jumpers for recon=" +
                                   str(reconrunid))
                eulerjump = apEulerJump.ApEulerJump()
                eulerjump.calculateEulerJumpsForEntireRecon(
                    reconrunid, stackid)
            ### coran keep plot
            if self.params['package'] == 'EMAN/SpiCoran':
                apCoranPlot.makeCoranKeepPlot(reconrunid)
            apRecon.setGoodBadParticlesFromReconId(reconrunid)
	def start(self):
		if self.params['rundir'] is None or not os.path.isdir(self.params['rundir']):
			apDisplay.printError("upload directory does not exist: "+str(self.params['rundir']))


		### create temp directory for extracting data
		self.params['tmpdir'] = os.path.join(self.params['rundir'], "temp")
		apParam.createDirectory(self.params['tmpdir'], warning=True)

		### make sure that the stack & model IDs exist in database
		emanJobFile = self.findEmanJobFile()
		self.params['stack'] = apStack.getOnlyStackData(self.params['stackid'])
		self.stackmapping = apRecon.partnum2defid(self.params['stackid'])
		self.params['model'] = appiondata.ApInitialModelData.direct_query(self.params['modelid'])
		self.params['boxsize'] = apStack.getStackBoxsize(self.params['stackid'])

		### parse out the refinement parameters from the log file
		self.parseLogFile()

		### parse out the message passing subclassification parameters from the job/log file
		if self.params['package'] == 'EMAN/MsgP':
			self.parseMsgPassingParams()

		### convert class average files from old to new format
		self.convertClassAvgFiles()

		### get a list of the files in the directory
		self.listFiles()

		### create a refinementRun entry in the database
		self.insertRefinementRun()

		if self.params['euleronly'] is False:
			### insert the Iteration info
			for iteration in self.iterationdatas:
				### if only uploading one iteration, skip to that one
				if self.params['oneiter'] and int(iteration['num']) != self.params['oneiter']:
					continue
				### if beginning at later iteration, skip to that one
				if self.params['startiter'] and int(iteration['num']) < self.params['startiter']:
					continue
				### if beginning at later iteration, skip to that one
				if self.params['enditer'] and int(iteration['num']) > self.params['enditer']:
					continue
				apDisplay.printColor("\nUploading iteration "+str(iteration['num'])+" of "
					+str(len(self.iterationdatas))+"\n", "green")
				for i in range(75):
					sys.stderr.write("#")
				sys.stderr.write("\n")
				self.insertIteration(iteration)

		### calculate euler jumps
		if self.params['commit'] is True:
			reconrunid = self.params['refineRun'].dbid
			stackid = self.params['stack'].dbid
			if self.params['oneiter'] is None and len(self.iterationdatas) > 1:
				apDisplay.printMsg("calculating euler jumpers for recon="+str(reconrunid))
				eulerjump = apEulerJump.ApEulerJump()
				eulerjump.calculateEulerJumpsForEntireRecon(reconrunid, stackid)
			### coran keep plot
			if self.params['package']=='EMAN/SpiCoran':
				apCoranPlot.makeCoranKeepPlot(reconrunid)
			apRecon.setGoodBadParticlesFromReconId(reconrunid)