Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(19)  |  Call(14)  |  Derive(0)  |  Import(5)

src/m/d/MDAnalysis-0.8.1/MDAnalysis/analysis/contacts.py   MDAnalysis(Download)
import numpy
import MDAnalysis
from MDAnalysis.core.distances import distance_array, self_distance_array
from MDAnalysis.core.util import openany
 
 
        # compute reference contacts
        dref = distance_array(self.references[0].coordinates(), self.references[1].coordinates())
        self.qref = self.qarray(dref)
        self.nref = self.qref.sum()
                frame = ts.frame
                # use pre-allocated distance array to save a little bit of time
                distance_array(A.coordinates(), B.coordinates(), result=self.d)
                self.qarray(self.d, out=self.q)
                n1, q1 = self.qN(self.q, out=self._qtmp)

src/m/d/MDAnalysis-0.8.1/MDAnalysis/analysis/distances.py   MDAnalysis(Download)
from scipy.weave import converters
 
from MDAnalysis.core.distances import distance_array, self_distance_array
 
import logging
    '''
    if returntype=="numpy":
        adj = (distance_array(coord,coord,box=box) < cutoff)
        return adj
 

src/m/d/MDAnalysisTests-0.8.1/MDAnalysisTests/test_distances.py   MDAnalysisTests(Download)
    def test_noPBC(self):
        d = MDAnalysis.core.distances.distance_array(self.ref, self.points)
        assert_almost_equal(d, np.array([[self._dist(0), self._dist(1), self._dist(2),
                                          self._dist(3),
                                          ]]))
 
    def test_PBC(self):
        d = MDAnalysis.core.distances.distance_array(self.ref, self.points, box=self.box)
 
        ref = mindist(a, b, box)
        val = MDAnalysis.core.distances.distance_array(np.array([a]), np.array([b]), box)[0,0]
 
        assert_almost_equal(val, ref, decimal=6, err_msg="Issue 151 not correct (PBC in distance array)")
        self.trajectory[10]
        x1 = U.atoms.coordinates(copy=True)
        d = MDAnalysis.core.distances.distance_array(x0, x1)
        assert_equal(d.shape, (3341, 3341), "wrong shape (should be (Natoms,Natoms))")
        assert_almost_equal(d.min(), 0.11981228170520701, self.prec,
        natoms = len(U.atoms)
        d = np.zeros((natoms, natoms), np.float64)
        MDAnalysis.core.distances.distance_array(x0, x1, result=d)
        assert_equal(d.shape, (natoms, natoms), "wrong shape, shoud be  (Natoms,Natoms) entries")
        assert_almost_equal(d.min(), 0.11981228170520701, self.prec,

src/m/d/MDAnalysisTests-0.8.1/MDAnalysisTests/test_parallel.py   MDAnalysisTests(Download)
#
from MDAnalysis.core.parallel.distances import distance_array, distance_array_serial
from MDAnalysis.core.distances import distance_array as distance_array_reference
 
import numpy as np
            np.random.random((100,3)).astype(np.float32),
            ]
        self.ref = distance_array_reference(self.coord[0], self.coord[1])
        self.box = (np.random.random((3)) * np.random.random()).astype(np.float32)
        self.ref_pbc = distance_array_reference(self.coord[0], self.coord[1], box=self.box)