|
16 | 16 | import os, sys, time |
17 | 17 | import gc |
18 | 18 | from optparse import OptionParser |
19 | | -import matplotlib |
20 | | -import pylab |
21 | | -from matplotlib import _pylab_helpers as ph |
22 | | -import matplotlib.cbook as cbook |
23 | 19 |
|
24 | 20 | parser = OptionParser() |
25 | 21 | parser.add_option("-q", "--quiet", default=True, |
|
36 | 32 | # The following overrides matplotlib's version of the -d option |
37 | 33 | # uses it if found |
38 | 34 | parser.add_option("-d", "--backend", dest="backend", |
39 | | - default=matplotlib.rcParams['backend'], |
| 35 | + default='', |
40 | 36 | help="backend") |
41 | 37 |
|
42 | 38 |
|
43 | 39 | options, args = parser.parse_args() |
44 | 40 |
|
45 | 41 | indStart = int(options.start) |
46 | 42 | indEnd = int(options.end) |
| 43 | +import matplotlib |
47 | 44 | matplotlib.rcParams['toolbar'] = matplotlib.validate_toolbar(options.toolbar) |
48 | | -matplotlib.rcParams['backend'] = matplotlib.validate_backend(options.backend) |
| 45 | +if options.backend: |
| 46 | + matplotlib.use(options.backend) |
| 47 | +import pylab |
| 48 | +import matplotlib.cbook as cbook |
49 | 49 |
|
50 | 50 | for i in range(indEnd+1): |
51 | 51 |
|
|
63 | 63 | gc.collect() |
64 | 64 | end = val |
65 | 65 |
|
66 | | -print |
67 | | -print 'uncollectable list:', gc.garbage |
68 | | -print |
| 66 | +print '#' |
| 67 | +print '# uncollectable list:', gc.garbage |
| 68 | +print '#' |
69 | 69 |
|
70 | 70 | if i > indStart: |
71 | | - print 'Backend %(backend)s, toolbar %(toolbar)s' % matplotlib.rcParams |
72 | | - print 'Averaging over loops %d to %d' % (indStart, indEnd) |
73 | | - print 'Memory went from %dk to %dk' % (start, end) |
74 | | - print 'Average memory consumed per loop: %1.4fk bytes\n' % ((end-start)/float(indEnd-indStart)) |
| 71 | + print '# Backend %(backend)s, toolbar %(toolbar)s' % matplotlib.rcParams |
| 72 | + print '# Averaging over loops %d to %d' % (indStart, indEnd) |
| 73 | + print '# Memory went from %dk to %dk' % (start, end) |
| 74 | + print '# Average memory consumed per loop: %1.4fk bytes\n' % ((end-start)/float(indEnd-indStart)) |
75 | 75 |
|
0 commit comments