def _getCTFModel(self, defocusU, defocusV, defocusAngle, resol, psdFile): ctf = CTFModel() ctf.setStandardDefocus(defocusU, defocusV, defocusAngle) ctf.setResolution(resol) ctf.setPsdFile(psdFile) return ctf
def importCTF(self, mic, fileName): defocusU, defocusV, defocusAngle = parseCtffindOutput(fileName) ctf = CTFModel() ctf.copyObjId(mic) ctf.setStandardDefocus(defocusU, defocusV, defocusAngle) ctf.setMicrograph(mic) ctf.setPsdFile(removeExt(fileName) + "_psd.mrc") return ctf
def importCtfStep(self, micsId, pattern): """ Copy movies matching the filename pattern Register other parameters. """ inputMics = self.inputMicrographs.get() ctfSet = self._createSetOfCTF() ctfSet.setMicrographs(inputMics) ctfFiles = self._getFilePaths(pattern) ctfDict = {} for fn in ctfFiles: # Try to match the micrograph id from filename # this is set by the user by using #### format in the pattern match = self._idRegex.match(fn) if match is None: raise Exception("File '%s' doesn't match the pattern '%s'" % (fn, self.pattern.get())) ctfId = int(match.group(1)) ctfDict[ctfId] = fn from pyworkflow.em.packages.grigoriefflab.convert import parseCtffindOutput for mic in inputMics: if mic.getObjId() in ctfDict: defocusU, defocusV, defocusAngle = parseCtffindOutput( ctfDict[mic.getObjId()]) else: self.warning("CTF for micrograph id %d was not found." % mic.getObjId()) defocusU, defocusV, defocusAngle = -999, -1, -999 # save the values of defocus for each micrograph in a list ctf = CTFModel() ctf.copyObjId(mic) ctf.setStandardDefocus(defocusU, defocusV, defocusAngle) ctf.setMicrograph(mic) ctfSet.append(ctf) self._defineOutputs(outputCTF=ctfSet) self._defineCtfRelation(inputMics, ctfSet)
def importCtfStep(self, micsId, pattern): """ Copy movies matching the filename pattern Register other parameters. """ inputMics = self.inputMicrographs.get() ctfSet = self._createSetOfCTF() ctfSet.setMicrographs(inputMics) ctfFiles = self._getFilePaths(pattern) ctfDict = {} for fn in ctfFiles: # Try to match the micrograph id from filename # this is set by the user by using #### format in the pattern match = self._idRegex.match(fn) if match is None: raise Exception("File '%s' doesn't match the pattern '%s'" % (fn, self.pattern.get())) ctfId = int(match.group(1)) ctfDict[ctfId] = fn from pyworkflow.em.packages.grigoriefflab.convert import parseCtffindOutput for mic in inputMics: if mic.getObjId() in ctfDict: defocusU, defocusV, defocusAngle = parseCtffindOutput(ctfDict[mic.getObjId()]) else: self.warning("CTF for micrograph id %d was not found." % mic.getObjId()) defocusU, defocusV, defocusAngle = -999, -1, -999 # save the values of defocus for each micrograph in a list ctf = CTFModel() ctf.copyObjId(mic) ctf.setStandardDefocus(defocusU, defocusV, defocusAngle) ctf.setMicrograph(mic) ctfSet.append(ctf) self._defineOutputs(outputCTF=ctfSet) self._defineCtfRelation(inputMics, ctfSet)
def _getCTFModel(self, defocusU, defocusV, defocusAngle, psdFile): ctf = CTFModel() ctf.setStandardDefocus(defocusU, defocusV, defocusAngle) ctf.setPsdFile(psdFile) return ctf