예제 #1
0
 def test_handles_wrong_shapes_well(self):
     """
     The cython wrapper raises an error if the shapes are not compatible.
     """
     b1, b2 = get_random_coord_arrays(20)
     c1, c2 = get_random_coord_arrays(21)
     with self.assertRaises(ValueError):
         rmsd_qc(b1, c1)
예제 #2
0
 def test_rmsd_bigger_dataset(self):
     """
     For large point-clouds, kabsch and qcprot yield the same RMSD
     """
     for i in range(RAND_TEST_ITERATIONS):
         b1 , b2 = get_random_coord_arrays()
         self.assertAlmostEqual(rmsd_kabsch(b1, b2), rmsd_qc(b1, b2))            
예제 #3
0
 def test_rmsd_skipping_entries(self):
     """
     If the original input array has no contiguouse memory layout, we still don't crash
     """
     for i in range(RAND_TEST_ITERATIONS):
         b1 , b2 = get_random_coord_arrays()
         self.assertAlmostEqual(rmsd_kabsch(b1[::2], b2[::2]), rmsd_qc(b1[::2], b2[::2]))
예제 #4
0
 def test_qcrmsd_centered(self):
     """
     Test the is_centered flag of qcprot
     """
     for i in range(RAND_TEST_ITERATIONS):
         b1 , b2 = get_random_coord_arrays()
         b1 = center_coords(b1)
         b2 = center_coords(b2)
         self.assertAlmostEqual(rmsd_kabsch(b1, b2), rmsd_qc(b1, b2, True))
예제 #5
0
def rmsd_qc_wrap(coords1, coords2, is_centered=False):
    r = rmsd_qc(coords1, coords2, is_centered)
    if np.isnan(r):
        return rmsd_kabsch(coords1, coords2, is_centered)
    return r
예제 #6
0
 def test_rmsd_qc_2(self):
     """
     The qcprot algorithm currently does not handle the case of 0 RMSD properly.
     """
     self.assertAlmostEqual(rmsd_qc(self.a1, self.a3), 0) #Only translation
     self.assertAlmostEqual(rmsd_qc(self.a1, self.a4), 0) #Only rotation
예제 #7
0
 def test_rmsd_qc(self):
     """
     Test the py_qcprot rmsd version on trivial examples.
     """
     self.assertAlmostEqual(rmsd_qc(self.a1, self.a1), 0) #Special case, treated seperately in python wrapper
     self.assertAlmostEqual(rmsd_qc(self.a1, self.a2), math.sqrt(2))
예제 #8
0
def rmsd_qc_wrap(coords1, coords2, is_centered=False):
    r = rmsd_qc(coords1, coords2, is_centered)
    if np.isnan(r):
        return rmsd_kabsch(coords1, coords2, is_centered)
    return r