Revision: 4318
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4318&view=rev
Author: mdboom
Date: 2007-11-15 10:39:36 -0800 (Thu, 15 Nov 2007)
Log Message:
-----------
Merged revisions 4290-4317 via svnmerge from
http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib
........
r4290 | mdboom | 2007-11-14 14:43:31 -0500 (Wed, 14 Nov 2007) | 2 lines
Fix flush callback in PNG file-like object writing.
........
r4315 | mdboom | 2007-11-15 13:36:27 -0500 (Thu, 15 Nov 2007) | 2 lines
Clean up error message.
........
r4316 | mdboom | 2007-11-15 13:36:51 -0500 (Thu, 15 Nov 2007) | 2 lines
Have backend_driver report times for each individual test.
........
r4317 | mdboom | 2007-11-15 13:37:57 -0500 (Thu, 15 Nov 2007) | 1 line
Add tool to compare two different outputs of backend_driver.py
........
Modified Paths:
--------------
branches/transforms/examples/backend_driver.py
branches/transforms/src/_backend_agg.cpp
Added Paths:
-----------
branches/transforms/unit/compare_backend_driver_results.py
Property Changed:
----------------
branches/transforms/
Property changes on: branches/transforms
___________________________________________________________________
Name: svnmerge-integrated
- /trunk/matplotlib:1-4289
+ /trunk/matplotlib:1-4317
Modified: branches/transforms/examples/backend_driver.py
===================================================================
--- branches/transforms/examples/backend_driver.py 2007-11-15 18:37:57 UTC
(rev 4317)
+++ branches/transforms/examples/backend_driver.py 2007-11-15 18:39:36 UTC
(rev 4318)
@@ -123,9 +123,7 @@
os.system(' '.join(arglist))
def drive(backend, python=['python'], switches = []):
-
exclude = failbackend.get(backend, [])
- switchstring = ' '.join(switches)
# Strip off the format specifier, if any.
if backend.startswith('cairo'):
_backend = 'cairo'
@@ -136,7 +134,7 @@
print '\tSkipping %s, known to fail on backend: %s'%backend
continue
- print '\tdriving %s %s' % (fname, switchstring)
+ print ('\tdriving %-40s' % (fname)),
basename, ext = os.path.splitext(fname)
outfile = basename + '_%s'%backend
tmpfile_name = '_tmp_%s.py' % basename
@@ -169,7 +167,10 @@
tmpfile.write('savefig("%s", dpi=150)' % outfile)
tmpfile.close()
+ start_time = time.time()
run(python + [tmpfile_name, switchstring])
+ end_time = time.time()
+ print (end_time - start_time)
#os.system('%s %s %s' % (python, tmpfile_name, switchstring))
os.remove(tmpfile_name)
@@ -193,7 +194,8 @@
if not backends:
backends = default_backends
for backend in backends:
- print 'testing %s' % backend
+ switchstring = ' '.join(switches)
+ print 'testing %s %s' % (backend, switchstring)
t0 = time.time()
drive(backend, python, switches)
t1 = time.time()
Modified: branches/transforms/src/_backend_agg.cpp
===================================================================
--- branches/transforms/src/_backend_agg.cpp 2007-11-15 18:37:57 UTC (rev
4317)
+++ branches/transforms/src/_backend_agg.cpp 2007-11-15 18:39:36 UTC (rev
4318)
@@ -1269,7 +1269,7 @@
static void flush_png_data(png_structp png_ptr) {
PyObject* py_file_obj = (PyObject*)png_get_io_ptr(png_ptr);
- PyObject* flush_method = PyObject_GetAttrString(py_file_obj, "write");
+ PyObject* flush_method = PyObject_GetAttrString(py_file_obj, "flush");
if (flush_method) {
PyObject_CallFunction(flush_method, "");
}
@@ -1297,7 +1297,7 @@
if ((fp = PyFile_AsFile(py_fileobj.ptr())) == NULL) {
PyObject* write_method = PyObject_GetAttrString(py_fileobj.ptr(),
"write");
if (!(write_method && PyCallable_Check(write_method)))
- throw Py::TypeError("Object does not appear to be a Python file-like
object");
+ throw Py::TypeError("Object does not appear to be a path or a Python
file-like object");
}
}
Copied: branches/transforms/unit/compare_backend_driver_results.py (from rev
4317, trunk/matplotlib/unit/compare_backend_driver_results.py)
===================================================================
--- branches/transforms/unit/compare_backend_driver_results.py
(rev 0)
+++ branches/transforms/unit/compare_backend_driver_results.py 2007-11-15
18:39:36 UTC (rev 4318)
@@ -0,0 +1,71 @@
+import sys
+
+def parse_results(filename):
+ results = {}
+ fd = open(filename, 'r')
+ section = "???"
+ for line in fd.readlines():
+ line = line.strip()
+ if line.startswith("testing"):
+ section = line.split(" ", 1)[1]
+ results.setdefault(section, {})
+ elif line.startswith("driving"):
+ driving, test, time = [x.strip() for x in line.split()]
+ time = float(time)
+ results[section][test] = time
+ fd.close()
+ return results
+
+
+def check_results_are_compatible(results_a, results_b):
+ for section in results_a.keys():
+ if not section in results_b:
+ raise RuntimeError("Backend '%s' in first set, but not in second"
% section)
+
+ for section in results_b.keys():
+ if not section in results_a:
+ raise RuntimeError("Backend '%s' in second set, but not in first"
% section)
+
+
+def compare_results(results_a, results_b):
+ check_results_are_compatible(results_a, results_b)
+
+ sections = results_a.keys()
+ sections.sort()
+ for section in results_a.keys():
+ print "backend %s" % section
+ print " %-40s %6s %6s %6s %6s" % ("test", "a", "b", "delta", "%
diff")
+ print " " + '-' * 69
+ deltas = []
+ section_a = results_a[section]
+ section_b = results_b[section]
+ for test in section_a.keys():
+ if test not in section_b:
+ deltas.append([None, None, section_a[test], None, test])
+ else:
+ time_a = section_a[test]
+ time_b = section_b[test]
+ deltas.append([time_b / time_a, time_b - time_a, time_a,
time_b, test])
+ for test in section_b.keys():
+ if test not in section_a:
+ deltas.append([None, None, None, section_b[test], test])
+
+ deltas.sort()
+ for diff, delta, time_a, time_b, test in deltas:
+ if diff is None:
+ if time_a is None:
+ print " %-40s ??? % 6.3f ??? ???" % (test,
time_b)
+ else:
+ print " %-40s % 6.3f ??? ??? ???" % (test,
time_a)
+ else:
+ print " %-40s % 6.3f % 6.3f % 6.3f %6d%%" % (test, time_a,
time_b, delta, diff * 100)
+
+
+if __name__ == '__main__':
+ results_a_filename = sys.argv[-2]
+ results_b_filename = sys.argv[-1]
+
+ results_a = parse_results(results_a_filename)
+ results_b = parse_results(results_b_filename)
+
+ compare_results(results_a, results_b)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins