def insertACErunParams(self):
                # first create an aceparam object
                aceparamq = appiondata.ApAceParamsData()
                for key in aceparamq.keys():
                        if key in self.params:
                                aceparamq[key] = self.params[key]

                # if nominal df is set, save override df to database, else don't set
                if self.params['nominal']:
                        dfnom = abs(self.params['nominal'])
                        aceparamq['df_override'] = dfnom

                # create an acerun object
                self.acerunq = appiondata.ApAceRunData()
                self.acerunq['name'] = self.params['runname']
                self.acerunq['session'] = self.getSessionData()

                # see if acerun already exists in the database
                acerundatas = self.acerunq.query(results=1)
                if (acerundatas):
                        if not (acerundatas[0]['aceparams'] == aceparamq):
                                for i in acerundatas[0]['aceparams']:
                                        if acerundatas[0]['aceparams'][i] != aceparamq[i]:
                                                apDisplay.printWarning("the value for parameter '"+str(i)+"' is different from before")
                                apDisplay.printError("All parameters for a single ACE run must be identical! \n"+\
                                                          "please check your parameter settings.")

                #create path
                self.acerunq['path'] = appiondata.ApPathData(path=os.path.abspath(self.params['rundir']))
                self.acerunq['hidden'] = False
                self.acerunq['aceparams'] = aceparamq

                # if no run entry exists, insert new run entry into db
                self.acerunq.insert()
	def insertXmippCtfRun(self, imgdata):
		if isinstance(self.ctfrun, appiondata.ApAceRunData):
			return False

		# first create an aceparam object
		paramq = appiondata.ApXmippCtfParamsData()
		paramq['fieldsize'] = self.params['fieldsize']

		# create an acerun object
		runq = appiondata.ApAceRunData()
		runq['name'] = self.params['runname']
		runq['session'] = imgdata['session'];

		# see if acerun already exists in the database
		runnames = runq.query(results=1)

		if (runnames):
			if not (runnames[0]['xmipp_ctf_params'] == paramq):
				for i in runnames[0]['xmipp_ctf_params']:
					if runnames[0]['xmipp_ctf_params'][i] != paramq[i]:
						apDisplay.printWarning("the value for parameter '"+str(i)+"' is different from before")
				apDisplay.printError("All parameters for a single CTF estimation run must be identical! \n"+\
						     "please check your parameter settings.")
			self.ctfrun = runnames[0]
			return False

		#create path
		runq['path'] = appiondata.ApPathData(path=os.path.abspath(self.params['rundir']))
		runq['hidden'] = False
		# if no run entry exists, insert new run entry into db
		runq['xmipp_ctf_params'] = paramq
		runq.insert()
		self.ctfrun = runq
		return True
def getNumCtfRunsFromSession(sessionname):
    sessiondata = apDatabase.getSessionDataFromSessionName(sessionname)
    ctfrunq = appiondata.ApAceRunData()
    ctfrunq['session'] = sessiondata
    ctfrundatas = ctfrunq.query()
    if not ctfrundatas:
        return 0
    return len(ctfrundatas)
示例#4
0
 def insertRunData(self):
     runq = appiondata.ApAceRunData()
     runq['name'] = self.params['runname']
     runq['session'] = self.getSessionData()
     runq['hidden'] = False
     runq['path'] = appiondata.ApPathData(
         path=os.path.abspath(self.params['rundir']))
     runq.insert()
     self.ctfrundata = runq
    def insertCtfRun(self, imgdata):
        if isinstance(self.ctfrun, appiondata.ApAceRunData):
            return False

        # first create an aceparam object
        paramq = appiondata.ApCtfFind4ParamsData()
        copyparamlist = (
            'ampcontrast',
            'fieldsize',
            'cs',
            'bestdb',
            'resmin',
            'defstep',
        )
        for p in copyparamlist:
            if p in self.params:
                paramq[p] = self.params[p]

        # create an acerun object
        runq = appiondata.ApAceRunData()
        runq['name'] = self.params['runname']
        runq['session'] = imgdata['session']

        # see if acerun already exists in the database
        runnames = runq.query(results=1)

        if (runnames):
            prevrun = runnames[0]
            if not (prevrun['ctffind4_params'] == paramq):
                for i in prevrun['ctffind4_params']:
                    if prevrun['ctffind4_params'][i] != paramq[i]:
                        # float value such as cs of 4.1 is not quite equal
                        if type(paramq[i]) == type(
                                1.0) and abs(prevrun['ctffind4_params'][i] -
                                             paramq[i]) < 0.00001:
                            continue
                        apDisplay.printWarning("the value for parameter '" +
                                               str(i) +
                                               "' is different from before")
                        apDisplay.printError("All parameters for a single CTF estimation run must be identical! \n"+\
                             "please check your parameter settings.")
            self.ctfrun = prevrun
            return False

        #create path
        runq['path'] = appiondata.ApPathData(
            path=os.path.abspath(self.params['rundir']))
        runq['hidden'] = False
        # if no run entry exists, insert new run entry into db
        runq['ctffind4_params'] = paramq
        runq.insert()
        self.ctfrun = runq
        return True
    def insertCtfTiltRun(self, imgdata):
        if isinstance(self.ctfrun, appiondata.ApAceRunData):
            return False

        # first create an aceparam object
        paramq = appiondata.ApCtfTiltParamsData()
        copyparamlist = ('medium', 'ampcarbon', 'ampice', 'fieldsize', 'cs',
                         'bin', 'resmin', 'resmax', 'defstep', 'dast')
        for p in copyparamlist:
            if p in self.params:
                paramq[p] = self.params[p]

        # create an acerun object
        runq = appiondata.ApAceRunData()
        runq['name'] = self.params['runname']
        runq['session'] = imgdata['session']

        # see if acerun already exists in the database
        runnames = runq.query(results=1)

        if (runnames):
            if not (runnames[0]['ctftilt_params'] == paramq):
                for i in runnames[0]['ctftilt_params']:
                    if runnames[0]['ctftilt_params'][i] != paramq[i]:
                        apDisplay.printWarning("the value for parameter '" +
                                               str(i) +
                                               "' is different from before")
                apDisplay.printError("All parameters for a single CTF estimation run must be identical! \n"+\
                                     "please check your parameter settings.")
            self.ctfrun = runnames[0]
            return False

        #create path
        runq['path'] = appiondata.ApPathData(
            path=os.path.abspath(self.params['rundir']))
        runq['hidden'] = False
        # if no run entry exists, insert new run entry into db
        runq['ctftilt_params'] = paramq
        runq.insert()
        self.ctfrun = runq
        return True
示例#7
0
    def insertRunData(self):
        paramq = appiondata.ApAce2ParamsData()
        paramq['bin'] = self.params['bin']
        paramq['reprocess'] = self.params['reprocess']
        paramq['cs'] = self.params['cs']
        paramq['stig'] = True
        paramq['min_defocus'] = self.params['mindefocus']
        paramq['max_defocus'] = self.params['maxdefocus']
        paramq['edge_thresh'] = self.params['edge_t']
        paramq['edge_blur'] = self.params['edge_b']
        paramq['rot_blur'] = self.params['rotblur']
        paramq['refine2d'] = self.params['refine2d']
        paramq['onepass'] = self.params['onepass']
        paramq['zeropass'] = self.params['zeropass']

        runq = appiondata.ApAceRunData()
        runq['name'] = self.params['runname']
        runq['session'] = self.getSessionData()
        runq['hidden'] = False
        runq['path'] = appiondata.ApPathData(
            path=os.path.abspath(self.params['rundir']))
        runq['ace2_params'] = paramq
        runq.insert()
        self.ctfrundata = runq