def create_bitmap_grid(bitmap, n, num_bins, level_size):
"""
Arranges a time-series bitmap into a 2-D grid for heatmap visualization
"""
assert num_bins % n == 0, 'num_bins has to be a multiple of n'
m = num_bins // n
row_count = int(math.pow(m, level_size))
col_count = int(math.pow(n, level_size))
grid = np.full((row_count, col_count), 0.0)
for feat, count in bitmap.items():
i, j = symbols2index(m, n, feat)
grid[i, j] = count
return grid
评论列表
文章目录