def _argsCtffind4(self): # Avoid threads multiplication # self._program = 'export OMP_NUM_THREADS=%d; ' % self.numberOfThreads.get() self._program = 'export OMP_NUM_THREADS=1; ' self._program += CTFFIND4_PATH self._args = """ << eof %(micFn)s %(ctffindPSD)s %(sampling)f %(voltage)f %(sphericalAberration)f %(ampContrast)f %(windowSize)d %(lowRes)f %(highRes)f %(minDefocus)f %(maxDefocus)f %(step_focus)f""" if getVersion(CTFFIND4_APP) in ['4.1.5', '4.1.8', V4_1_10]: if self.findPhaseShift: self._args += """ no %(slowSearch)s yes %(astigmatism)f %(phaseShift)s %(minPhaseShift)f %(maxPhaseShift)f %(stepPhaseShift)f yes %(resamplePix)s eof """ else: self._args += """ no %(slowSearch)s yes %(astigmatism)f %(phaseShift)s yes %(resamplePix)s eof """ elif getVersion(CTFFIND4_APP) == V4_0_15: if self.findPhaseShift: self._args += """ %(astigmatism)f %(phaseShift)s %(minPhaseShift)f %(maxPhaseShift)f %(stepPhaseShift)f eof """ else: self._args += """
def _summary(self): summary = em.ProtCTFMicrographs._summary(self) if self.useCtffind4 and getVersion('CTFFIND4') == '4.1.5': summary.append("NOTE: ctffind4.1.5 finishes correctly (all output " "is generated properly), but returns an error code. " "Disregard error messages until this is fixed." "http://grigoriefflab.janelia.org/node/5421") return summary
def _isNewUnblur(self): return True if getVersion('UNBLUR') != '1.0.150529' else False
def _argsUnblur(self, movie, numberOfFrames): """ Format argument for call unblur program. """ args = { 'movieName': self._getMovieFn(movie), 'numberOfFramesPerMovie': numberOfFrames, 'micFnName': self._getMicFn(movie), 'shiftFnName': self._getShiftsFn(movie), 'samplingRate': self.samplingRate, 'voltage': movie.getAcquisition().getVoltage(), 'frcFn': self._getFrcFn(movie), 'bfactor': self.bfactor.get(), 'minShiftInitSearch': self.minShiftInitSearch.get(), 'OutRadShiftLimit': self.OutRadShiftLimit.get(), 'HWVertFourMask': self.HWVertFourMask.get(), 'HWHoriFourMask': self.HWHoriFourMask.get(), 'terminShiftThreshold': self.terminShiftThreshold.get(), 'maximumNumberIterations': self.maximumNumberIterations.get(), 'doApplyDoseFilter': 'YES' if self.doApplyDoseFilter else 'NO', 'doRestoreNoisePwr': 'YES' if self.doRestoreNoisePwr else 'NO', 'doVerboseOutput': 'YES' if self.doVerboseOutput else 'NO', 'exposurePerFrame': movie.getAcquisition().getDosePerFrame() or 0.0 } # Avoid threads multiplication # self._program = 'export OMP_NUM_THREADS=%d; ' % self.numberOfThreads.get() self._program = 'export OMP_NUM_THREADS=%d; ' % self.openmpThreads self._program += UNBLUR_PATH if getVersion('UNBLUR') != '1.0_150529': args['preExposureAmount'] = movie.getAcquisition().getDoseInitial( ) or 0.0 self._args = """ << eof %(movieName)s %(numberOfFramesPerMovie)s %(micFnName)s %(shiftFnName)s %(samplingRate)f %(doApplyDoseFilter)s %(exposurePerFrame)f %(voltage)f %(preExposureAmount)f NO YES %(frcFn)s %(minShiftInitSearch)f %(OutRadShiftLimit)f %(bfactor)f %(HWVertFourMask)d %(HWHoriFourMask)d %(terminShiftThreshold)f %(maximumNumberIterations)d %(doRestoreNoisePwr)s %(doVerboseOutput)s eof """ % args else: self._args = """ << eof %(movieName)s %(numberOfFramesPerMovie)s %(micFnName)s %(shiftFnName)s %(samplingRate)f %(doApplyDoseFilter)s %(exposurePerFrame)f %(voltage)f YES %(frcFn)s %(minShiftInitSearch)f %(OutRadShiftLimit)f %(bfactor)f %(HWVertFourMask)d %(HWHoriFourMask)d %(terminShiftThreshold)f %(maximumNumberIterations)d %(doRestoreNoisePwr)s %(doVerboseOutput)s eof """ % args
def _isNewCtffind4(self): return self.useCtffind4 and getVersion('CTFFIND4') != V4_0_15
def _argsUnblur(self, movie, numberOfFrames): """ Format argument for call unblur program. """ args = {'movieName': self._getMovieFn(movie), 'numberOfFramesPerMovie': numberOfFrames, 'micFnName': self._getMicFn(movie), 'shiftFnName': self._getShiftsFn(movie), 'samplingRate': self.samplingRate, 'voltage': movie.getAcquisition().getVoltage(), 'frcFn': self._getFrcFn(movie), 'bfactor': self.bfactor.get(), 'minShiftInitSearch': self.minShiftInitSearch.get(), 'OutRadShiftLimit': self.OutRadShiftLimit.get(), 'HWVertFourMask': self.HWVertFourMask.get(), 'HWHoriFourMask': self.HWHoriFourMask.get(), 'terminShiftThreshold': self.terminShiftThreshold.get(), 'maximumNumberIterations': self.maximumNumberIterations.get(), 'doApplyDoseFilter': 'YES' if self.doApplyDoseFilter else 'NO', 'doRestoreNoisePwr': 'YES' if self.doRestoreNoisePwr else 'NO', 'doVerboseOutput': 'YES' if self.doVerboseOutput else 'NO', 'exposurePerFrame': movie.getAcquisition().getDosePerFrame() or 0.0 } # Avoid threads multiplication # self._program = 'export OMP_NUM_THREADS=%d; ' % self.numberOfThreads.get() self._program = 'export OMP_NUM_THREADS=%d; ' % self.openmpThreads self._program += UNBLUR_PATH if getVersion('UNBLUR') != '1.0_150529': args['preExposureAmount'] = movie.getAcquisition().getDoseInitial() or 0.0 self._args = """ << eof %(movieName)s %(numberOfFramesPerMovie)s %(micFnName)s %(shiftFnName)s %(samplingRate)f %(doApplyDoseFilter)s %(exposurePerFrame)f %(voltage)f %(preExposureAmount)f NO YES %(frcFn)s %(minShiftInitSearch)f %(OutRadShiftLimit)f %(bfactor)f %(HWVertFourMask)d %(HWHoriFourMask)d %(terminShiftThreshold)f %(maximumNumberIterations)d %(doRestoreNoisePwr)s %(doVerboseOutput)s eof """ % args else: self._args = """ << eof %(movieName)s %(numberOfFramesPerMovie)s %(micFnName)s %(shiftFnName)s %(samplingRate)f %(doApplyDoseFilter)s %(exposurePerFrame)f %(voltage)f YES %(frcFn)s %(minShiftInitSearch)f %(OutRadShiftLimit)f %(bfactor)f %(HWVertFourMask)d %(HWHoriFourMask)d %(terminShiftThreshold)f %(maximumNumberIterations)d %(doRestoreNoisePwr)s %(doVerboseOutput)s eof """ % args
def _isNewCtffind4(self): if self.useCtffind4 and getVersion('CTFFIND4') != '4.0.15': return True else: return False