Ejemplo n.º 1
0
    def _fillVolSetFromIter(self, volSet, rLev=None, it=None):
        it = self._lastIter() if it is None else it
        rLev = self._rLev if rLev is None else rLev
        volSet.setSamplingRate(self._getInputParticles().getSamplingRate())
        modelFn = self._getFileName('model', ruNum=rLev, iter=it)
        print('modelFn: ', modelFn)
        modelStar = md.MetaData('model_classes@' + modelFn)
        idList = []
        volFnList = []
        clsDistList = []
        accRotList = []
        accTransList = []
        resoList = []

        for row in md.iterRows(modelStar):
            accurracyRot = row.getValue('rlnAccuracyRotations')
            if accurracyRot <= 90:
                fn = row.getValue('rlnReferenceImage')
                print('Volume: ', fn)
                fnMrc = fn + ":mrc"
                itemId = self._getClassId(fn)
                classDistrib = row.getValue('rlnClassDistribution')
                accurracyTras = row.getValue('rlnAccuracyTranslations')
                resol = row.getValue('rlnEstimatedResolution')

                idList.append(itemId)
                volFnList.append(fnMrc)
                clsDistList.append(classDistrib)
                accRotList.append(accurracyRot)
                accTransList.append(accurracyTras)
                resoList.append(resol)
        std = self.std if hasattr(self, 'std') else None
        score = self._estimateScore(accRotList, clsDistList, None, std)
        threshold = 1 / float(self.numOfVols.get())
        print("score: ", score)

        for i, s in enumerate(score):
            vol = Volume()
            self._invertScaleVol(volFnList[i])
            vol.setFileName(self._getOutputVolFn(volFnList[i]))
            vol.setObjId(idList[i])
            if s <= threshold:
                vol._objEnabled = False
            vol._cmScore = pwObj.Float(s)
            vol._rlnClassDistribution = Float(clsDistList[i])
            vol._rlnAccuracyRotations = Float(accRotList[i])
            vol._rlnAccuracyTranslations = Float(accTransList[i])
            vol._rlnEstimatedResolution = Float(resoList[i])
            volSet.append(vol)
    def _fillVolSetFromIter(self, volSet, it):
        volSet.setSamplingRate(self._getInputParticles().getSamplingRate())
        modelStar = md.MetaData('model_classes@' +
                                self._getFileName('model', iter=it))
        for row in md.iterRows(modelStar):
            fn = row.getValue('rlnReferenceImage')
            fnMrc = fn + ":mrc"
            itemId = self._getClassId(fn)
            classDistrib = row.getValue('rlnClassDistribution')
            accurracyRot = row.getValue('rlnAccuracyRotations')
            accurracyTras = row.getValue('rlnAccuracyTranslations')
            resol = row.getValue('rlnEstimatedResolution')

            if classDistrib > 0:
                vol = Volume()
                self._invertScaleVol(fnMrc)
                vol.setFileName(self._getOutputVolFn(fnMrc))
                vol.setObjId(itemId)
                vol._rlnClassDistribution = Float(classDistrib)
                vol._rlnAccuracyRotations = Float(accurracyRot)
                vol._rlnAccuracyTranslations = Float(accurracyTras)
                vol._rlnEstimatedResolution = Float(resol)
                volSet.append(vol)