예제 #1
0
    def _displayAngDist(self, *args):
        #print "_displayAngDist...."
        iterations = self._getIterations()
        nparts = self.protocol.inputParticles.get().getSize()
        views = []

        if self.displayAngDist == ANGDIST_2DPLOT:
            #print " self.displayAngDist == ANGDIST_2DPLO "
            for it in iterations:
                anglesSqlite = self._getFinalPath('angular_dist_%03d.sqlite' %
                                                  it)
                title = 'Angular distribution iter %03d' % it
                plotter = EmPlotter(x=1, y=1, windowTitle=title)
                self.createAngDistributionSqlite(
                    anglesSqlite,
                    nparts,
                    itemDataIterator=self._iterAngles(it))
                plotter.plotAngularDistributionFromMd(anglesSqlite, title)
                views.append(plotter)
        else:
            it = iterations[-1]
            print "Using last iteration: ", it
            anglesSqlite = self._getFinalPath('angular_dist_%03d.sqlite' % it)
            self.createAngDistributionSqlite(
                anglesSqlite, nparts, itemDataIterator=self._iterAngles(it))
            volumes = self.getVolumeNames(it)
            views.append(
                em.ChimeraClientView(
                    volumes[0],
                    showProjection=True,
                    angularDistFile=anglesSqlite,
                    spheresDistance=2))  #self.spheresScale.get()))

        return views
예제 #2
0
    def _createAngDistChimera(self, it):
        nparts = self.protocol.inputParticles.get().getSize()
        radius = self.spheresScale.get()

        volumes = self._getVolumeNames()

        if len(volumes) > 1:
            raise Exception(
                "Please, select a single volume to show it's angular distribution"
            )
        else:
            if self.protocol.IS_REFINE:
                data_angularDist = self.protocol._getFileName("output_par",
                                                              iter=it)
                if exists(data_angularDist):
                    sqliteFn = self.protocol._getFileName('projections',
                                                          iter=it)
                    self.createAngDistributionSqlite(
                        sqliteFn,
                        nparts,
                        itemDataIterator=self._iterAngles(
                            it, data_angularDist))
                    view = em.ChimeraClientView(volumes[0],
                                                showProjection=True,
                                                angularDistFile=sqliteFn,
                                                spheresDistance=radius)
            else:
                for ref3d in self._refsList:
                    data_angularDist = self.protocol._getFileName(
                        "output_par_class", iter=it, ref=ref3d)
                    if exists(data_angularDist):
                        sqliteFn = self.protocol._getFileName(
                            'projectionsClass', iter=it, ref=ref3d)
                        self.createAngDistributionSqlite(
                            sqliteFn,
                            nparts,
                            itemDataIterator=self._iterAngles(
                                it, data_angularDist))
                        view = em.ChimeraClientView(volumes[0],
                                                    showProjection=True,
                                                    angularDistFile=sqliteFn,
                                                    spheresDistance=radius)
        return view
예제 #3
0
    def _showVolumesChimera(self):
        """ Create a chimera script to visualize selected volumes. """
        volumes = self._getVolumeNames()

        if len(volumes) > 1:
            cmdFile = self.protocol._getExtraPath('chimera_volumes.cmd')
            f = open(cmdFile, 'w+')
            for volFn in volumes:
                # We assume that the chimera script will be generated
                # at the same folder than relion volumes
                vol = volFn.replace(':mrc', '')
                localVol = os.path.basename(vol)
                if exists(vol):
                    f.write("open %s\n" % localVol)
            f.write('tile\n')
            f.close()
            view = em.ChimeraView(cmdFile)
        else:
            view = em.ChimeraClientView(volumes[0])

        return [view]
예제 #4
0
    def _showVolumesChimera(self):
        """ Create a chimera script to visualize selected volumes. """
        volumes = self.getVolumeNames()

        if len(volumes) > 1:
            cmdFile = self._getFinalPath('chimera_volumes.cmd')
            f = open(cmdFile, 'w+')
            for vol in volumes:
                # We assume that the chimera script will be generated
                # at the same folder than spider volumes
                localVol = os.path.basename(vol)
                if os.path.exists(vol):
                    f.write("open spider:%s\n" % localVol)
            f.write('tile\n')
            f.close()
            view = em.ChimeraView(cmdFile)
        else:
            #view = CommandView('xmipp_chimera_client --input "%s" --mode projector 256 &' % volumes[0])
            #view = em.ChimeraClientView(volumes[0])
            view = em.ChimeraClientView(
                volumes[0], showProjection=True
            )  #, angularDistFile=sqliteFn, spheresDistance=radius)

        return [view]