当前位置: 首页>>代码示例>>Python>>正文


Python metadata.iterRows函数代码示例

本文整理汇总了Python中pyworkflow.em.metadata.iterRows函数的典型用法代码示例。如果您正苦于以下问题:Python iterRows函数的具体用法?Python iterRows怎么用?Python iterRows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了iterRows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: createOutputStep

    def createOutputStep(self):
        outputVols = self._createSetOfVolumes()
        imgSet = self.inputParticles.get()
        for i, vol in enumerate(self._iterInputVols()):
            volume = vol.clone()
            volDir = self._getVolDir(i + 1)
            volPrefix = "vol%03d_" % (i + 1)
            validationMd = self._getExtraPath(volPrefix + "validation.xmd")
            moveFile(join(volDir, "validation.xmd"), validationMd)
            clusterMd = self._getExtraPath(volPrefix + "clusteringTendency.xmd")
            moveFile(join(volDir, "clusteringTendency.xmd"), clusterMd)

            outImgSet = self._createSetOfParticles(volPrefix)

            outImgSet.copyInfo(imgSet)

            outImgSet.copyItems(
                imgSet,
                updateItemCallback=self._setWeight,
                itemDataIterator=md.iterRows(clusterMd, sortByLabel=md.MDL_ITEM_ID),
            )

            mdValidatoin = md.MetaData(validationMd)
            weight = mdValidatoin.getValue(md.MDL_WEIGHT, mdValidatoin.firstObject())
            volume.weight = Float(weight)
            volume.clusterMd = String(clusterMd)
            volume.cleanObjId()  # clean objects id to assign new ones inside the set
            outputVols.append(volume)
            self._defineOutputs(outputParticles=outImgSet)

        outputVols.setSamplingRate(volume.getSamplingRate())
        self._defineOutputs(outputVolumes=outputVols)
开发者ID:azazellochg,项目名称:scipion,代码行数:32,代码来源:protocol_multireference_alignability.py

示例2: createOutputStep

    def createOutputStep(self):
        fnImgs = self._getExtraPath('images.stk')
        if os.path.exists(fnImgs):
            cleanPath(fnImgs)

        outputSet = self._createSetOfParticles()
        imgSet = self.inputSet.get()
        imgFn = self._getExtraPath("anglesCont.xmd")
        self.newAssignmentPerformed = os.path.exists(self._getExtraPath("angles.xmd"))
        self.samplingRate = self.inputSet.get().getSamplingRate()
        if isinstance(imgSet, SetOfClasses2D):
            outputSet = self._createSetOfClasses2D(imgSet)
            outputSet.copyInfo(imgSet.getImages())
        elif isinstance(imgSet, SetOfAverages):
            outputSet = self._createSetOfAverages()
            outputSet.copyInfo(imgSet)
        else:
            outputSet = self._createSetOfParticles()
            outputSet.copyInfo(imgSet)
            if not self.newAssignmentPerformed:
                outputSet.setAlignmentProj()
        outputSet.copyItems(imgSet,
                            updateItemCallback=self._processRow,
                            itemDataIterator=md.iterRows(imgFn, sortByLabel=md.MDL_ITEM_ID))
        self._defineOutputs(outputParticles=outputSet)
        self._defineSourceRelation(self.inputSet, outputSet)
开发者ID:I2PC,项目名称:scipion,代码行数:26,代码来源:protocol_compare_reprojections.py

示例3: _fillClassesFromIter

 def _fillClassesFromIter(self, clsSet, iteration):
     """ Create the SetOfClasses3D from a given iteration. """
     self._loadClassesInfo(iteration)
     dataStar = self._getFileName('data', iter=iteration)
     clsSet.classifyItems(updateItemCallback=self._updateParticle,
                          updateClassCallback=self._updateClass,
                          itemDataIterator=md.iterRows(dataStar, sortByLabel=md.RLN_IMAGE_ID))
开发者ID:azazellochg,项目名称:scipion,代码行数:7,代码来源:protocol_classify3d.py

示例4: _fillDataFromIter

 def _fillDataFromIter(self, imgSet, iteration):
     outImgsFn = self._getFileName('data', iter=iteration)
     imgSet.setAlignmentProj()
     imgSet.copyItems(self._getInputParticles(),
                      updateItemCallback=self._createItemMatrix,
                      itemDataIterator=md.iterRows(outImgsFn,
                                                   sortByLabel=md.RLN_IMAGE_ID))
开发者ID:I2PC,项目名称:scipion,代码行数:7,代码来源:protocol_refine3d.py

示例5: createOutputStep

    def createOutputStep(self):
        particles = self.inputParticles.get()

        # Generate the SetOfAlignmet
        alignedSet = self._createSetOfParticles()
        alignedSet.copyInfo(particles)

        inputMd = self._getPath('aligned_particles.xmd')
        alignedSet.copyItems(particles,
                             updateItemCallback=self._updateItem,
                             itemDataIterator=md.iterRows(inputMd, sortByLabel=md.MDL_ITEM_ID))
        # Remove alignment 2D
        alignedSet.setAlignment(em.ALIGN_NONE)

        # Define the output average

        avgFile = self._getExtraPath("average.xmp")

        imgh = ImageHandler()
        avgImage = imgh.computeAverage(alignedSet)

        avgImage.write(avgFile)

        avg = em.Particle()
        avg.setLocation(1, avgFile)
        avg.copyInfo(alignedSet)

        self._defineOutputs(outputAverage=avg)
        self._defineSourceRelation(self.inputParticles, avg)

        self._defineOutputs(outputParticles=alignedSet)
        self._defineSourceRelation(self.inputParticles, alignedSet)
开发者ID:coocoky,项目名称:scipion,代码行数:32,代码来源:protocol_apply_alignment.py

示例6: readCoordinates

def readCoordinates(mic, fileName, coordsSet):
    for row in md.iterRows(fileName):
        coord = rowToCoordinate(row)
        coord.setX(coord.getX())
        coord.setY(coord.getY())
        coord.setMicrograph(mic)
        coordsSet.append(coord)
开发者ID:azazellochg,项目名称:scipion,代码行数:7,代码来源:convert.py

示例7: createOutputStep

    def createOutputStep(self):
        micSet = self.getInputMicrographs()
        outputCoordinatesName = 'outputCoordinates'
        outputSuffix = ''

        # If in optimization phase, let's create a subset of the micrographs
        if self.isRunOptimize():
            outputSuffix = '_subset'
            outputCoordinatesName = 'outputCoordinatesSubset'
            micSubSet = self._createSetOfMicrographs(suffix=outputSuffix)
            micSubSet.copyInfo(micSet)
            # Use previously written star file for reading the subset of micrographs,
            for row in md.iterRows(self._getPath('input_micrographs.star')):
                mic = micSet[row.getValue('rlnImageId')]
                micSubSet.append(mic)
            self._defineOutputs(outputMicrographsSubset=micSubSet)
            self._defineTransformRelation(self.getInputMicrographsPointer(),
                                          micSubSet)
            micSet = micSubSet

        coordSet = self._createSetOfCoordinates(micSet)
        template = self._getExtraPath("%s_autopick.star")
        starFiles = [template % pwutils.removeBaseExt(mic.getFileName())
                     for mic in micSet]
        readSetOfCoordinates(coordSet, starFiles, micSet)

        self._defineOutputs(**{outputCoordinatesName: coordSet})
        self._defineSourceRelation(self.getInputMicrographsPointer(),
                                   coordSet)
开发者ID:I2PC,项目名称:scipion,代码行数:29,代码来源:protocol_autopick_v2.py

示例8: _fillClassesFromIter

 def _fillClassesFromIter(self, clsSet, iteration):
     """ Create the SetOfClasses2D from a given iteration. """
     self._loadClassesInfo(self._getIterMdClasses(iteration))
     dataXmd = self._getIterMdImages(iteration)
     clsSet.classifyItems(updateItemCallback=self._updateParticle,
                          updateClassCallback=self._updateClass,
                          itemDataIterator=md.iterRows(dataXmd,
                                                       sortByLabel=md.MDL_ITEM_ID))
开发者ID:I2PC,项目名称:scipion,代码行数:8,代码来源:protocol_ml2d.py

示例9: readCoordinates

def readCoordinates(mic, fileName, coordsSet):
    if os.path.exists(fileName):
        mdCoords = md.MetaData()
        mdCoords.readPlain(fileName, "xcoor ycoor xSize ySize")
        for row in md.iterRows(mdCoords):
            coord = em.Coordinate(x = row.getValue("xcoor") + row.getValue("xSize")/2,
                                  y = row.getValue("ycoor") + row.getValue("ySize")/2)
            coord.setMicrograph(mic)
            coordsSet.append(coord)
开发者ID:I2PC,项目名称:scipion,代码行数:9,代码来源:convert.py

示例10: createOutputStep

 def createOutputStep(self):
     imgSet = self.inputParticles.get()
     partSet = self._createSetOfParticles()
     partSet.copyInfo(imgSet)
     partSet.copyItems(imgSet,
                       updateItemCallback=self._createItemMatrix,
                       itemDataIterator=md.iterRows(self.outputMd.get(), sortByLabel=md.MDL_ITEM_ID))
     
     self._defineOutputs(outputParticles=partSet)
     self._defineSourceRelation(imgSet, partSet)
开发者ID:azazellochg,项目名称:scipion,代码行数:10,代码来源:protocol_break_symmetry.py

示例11: _fillParticlesFromIter

 def _fillParticlesFromIter(self, partSet, iteration):
     import pyworkflow.em.metadata as md
     
     imgSet = self.inputParticles.get()
     imgFn = "[email protected]" + self._getFileName('docfileInputAnglesIters', iter=iteration, ref=1)
     partSet.copyInfo(imgSet)
     partSet.setAlignmentProj()
     partSet.copyItems(imgSet,
                         updateItemCallback=self._createItemMatrix,
                         itemDataIterator=md.iterRows(imgFn, sortByLabel=md.MDL_ITEM_ID))
开发者ID:azazellochg,项目名称:scipion,代码行数:10,代码来源:protocol_projmatch.py

示例12: runCreateOutputStep

def runCreateOutputStep(self):
    import pyworkflow.em.metadata as md
    ''' Create standard output results_images, result_classes'''
    #creating results files
    imgSet = self.inputParticles.get()
    lastIter = self.numberOfIterations.get()
    if self.numberOfReferences != 1:
        inDocfile = self._getFileName('docfileInputAnglesIters', iter=lastIter)
        ClassFnTemplate = '%(rootDir)s/reconstruction_Ref3D_%(ref)03d.vol'
        
        allExpImagesinDocfile = xmipp.FileName()
        all_exp_images="all_exp_images"
        allExpImagesinDocfile.compose(all_exp_images, inDocfile)
        
        dataClasses = self._getFileName('sqliteClasses')
        
        createClassesFromImages(imgSet, str(allExpImagesinDocfile), dataClasses, 
                                SetOfClasses3D, xmipp.MDL_REF3D, ClassFnTemplate, lastIter)
        
        classes = self._createSetOfClasses3D(imgSet)
        clsSet = SetOfClasses3D(dataClasses)
        classes.appendFromClasses(clsSet)
        
        volumes = self._createSetOfVolumes()
        volumes.setSamplingRate(imgSet.getSamplingRate())
        
        for refN in self.allRefs():
            volFn = self._getFileName('reconstructedFileNamesIters', iter=lastIter, ref=refN)
            vol = Volume()
            vol.setFileName(volFn)
            volumes.append(vol)
    
        self._defineOutputs(outputVolumes=volumes)
        self._defineOutputs(outputClasses=classes)
        self._defineSourceRelation(self.inputParticles, volumes)
        self._defineSourceRelation(self.inputParticles, classes)
    else:
        volFn = self._getFileName('reconstructedFileNamesIters', iter=lastIter, ref=1)
        vol = Volume()
        vol.setFileName(volFn)
        vol.setSamplingRate(imgSet.getSamplingRate())
        self._defineOutputs(outputVolume=vol)
        self._defineSourceRelation(self.inputParticles, vol)
        
        #create set of images
        imgSetOut = self._createSetOfParticles()
        imgFn = "[email protected]" + self._getFileName('docfileInputAnglesIters', iter=lastIter, ref=1)
        
        imgSetOut.copyInfo(imgSet)
        imgSetOut.setAlignmentProj()
        imgSetOut.copyItems(imgSet,
                            updateItemCallback=self._createItemMatrix,
                            itemDataIterator=md.iterRows(imgFn))
        self._defineOutputs(outputParticles=imgSetOut)
        self._defineSourceRelation(self.inputParticles, imgSetOut)
开发者ID:denisfortun,项目名称:scipion,代码行数:55,代码来源:projmatch_steps.py

示例13: createOutputStep

 def createOutputStep(self):
     imgSet = self._getInputParticles()
     outImgSet = self._createSetOfParticles()
     outImgsFn = self._getFileName('output_star')
      
     outImgSet.copyInfo(imgSet)
     outImgSet.setAlignmentProj()
     outImgSet.copyItems(imgSet,
                         updateItemCallback=self._updateItem,
                         itemDataIterator=md.iterRows(outImgsFn))
     self._defineOutputs(outputParticles=outImgSet)
     self._defineTransformRelation(imgSet, outImgSet)
开发者ID:I2PC,项目名称:scipion,代码行数:12,代码来源:protocol_subtract.py

示例14: createOutputStep

 def createOutputStep(self):
     imgSet = self.inputParticles.get()
     partSet = self._createSetOfParticles()
     imgFn = self._getPath('corrected_ctf_particles.xmd')
     
     partSet.copyInfo(imgSet)
     partSet.copyItems(imgSet,
                         updateItemCallback=self._updateLocation,
                         itemDataIterator=md.iterRows(imgFn, sortByLabel=md.MDL_ITEM_ID))
     
     self._defineOutputs(outputParticles=partSet)
     self._defineSourceRelation(imgSet, partSet)
开发者ID:coocoky,项目名称:scipion,代码行数:12,代码来源:protocol_ctf_correct_wiener2d.py

示例15: createOutputStep

 def createOutputStep(self):
     inputSet = self.inputParticles.get()
     partSet = self._createSetOfParticles()
     pdbPointer = self.inputModes.get()._pdbPointer
     
     partSet.copyInfo(inputSet)
     partSet.copyItems(inputSet,
                       updateItemCallback=self._updateParticle,
                       itemDataIterator=md.iterRows(self.imgsFn, sortByLabel=md.MDL_ITEM_ID))
     
     self._defineOutputs(outputParticles=partSet)
     self._defineSourceRelation(pdbPointer, partSet)
     self._defineTransformRelation(self.inputParticles, partSet)
开发者ID:I2PC,项目名称:scipion,代码行数:13,代码来源:protocol_nma_alignment.py


注:本文中的pyworkflow.em.metadata.iterRows函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。