Ejemplo n.º 1
0
 def test_Z(self):
     from Utilities.Information import get_coordinates
     originalCoordinates = np.transpose(
         get_coordinates(self.__pdbData._range(), self.__pdbData))
     # get random translation
     sign = np.sign(random.random() - 0.5)
     value = sign * random.random()
     # translate and get data
     self.__method(self.__pdbData._range(), self.__pdbData, [0, value, 0])
     translatedCoordinates = np.transpose(
         get_coordinates(self.__pdbData._range(), self.__pdbData))
     # assert translation
     self.assertTrue(np.sum(translatedCoordinates - [0, 0, value] -
                            originalCoordinates) < 10e-6,
                     msg="Translation along Z")
Ejemplo n.º 2
0
 def test_XYZ(self):
     from Utilities.Information import get_coordinates
     originalCoordinates = np.transpose(
         get_coordinates(self.__pdbData._range(), self.__pdbData))
     # get random translation
     signX = np.sign(random.random() - 0.5)
     valueX = signX * random.random()
     signY = np.sign(random.random() - 0.5)
     valueY = signY * random.random()
     signZ = np.sign(random.random() - 0.5)
     valueZ = signZ * random.random()
     # translate and get data
     self.__method(self.__pdbData._range(), self.__pdbData,
                   [valueX, valueY, valueZ])
     translatedCoordinates = np.transpose(
         get_coordinates(self.__pdbData._range(), self.__pdbData))
     # assert translation
     self.assertTrue(
         np.sum(translatedCoordinates - [valueX, valueY, valueZ] -
                originalCoordinates) < 10e-6,
         msg="Translation along XYZ")