do_boxplot_last_exp.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #
00003 # GIT version. Please do not edit this file.
00004 # Make a copy and edit the copy.
00005 #
00006 
00007 import sys
00008 import os
00009 
00010 
00011 # L = <list of experiments to compare and label to use in the plot (no spaces allowed in the label!!!)>
00012 
00013 L = []
00014 
00015 
00016 # Read file with experiments to plot
00017 
00018 if (len(sys.argv)<4):
00019     print "Use: do_boxplot_last_exp.py <num of last exp to plot> <plot title> <label_1> ... <label_n>"
00020     sys.exit(0)
00021 
00022 exptoplot = "exptoplot.txt"
00023 ntoplot = sys.argv[1]
00024 cmd = "tail -n "+ntoplot+" experiments.txt > " + exptoplot
00025 os.system(cmd)
00026 
00027 plot_title = sys.argv[2]
00028 outfile = '"'+plot_title+'.pdf"'
00029 
00030 k = 3; # index for the labels
00031 
00032 #print "File with exp to plot: ",exptoplot
00033 
00034 f = open(exptoplot,'r')
00035 
00036 for line in f:
00037     e = line.rstrip('\r\n ')
00038     L.append(e)
00039     L.append(sys.argv[k])
00040     k=k+1
00041 
00042 f.close
00043 
00044 # Run the R script
00045 
00046 cmd = 'Rscript stats/boxplots.R "'+plot_title+'" '
00047 lfiles = ""
00048 
00049 for i in range(0,len(L)/2):
00050   lfiles = lfiles + "%s_idleness.csv %s " %(L[i*2],L[i*2+1])
00051 
00052 print cmd+lfiles
00053 os.system(cmd+lfiles)
00054 
00055 cmd = 'mv Rplots.pdf '+outfile
00056 os.system(cmd)
00057 
00058 cmd = 'evince '+outfile+ ' &'
00059 os.system(cmd)
00060 


patrolling_sim
Author(s):
autogenerated on Mon Oct 2 2017 03:13:50