diff scripts/timeline_view.py @ 264:4345ba8a1b6e

Scripts: choose input/output folder from command line; score_plot also choose options from command line (WIP)
author Brecht De Man <b.deman@qmul.ac.uk>
date Mon, 20 Jul 2015 12:47:16 +0100
parents c3f29c2b9b12
children a1c1f032ff0a
line wrap: on
line diff
--- a/scripts/timeline_view.py	Wed Jul 15 15:52:56 2015 +0100
+++ b/scripts/timeline_view.py	Mon Jul 20 12:47:16 2015 +0100
@@ -1,14 +1,25 @@
 #!/usr/bin/python
 
 import xml.etree.ElementTree as ET
-import os
-import matplotlib.pyplot as plt
+import os # list files in directory
+import sys # command line arguments
+import matplotlib.pyplot as plt # plots
+
+# COMMAND LINE ARGUMENTS
+
+assert len(sys.argv)<3, "timeline_view takes at most 1 command line argument\n"+\
+                        "Use: python timeline_view.py [timeline_folder_location]"
+
+# XML results files location
+if len(sys.argv) == 1:
+    folder_name = "../saves"    # Looks in 'saves/' folder from 'scripts/' folder
+    print "Use: python timeline_view.py [timeline_folder_location]"
+    print "Using default path: " + folder_name
+elif len(sys.argv) == 2:
+    folder_name = sys.argv[1]   # First command line argument is folder
 
 # CONFIGURATION 
 
-# XML results files location (modify as needed):
-folder_name = "../saves"    # Looks in 'saves/' folder from 'scripts/' folder
-
 # Folder where to store timelines
 timeline_folder = folder_name + '/timelines/'    # Stores in 'saves/timelines/'