本文整理汇总了Python中hail.linalg.BlockMatrix.rectangles_to_numpy方法的典型用法代码示例。如果您正苦于以下问题:Python BlockMatrix.rectangles_to_numpy方法的具体用法?Python BlockMatrix.rectangles_to_numpy怎么用?Python BlockMatrix.rectangles_to_numpy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hail.linalg.BlockMatrix
的用法示例。
在下文中一共展示了BlockMatrix.rectangles_to_numpy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_export_blocks
# 需要导入模块: from hail.linalg import BlockMatrix [as 别名]
# 或者: from hail.linalg.BlockMatrix import rectangles_to_numpy [as 别名]
def test_export_blocks(self):
nd = np.ones(shape=(8, 10))
bm = BlockMatrix.from_numpy(nd, block_size=20)
bm_path = new_local_temp_dir()
bm_uri = local_path_uri(bm_path)
bm.export_blocks(bm_uri, binary=True)
actual = BlockMatrix.rectangles_to_numpy(bm_path, binary=True)
self._assert_eq(nd, actual)
示例2: test_rectangles_to_numpy
# 需要导入模块: from hail.linalg import BlockMatrix [as 别名]
# 或者: from hail.linalg.BlockMatrix import rectangles_to_numpy [as 别名]
def test_rectangles_to_numpy(self):
nd = np.array([[1.0, 2.0, 3.0],
[4.0, 5.0, 6.0],
[7.0, 8.0, 9.0]])
rects = [[0, 3, 0, 1], [1, 2, 0, 2]]
rect_path = new_local_temp_dir()
rect_uri = local_path_uri(rect_path)
BlockMatrix.from_numpy(nd).export_rectangles(rect_uri, rects)
rect_bytes_path = new_local_temp_dir()
rect_bytes_uri = local_path_uri(rect_bytes_path)
BlockMatrix.from_numpy(nd).export_rectangles(rect_bytes_uri, rects, binary=True)
expected = np.array([[1.0, 0.0],
[4.0, 5.0],
[7.0, 0.0]])
self._assert_eq(expected, BlockMatrix.rectangles_to_numpy(rect_path))
self._assert_eq(expected, BlockMatrix.rectangles_to_numpy(rect_bytes_path, binary=True))