-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsizes.py
More file actions
30 lines (25 loc) · 785 Bytes
/
Copy pathsizes.py
File metadata and controls
30 lines (25 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import json
import numpy as np
def stats(arr):
return {
'min': np.min(arr),
'max': np.max(arr),
'mean': np.mean(arr),
'std': np.std(arr),
'q1': np.percentile(arr, 25),
'q2': np.percentile(arr, 50),
'q3': np.percentile(arr, 75)
}
for i in range(24):
with open(f'case{i}.json') as f:
js = json.load(f)
all_strs = list(js.keys()) + list(js.values())
arr = [len(s) for s in all_strs]
sts = stats(np.array(arr))
print('{:2} & {:8.1e}'.format(i + 1, len(js)), end='')
for v in sts.values():
if isinstance(v, np.int64):
print(' & {:8}'.format(v), end='')
else:
print(' & {:8.04}'.format(v), end='')
print()