r86371 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86370‎ | r86371 | r86372 >
Date:00:49, 19 April 2011
Author:rfaulk
Status:deferred
Tags:
Comment:
Added tunable plotting parameters to reporting via IntervalReporting constructor.
Modified paths:
  • /trunk/fundraiser-statistics/fundraiser-scripts/classes/DataReporting.py (modified) (history)

Diff [purge]

Index: trunk/fundraiser-statistics/fundraiser-scripts/classes/DataReporting.py
@@ -999,7 +999,7 @@
10001000 _font_size_ = 24
10011001 _fig_width_pt_ = 246.0 # Get this from LaTeX using \showthe\columnwidth
10021002 _inches_per_pt_ = 1.0/72.27 # Convert pt to inch
1003 - _use_labels= False
 1003+ _use_labels_= False
10041004 _fig_file_format_ = 'png'
10051005 _plot_type_ = 'line'
10061006
@@ -1011,26 +1011,30 @@
10121012 loader_type - string which determines the type of dataloader object
10131013 **kwargs - allows plotting parameters to be tuned !! MODIFY -- move up to base class !!
10141014 """
1015 - def __init__(self, loader_type, **kwargs):
1016 - if loader_type == 'standard':
1017 - self._data_loader_ = DL.IntervalReportingLoader()
1018 - elif loader_type == 'campaign':
1019 - self._data_loader_ = DL.CampaignIntervalReportingLoader()
 1015+ def __init__(self, **kwargs):
 1016+
 1017+ self._data_loader_ = DL.IntervalReportingLoader()
10201018
10211019 for key in kwargs:
 1020+
10221021 if key == 'font_size':
1023 - self._font_size_ = kwargs[key]
 1022+ self._font_size_ = kwargs[key]
10241023 elif key == 'fig_width_pt':
1025 - self._fig_width_pt_ = kwargs[key]
 1024+ self._fig_width_pt_ = kwargs[key]
10261025 elif key == 'inches_per_pt':
1027 - self._inches_per_pt_ = kwargs[key]
 1026+ self._inches_per_pt_ = kwargs[key]
10281027 elif key == 'use_labels':
1029 - self._use_labels = kwargs[key]
 1028+ self._use_labels_ = kwargs[key]
10301029 elif key == 'fig_file_format':
1031 - self._fig_file_format_ = kwargs[key]
1032 - elif key == 'plot_type':
1033 - self._plot_type_ = kwargs[key]
1034 -
 1030+ self._fig_file_format_ = kwargs[key]
 1031+ elif key == 'plot_type':
 1032+ self._plot_type_ = kwargs[key]
 1033+ elif key == 'data_loader': # Set custom data loaders
 1034+ if kwargs[key] == 'campaign_interval':
 1035+ self._data_loader_ = DL.CampaignIntervalReportingLoader()
 1036+
 1037+ print self._data_loader_.__str__
 1038+
10351039 """
10361040 <description>
10371041 """
@@ -1071,7 +1075,7 @@
10721076 if self._plot_type_ == 'step':
10731077 pylab.step(times[key], metrics[key], line_types[count])
10741078 elif self._plot_type_ == 'line':
1075 - pylab.plot(times[key], metrics[key], line_types[count])
 1079+ pylab.plot(times[key][1:], metrics[key][1:], line_types[count])
10761080 count = count + 1
10771081
10781082 """ Set the figure and font size """
@@ -1106,7 +1110,7 @@
11071111 pylab.ylabel(ylabel)
11081112
11091113 pylab.title(title)
1110 - pylab.savefig('./tests/' + fname + '.' + file_format, format=_fig_file_format_)
 1114+ pylab.savefig('./tests/' + fname + '.' + self._fig_file_format_, format=self._fig_file_format_)
11111115
11121116
11131117 """

Status & tagging log