def test_computeRMSD_Random(self): """3. for two random sets of points, rmsd(x,y) == rmsd(y,x)""" min = -10000. max = 10000. num_points = 20 dimension = 3 point_list_1 = RandomArray.uniform(min, max, (num_points, dimension)) point_list_2 = RandomArray.uniform(min, max, (num_points, dimension)) self.assertEqual( rmsd.RMSDCalculator(point_list_1).computeRMSD(point_list_2), rmsd.RMSDCalculator(point_list_2).computeRMSD(point_list_1))
def test_computeRMSD_RandomOffset(self): """5. offset point by random value returns offset*sqrt(3)""" min = -10000. max = 10000. num_points = 20 dimension = 3 point_list_1 = RandomArray.uniform(min, max, (num_points, dimension)) delta = point_list_1[0][0] point_list_2 = point_list_1 + delta answer = rmsd.RMSDCalculator(point_list_1).computeRMSD(point_list_2) self.assertEqual(round(answer, self.decimals), round(abs(delta) * math.sqrt(3.0), self.decimals))
def test_computeRMSD_noRefCoords(self): """4. raise ValueError if the reference coords have not been set""" ruler = rmsd.RMSDCalculator() self.assertRaises(ValueError, ruler.computeRMSD, self.point_list_1)
def test_computeRMSD_dimensions(self): """2. raise ValueError for input of unlike dimensions""" ruler = rmsd.RMSDCalculator(self.point_list_0) self.assertRaises(ValueError, ruler.computeRMSD, self.point_list_1)
def test_computeRMSD_KnowValues(self): """1. should return known result with known input""" for ref, input, known in self.knowValues: self.assertEqual(known, rmsd.RMSDCalculator(ref).computeRMSD(input))