aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/scale.py
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2019-10-29 12:06:05 +0000
committerYann Herklotz <git@yannherklotz.com>2019-10-29 12:06:05 +0000
commit4ee6646b8a78d4c20fe0b89d95f23d382e1c47fc (patch)
tree9b02e1b92f8abf0baf3dc108ab7f4fb8f33e753a /scripts/scale.py
parent1aaff80235237507572e0fb4be86f34cb1829b68 (diff)
parent01c2ab3f6a58d416528efce3057e2cf2f1604489 (diff)
downloadverismith-4ee6646b8a78d4c20fe0b89d95f23d382e1c47fc.tar.gz
verismith-4ee6646b8a78d4c20fe0b89d95f23d382e1c47fc.zip
Merge branch 'master' into HEADfeature/nondeterminism
Diffstat (limited to 'scripts/scale.py')
-rwxr-xr-xscripts/scale.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/scale.py b/scripts/scale.py
new file mode 100755
index 0000000..7dbc155
--- /dev/null
+++ b/scripts/scale.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+
+import csv
+import sys
+import random
+
+def main(filename, output_file):
+ with open(filename, "r") as f:
+ reader = list(csv.reader(f))
+ newreader = []
+ for row in reader:
+ try:
+ if float(row[4]) > 900:
+ row[4] = "900"
+ if float(row[3]) > 900:
+ row[3] = "900"
+ if random.random() < 0.25:
+ newreader.append(row)
+ except:
+ newreader.append(row)
+ with open(output_file, "w") as f:
+ writer = csv.writer(f)
+ writer.writerows(newreader)
+
+if __name__ == "__main__":
+ main(sys.argv[1], sys.argv[2])