summaryrefslogtreecommitdiff
path: root/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'common.py')
-rwxr-xr-xcommon.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/common.py b/common.py
index 411867b..da8fe79 100755
--- a/common.py
+++ b/common.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
from itertools import combinations
+from sys import argv
def increment(dictionary, key):
dictionary[key] = dictionary.get(key, 0) + 1
@@ -23,7 +24,8 @@ def distribution(counts, capset, num):
metadist = {}
for i in range(num_i):
dists[i] = "".join(map(str, sorted(dists[i])))
- name = "dist" + str(num) + ":" + dists[i]
+ name = "dist" + str(num) + ":" \
+ + str(len(capset)) + ":" + dists[i]
increment(counts, name)
increment(metadist, name)
if counts["premeta" + str(num)]:
@@ -51,8 +53,15 @@ def metadistribution(counts, num):
del counts[key]
def main():
+ if len(argv) == 1:
+ infile = "capset.out"
+ elif len(argv) == 2:
+ infile = argv[1]
+ else:
+ print("Usage: common.py [INFILE]")
+ exit()
capsets = []
- capset_file = open("capset.out", "r")
+ capset_file = open(infile, "r")
for line in capset_file:
capsets.append(line[1:-2].split(" "))
capset_file.close()