@@ -45,7 +45,9 @@ def __init__(self, title, xdata, ydata, style, symbol=None, *args):
4545 self .setTitle (title )
4646 self .setAxisTitle (QwtPlot .xBottom , 'x' )
4747 self .setAxisTitle (QwtPlot .yLeft , 'y' )
48+ self .curve_nb = 0
4849 for idx in range (1 , 11 ):
50+ self .curve_nb += 1
4951 curve = QwtPlotCurve ()
5052 curve .setPen (QPen (get_curve_color ()))
5153 curve .setStyle (style )
@@ -62,6 +64,8 @@ def __init__(self, title, xdata, ydata, style, symbol=None, *args):
6264class BMWidget (QWidget ):
6365 def __init__ (self , points , * args , ** kwargs ):
6466 super (BMWidget , self ).__init__ ()
67+ self .plot_nb = 0
68+ self .curve_nb = 0
6569 self .setup (points , * args , ** kwargs )
6670
6771 def params (self , * args , ** kwargs ):
@@ -79,8 +83,11 @@ def setup(self, points, *args, **kwargs):
7983 layout = QGridLayout ()
8084 nbcol , col , row = 2 , 0 , 0
8185 for style , symbol in self .params (* args , ** kwargs ):
82- layout .addWidget (BMPlot (style , x , y , getattr (QwtPlotCurve , style ),
83- symbol = symbol ), row , col )
86+ plot = BMPlot (style , x , y , getattr (QwtPlotCurve , style ),
87+ symbol = symbol )
88+ layout .addWidget (plot , row , col )
89+ self .plot_nb += 1
90+ self .curve_nb += plot .curve_nb
8491 col += 1
8592 if col >= nbcol :
8693 row += 1
@@ -139,7 +146,7 @@ def __init__(self, max_n, parent=None, **kwargs):
139146 self .text .append ("<br><br><u>Total elapsed time</u>: %d ms" % (dt * 1e3 ))
140147 self .tabs .setCurrentIndex (0 )
141148
142- def process_iteration (self , title , widget , t0 ):
149+ def process_iteration (self , title , description , widget , t0 ):
143150 self .tabs .addTab (widget , title )
144151 self .tabs .setCurrentWidget (widget )
145152
@@ -148,15 +155,17 @@ def process_iteration(self, title, widget, t0):
148155
149156 time_str = "Elapsed time: %d ms" % ((time .time ()- t0 )* 1000 )
150157 widget .text .setText (time_str )
151- self .text .append ("<br><i>%s:</i><br>%s" % (title , time_str ))
158+ self .text .append ("<br><i>%s:</i><br>%s" % (description , time_str ))
152159
153160 def run_benchmark (self , max_n , ** kwargs ):
154161 for idx in range (4 , - 1 , - 1 ):
155162 points = max_n / 10 ** idx
156- title = '%d points' % points
157163 t0 = time .time ()
158164 widget = BMWidget (points , ** kwargs )
159- self .process_iteration (title , widget , t0 )
165+ title = '%d points' % points
166+ description = '%d plots with %d curves of %d points' % (
167+ widget .plot_nb , widget .curve_nb , points )
168+ self .process_iteration (title , description , widget , t0 )
160169
161170
162171if __name__ == '__main__' :
0 commit comments