def scaled_histogram(data, num_points, scale):
if scale == 'linear':
hist, edges = np.histogram(data, bins=max([5, int(num_points / 50)]))
else:
# Conditional catches an empty data input.
h1, h2 = ((np.log10(min(data)), np.log10(max(data))) if len(data) > 0 else (0, 1))
hist, edges = np.histogram(data, bins=np.logspace(h1, h2, 1 + max([5, int(num_points / 50)])))
hist_max = max(hist) * 1.1
return hist, edges, hist_max
评论列表
文章目录