Exemplo n.º 1
0
    def loadInputs(self):
        micsFn = self.getInputMicrographs().getFileName()
        micsSet = SetOfMicrographs(filename=micsFn)
        micsSet.loadAllProperties()

        availableMics = []
        for mic in micsSet:
            availableMics.append(mic.getObjId())

        micsSetClosed = micsSet.isStreamClosed()
        micsSet.close()

        partsFn = self.getInputParticles().getFileName()
        partsSet = SetOfParticles(filename=partsFn)
        partsSet.loadAllProperties()

        newParts = []
        newMics = []
        for item in partsSet:
            micKey = item.getCoordinate().getMicId()
            if micKey not in self.micsDone and micKey in availableMics:
                newParts.append(item.getObjId())
                if not micKey in self.micsDone:
                    newMics.append(micKey)
        self.micsDone += newMics
        self.inputSize = partsSet.getSize()
        partSetClosed = partsSet.isStreamClosed()
        partsSet.close()

        return newParts, micsSetClosed and partSetClosed
 def _checkNewInput(self):
     # Check if there are new micrographs to process from the input set
     micsFile = self.inputMicrographs.get().getFileName()
     micsSet = SetOfMicrographs(filename=micsFile)
     micsSet.loadAllProperties()
     self.SetOfMicrographs = [m.clone() for m in micsSet]
     self.streamClosed = micsSet.isStreamClosed()
     micsSet.close()
     newMics = any(m.getObjId() not in self.insertedDict
                   for m in self.inputMics)
     outputStep = self._getFirstJoinStep()
     if newMics:
         fDeps = self._insertNewMicsSteps(self.insertedDict, self.inputMics)
         if outputStep is not None:
             outputStep.addPrerequisites(*fDeps)
         self.updateSteps()
Exemplo n.º 3
0
    def _stepsCheck(self):
        # For now the streaming is not allowed for recalculate CTF
        if self.recalculate:
            return

        # Check if there are new micrographs to process
        micFn = self.inputMicrographs.get().getFileName()
        micSet = SetOfMicrographs(filename=micFn)
        micSet.loadAllProperties()
        streamClosed = micSet.isStreamClosed()

        outputStep = self._getFirstJoinStep()
        self._checkNewMicrographs(micSet, outputStep)
        ctfSet, newCTFs = self._checkNewCTFs(micSet)

        if ctfSet is None:
            return

        endCTFs = streamClosed and micSet.getSize() == ctfSet.getSize()
        if newCTFs:
            # Check if it is the first time we are registering CTF to
            # create the CTF_RELATION only once
            firstTime = not self.hasAttribute('outputCTF')
            ctfSet.setMicrographs(self.inputMics)
            self._computeDefocusRange(ctfSet)
            streamMode = ctfSet.STREAM_CLOSED if endCTFs else ctfSet.STREAM_OPEN
            self._updateOutputSet('outputCTF', ctfSet, streamMode)
            if firstTime:  # define relation just once
                self._defineCtfRelation(self.inputMics, ctfSet)
        else:
            ctfSet.close()

        if outputStep and outputStep.isWaiting() and endCTFs:
            outputStep.setStatus(STATUS_NEW)

        micSet.close()