Exemplo n.º 1
0
    def _loadAnimationData(self, obj):
        prot = self.protocol
        animationName = obj.getFileName(
        )  # assumes that obj.getFileName is the folder of animation
        animationPath = prot._getExtraPath(animationName)
        #animationName = animationPath.split('animation_')[-1]
        animationRoot = join(animationPath, animationName)

        animationSuffixes = ['.vmd', '.pdb', 'trajectory.txt']
        for s in animationSuffixes:
            f = animationRoot + s
            if not exists(f):
                self.errorMessage('Animation file "%s" not found. ' % f)
                return

        # Load animation trajectory points
        trajectoryPoints = np.loadtxt(animationRoot + 'trajectory.txt')
        data = PathData(dim=trajectoryPoints.shape[1])

        for i, row in enumerate(trajectoryPoints):
            data.addPoint(Point(pointId=i + 1, data=list(row), weight=1))

        self.trajectoriesWindow.setPathData(data)
        self.trajectoriesWindow.setAnimationName(animationName)
        self.trajectoriesWindow._onUpdateClick()

        def _showVmd():
            vmdFn = animationRoot + '.vmd'
            VmdView(' -e %s' % vmdFn).show()

        self.getTkRoot().after(500, _showVmd)
Exemplo n.º 2
0
    def __init__(self, **kwargs):
        gui.Window.__init__(self, minsize=(420, 200), **kwargs)

        self.dim = kwargs.get('dim')
        self.data = kwargs.get('data')
        self.pathData = PathData(dim=self.dim)
        self.callback = kwargs.get('callback', None)
        self.loadCallback = kwargs.get('loadCallback', None)
        self.numberOfPoints = kwargs.get('numberOfPoints', 10)

        self.plotter = None

        content = tk.Frame(self.root)
        self._createContent(content)
        content.grid(row=0, column=0, sticky='news')
        content.columnconfigure(0, weight=1)
Exemplo n.º 3
0
    def _loadData(self):
        from pyworkflow.em.packages.xmipp3.nma.data import PathData
        data = PathData(dim=2)
        bfactorFile = self.protocol._getPath('bfactor.txt')
        if os.path.exists(bfactorFile):
            f = open(bfactorFile)
            values = map(float, f.readline().split())
            f.close()
            p1 = data.createEmptyPoint()
            p1.setX(values[0])
            p1.setY(values[1])
            data.addPoint(p1)
            p2 = data.createEmptyPoint()
            p2.setX(values[2])
            p2.setY(values[3])
            data.addPoint(p2)
            data.bfactor = values[4]
        else:
            data.bfactor = 0

        return data