def test_mmap_array_python_to_java_F32(self): pyarray = np.float32([1.0, 0.0, 1.059e3, -102.034, -9.3243]) jarray = pb.mmap_array_python_to_java(pyarray, pb.MmapType.ARRAY_F32) self.assertEqual(5, len(jarray)) for i in range(len(pyarray)): self.assertEqual(pyarray[i], np.float32(jarray[i]))
def test_mmap_array_python_to_java_S8(self): pyarray = [1, 0, -120, 100, -20] jarray = pb.mmap_array_python_to_java(pyarray, pb.MmapType.ARRAY_S8) self.assertEqual(5, len(jarray)) for i in range(len(pyarray)): self.assertEqual(pyarray[i], np.int8(jarray[i]))
def test_mmap_array_python_to_java_U8(self): pyarray = np.uint8([1, 0, 255, 100, 199]) jarray = pb.mmap_array_python_to_java(pyarray, pb.MmapType.ARRAY_U8) self.assertEqual(5, len(jarray)) for i in range(len(pyarray)): self.assertEqual(pyarray[i], np.uint8(jarray[i]))
def test_mmap_array_java_to_python_F32(self): pyarray = [1.0, 0.0, 1.059e3, -102.034, -9.3243] jarray = pb.mmap_array_python_to_java(pyarray, pb.MmapType.ARRAY_F32) pyfound = pb.mmap_array_java_to_python(jarray, pb.MmapType.ARRAY_F32) self.assertEqual(5, len(pyfound)) for i in range(len(pyfound)): self.assertEqual(np.float32(pyarray[i]), pyfound[i])
def test_mmap_array_java_to_python_S32(self): pyarray = [1, 0, 1999394, -10, -99384] jarray = pb.mmap_array_python_to_java(pyarray, pb.MmapType.ARRAY_S32) pyfound = pb.mmap_array_java_to_python(jarray, pb.MmapType.ARRAY_S32) self.assertEqual(5, len(pyfound)) for i in range(len(pyfound)): self.assertEqual(np.int32(pyarray[i]), pyfound[i])
def test_mmap_array_python_to_java_S32(self): pyarray = [1, 0, 1999394, -10, -99384] # pyarray = np.int32([1, 0, 1999394, -10, -99384]) jarray = pb.mmap_array_python_to_java(pyarray, pb.MmapType.ARRAY_S32) self.assertEqual(5, len(jarray)) for i in range(len(pyarray)): self.assertEqual(pyarray[i], np.int32(jarray[i]))
def add_points(self, cloud, color=None): java_cloud = gateway.jvm.java.util.ArrayList() pyboof.mmap_list_python_to_Point3D(cloud, java_cloud, np.double) if color: java_color = pyboof.mmap_array_python_to_java( color, pyboof.MmapType.ARRAY_S32) self.java_obj.addCloud(java_cloud, java_color) else: self.java_obj.addCloud(java_cloud)