CMS 3D CMS Logo

Classes | Functions
presentation Namespace Reference

Classes

class  PageLayout
 
class  SubsectionBase
 
class  SubsectionFromList
 
class  SubsectionOnePage
 
class  SummarySection
 
class  ValidationPlots
 

Functions

def plotSortKey (plot)
 
def validationclasses (validations)
 
def writePage (plots, title, layout)
 
def writePageReg (identifier, title, validations, layout=0)
 

Function Documentation

◆ plotSortKey()

def presentation.plotSortKey (   plot)

Definition at line 182 of file presentation.py.

182 def plotSortKey(plot):
183  # Move normchi2 before chi2Prob
184  if plot.find('normchi2') != -1:
185  return 'chi2a'
186  if plot.find('chi2Prob') != -1:
187  return 'chi2b'
188  return plot
189 

◆ validationclasses()

def presentation.validationclasses (   validations)

Definition at line 38 of file presentation.py.

38 def validationclasses(validations):
39  from collections import OrderedDict
40  classes = [validation.validationclass for validation in validations]
41  #remove duplicates - http://stackoverflow.com/a/39835527/5228524
42  classes = list(OrderedDict.fromkeys(classes))
43  return classes
44 
45 # Layout of plots on a page:

Referenced by produceOfflineValidationTex.main().

◆ writePage()

def presentation.writePage (   plots,
  title,
  layout 
)

Definition at line 166 of file presentation.py.

166 def writePage(plots, title, layout):
167  plotrows = []
168  for row in layout.pattern:
169  plotrow = []
170  for i in range(len(row)):
171  plotrow.append(plotTemplate.replace('[width]', str(layout.width)).\
172  replace('[height]', str(layout.height)).\
173  replace('[path]', plots[row[i]-1]))
174  plotrows.append('\n'.join(plotrow))
175  script = ' \\\\\n'.join(plotrows)
176 
177  return frameTemplate.replace('[plots]', script).replace('[title]', title)
178 
179 
180 # Sort key to rearrange a plot list.
181 # Arguments: plot: to be sorted.

References join(), FastTimerService_cff.range, python.rootplot.root2matplotlib.replace(), and str.

Referenced by writePageReg().

◆ writePageReg()

def presentation.writePageReg (   identifier,
  title,
  validations,
  layout = 0 
)

Definition at line 142 of file presentation.py.

142 def writePageReg(identifier, title, validations, layout=0):
143  plots = []
144  for validation in validations:
145  valiplots = [validation.path+plot for plot in validation.plots
146  if re.search(identifier, plot)]
147  valiplots.sort(key=plotSortKey)
148  plots.append(valiplots)
149  if sum(len(p) for p in plots) == 0:
150  print('Warning: no plots matching ' + identifier)
151  return ''
152 
153  # Create layout, if not given.
154  if layout == 0:
155  layout = PageLayout()
156  layout.fit(plots)
157 
158  return writePage([p for vali in plots for p in vali], title, layout)
159 
160 
161 # Write the given plots on a page.
162 # Arguments: plots: paths of plots to be drawn on the page
163 # title: title of the plot type
164 # layout: a PageLayout object definig the layout.
165 # Returns the parsed script.

References print(), and writePage().

Referenced by presentation.SubsectionOnePage.pages(), and presentation.SubsectionFromList.pages().

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
join
static std::string join(char **cmd)
Definition: RemoteFile.cc:17
presentation.plotSortKey
def plotSortKey(plot)
Definition: presentation.py:182
presentation.validationclasses
def validationclasses(validations)
Definition: presentation.py:38
presentation.writePageReg
def writePageReg(identifier, title, validations, layout=0)
Definition: presentation.py:142
str
#define str(s)
Definition: TestProcessor.cc:52
presentation.writePage
def writePage(plots, title, layout)
Definition: presentation.py:166
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
python.rootplot.root2matplotlib.replace
def replace(string, replacements)
Definition: root2matplotlib.py:444