[Erp5-report] r29755 - /erp5/trunk/utils/timing_log_parser/plot.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Oct 16 13:52:55 CEST 2009


Author: seb
Date: Fri Oct 16 13:52:54 2009
New Revision: 29755

URL: http://svn.erp5.org?rev=29755&view=rev
Log:
add parameter in order to ignore x max values

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=29755&r1=29754&r2=29755&view=diff
==============================================================================
--- erp5/trunk/utils/timing_log_parser/plot.py [utf8] (original)
+++ erp5/trunk/utils/timing_log_parser/plot.py [utf8] Fri Oct 16 13:52:54 2009
@@ -48,6 +48,8 @@
 
   Options:
     --with-regression : enable B-spline regression 
+    --ignored-quantity=NUM : ignore NUM higher values that might make a
+        graph totally unusable
 
   CSV files must have been generated by parse_timing_log.py tool.
 """
@@ -118,6 +120,7 @@
 def main():
   parser = OptionParser(usage)
   parser.add_option("--with-regression", action="store_true", dest="regression_enabled")
+  parser.add_option("--ignored-quantity", type="int", dest="ignored_quantity")
   (options, file_name_list) = parser.parse_args()
 
   current_dir = os.getcwd()
@@ -147,7 +150,7 @@
       i += 1
     max_x = len(date_string_list)
     # knots are used for B-spline regression
-    # We need to three additional knots at the begin and end in
+    # We need to add three additional knots at the begin and end in
     # order to have the right basis
     knot_list  = [x_label_value_list[0]] * 3 + x_label_value_list \
         + [max_x] * 4
@@ -167,11 +170,24 @@
       i = 0
       x_data = []
       y_data = []
+      # First parse the list to retrieve values that we might want to remove
+      ignored_value_set = set([])
+      max_y_data = []
+      if options.ignored_quantity not in (None, 0):
+        for value in column:
+          if value is not None:
+            max_y_data.append(value)
+        max_y_data.sort()
+        ignored_value_set = set(max_y_data[-options.ignored_quantity:])
+      # build list with all data that we want to display
       for value in column:
-        if value is not None:
+        if value is not None and not (value in ignored_value_set):
           x_data.append(i)
           y_data.append(value)
         i += 1
+      if len(x_data) == 0:
+        print 'Nothing to plot for %s...' % (out_file_name, )
+        continue
       r_y_data = robjects.FloatVector(y_data)
       r_x_data = robjects.FloatVector(x_data)
       robjects.globalEnv["y_data"] = r_y_data




More information about the Erp5-report mailing list