def _get_grid_size(data, use_default_square=False):
"""
Calculate the size of the grid.
Parameters
----------
data: array-like
The normalized data.
use_default_square: bool
Define the grid as the minimal possible square.
Returns
-------
int, int
The width and height of the grid.
"""
# if the grid would be square, this is the minimum size
sqr_size = int(np.ceil(np.sqrt(len(data))))
size_x = size_y = sqr_size
if not use_default_square:
kurt = kurtosis(data)
kurt_x, kurt_y = np.int32(np.abs(np.ceil(kurt * 2)))
size_x += kurt_x
size_y += kurt_y
return size_x, size_y
评论列表
文章目录