Force bucket_size to be at least 1

This commit is contained in:
Enrico Lumetti 2021-09-17 20:52:06 +02:00
parent 9aaf3ac896
commit 89728fdcbe
1 changed files with 2 additions and 1 deletions

View File

@ -71,7 +71,8 @@ if args.subparser_name == 'rank':
else:
dates = chain.from_iterable(v for v in entries.values())
timestamps = list(d.timestamp() for d in dates)
num_buckets = (max_date - min_date).total_seconds() / (args.bucket_size * 3600)
bucket_size = max(args.bucket_size, 1)
num_buckets = (max_date - min_date).total_seconds() / (bucket_size * 3600)
num_buckets = max(1, int(num_buckets))
counts, bin_edges = np.histogram(timestamps, bins=num_buckets)
fig = tpl.figure()