[Erp5-report] r34838 luke - /erp5/trunk/utils/timing_log_parser/plot.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Apr 28 19:07:13 CEST 2010
Author: luke
Date: Wed Apr 28 19:07:12 2010
New Revision: 34838
URL: http://svn.erp5.org?rev=34838&view=rev
Log:
- allow to store in vector graphics
Modified:
erp5/trunk/utils/timing_log_parser/plot.py
Modified: erp5/trunk/utils/timing_log_parser/plot.py
URL: http://svn.erp5.org/erp5/trunk/utils/timing_log_parser/plot.py?rev=34838&r1=34837&r2=34838&view=diff
==============================================================================
--- erp5/trunk/utils/timing_log_parser/plot.py [utf8] (original)
+++ erp5/trunk/utils/timing_log_parser/plot.py [utf8] Wed Apr 28 19:07:12 2010
@@ -38,18 +38,19 @@
Usage:
plot.py file1.csv [OPTION] [file2.csv [...]]
Result:
- Generates, in current directory, a graph per csv column in png format.
+ Generates, in current directory, a graph per csv column in out-type format.
Their name is composed of:
- the ratio of present points (100 to 000). The higher the number, the
more the plot will be complete (less holes, longer timespan coverage).
- csv file basename (without extension)
- csv column title
- - 'png' extension
+ - out-type extension
Options:
- --with-regression : enable B-spline regression
+ --with-regression : enable B-spline regression
--ignored-quantity=NUM : ignore NUM higher values that might make a
graph totally unusable
+ --out-type=[png] : can be png (default) or svg
CSV files must have been generated by parse_timing_log.py tool.
"""
@@ -115,6 +116,7 @@
parser = OptionParser(usage)
parser.add_option("--with-regression", action="store_true", dest="regression_enabled")
parser.add_option("--ignored-quantity", type="int", dest="ignored_quantity")
+ parser.add_option("--out-type", type="string", default="png")
(options, file_name_list) = parser.parse_args()
current_dir = os.getcwd()
@@ -155,13 +157,13 @@
# import the splines library in R
if options.regression_enabled:
r("library(splines)")
- # now parse all columns and store a png file
+ # now parse all columns and store a out-type file
for title, column, value_max, ratio in file.iterColumns(start=1):
out_file, out_ext = path.splitext(path.basename(file_name))
if out_ext != '.csv':
out_file = '.'.join((out_file, out_ext))
- out_file_name = '%s_%s_%03i.png' % (out_file, title.replace('%',''),
- ratio)
+ out_file_name = '%s_%s_%03i.%s' % (out_file, title.replace('%',''),
+ ratio, options.out_type)
i = 0
x_data = []
y_data = []
@@ -199,8 +201,8 @@
r("fitted_model <- lm(y_data ~ bx)")
regression_string = ', fitted_model$fit'
# Define the place where to store the graphe and format of the image
- r("""png(file='%s/%s', width=800, height=600)""" % (current_dir,
- out_file_name))
+ r("""%s(file='%s/%s', width=800, height=600)""" % (options.out_type,
+ current_dir, out_file_name))
# Increase the size for the place of the bottom axis labels (x)
r("""par(mar=c(9, 4, 4, 2) + 0.1)""")
# Plot the graph itself
@@ -209,7 +211,7 @@
xlab='', ylab='time (s)', xaxt='n')""" % (
regression_string, title))
r("""axis(1, at=x_label_value_list, lab=x_label, las=2)""")
- # stop changing the png file
+ # stop changing the out-type file
r("""dev.off()""")
print 'Saving %s...' % (out_file_name, )
More information about the Erp5-report
mailing list