do_plot_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_plot_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 
00047 
00048 for i in range(0,len(L)/2):
00049   plot_title_2 = '"' + plot_title.strip('"') + ' ' + L[i*2+1] + '"'
00050 
00051   print plot_title_2
00052 
00053   precmd = 'Rscript stats/plots.R '+plot_title_2+' '
00054   cmd = precmd + "%s_idleness.csv %s " %(L[i*2],L[i*2+1])
00055   os.system(cmd)
00056   
00057   outfile = '"' + plot_title.strip('"') + '_' + L[i*2+1] + '.pdf"'
00058   cmd = 'mv Rplots.pdf '+outfile
00059   os.system(cmd)
00060 
00061   cmd = 'evince '+outfile+ ' &'
00062   os.system(cmd)
00063 


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