CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
presentation.PageLayout Class Reference
Inheritance diagram for presentation.PageLayout:

Public Member Functions

def __init__ (self, pattern=[], width=1, height=1)
 
def fit (self, plots)
 

Public Attributes

 height
 
 pattern
 
 width
 

Detailed Description

Definition at line 44 of file presentation.py.

Constructor & Destructor Documentation

def presentation.PageLayout.__init__ (   self,
  pattern = [],
  width = 1,
  height = 1 
)

Definition at line 45 of file presentation.py.

45  def __init__(self, pattern=[], width=1, height=1):
46  self.pattern = [] # List of rows; row contains the order numbers
47  # of its plots; e.g. [[1,2,3], [4,5,6]]
48  self.width = width # Maximum width of one plot,
49  # with respect to textwidth.
50  self.height = height # Maximum height of one plot,
51  # with respect to textheight.
52 
def __init__(self, pattern=[], width=1, height=1)
Definition: presentation.py:45

Member Function Documentation

def presentation.PageLayout.fit (   self,
  plots 
)

Definition at line 55 of file presentation.py.

References presentation.PageLayout.height, svgfig.Plot.height, svgfig.Frame.height, svgfig.Dots.height, createfilelist.int, presentation.PageLayout.pattern, presentation.PageLayout.width, svgfig.Plot.width, svgfig.Frame.width, and svgfig.Dots.width.

Referenced by trackingPlots.Iteration.modules().

55  def fit(self, plots):
56  rowlengths = []
57  # First, try to place plots in a square.
58  nplots = sum(len(p) for p in plots)
59  length = int(math.ceil(math.sqrt(nplots)))
60  # Then, fill the square from the bottom and remove extra rows.
61  fullRows = int(nplots/length)
62  residual = nplots - length*fullRows
63  nrows = fullRows
64  if residual != 0:
65  rowlengths.append(residual)
66  nrows += 1
67  for _ in xrange(fullRows):
68  rowlengths.append(length)
69 
70  # Now, fill the pattern.
71  self.pattern = []
72  if residual == 0 and len(plots[0])%length != 0 and\
73  len(plots[0])%nrows == 0:
74  # It's better to arrange plots in columns, not rows.
75  self.pattern.extend(range(i, i+nrows*(length-1)+1, nrows)
76  for i in range(1, nrows+1))
77  else:
78  if residual != 0:
79  self.pattern.append(range(1, 1+residual))
80  self.pattern.extend(range(i, i+length) for i in
81  range(residual+1, nplots-length+2, length))
82 
83  self.width = 1.0/length
84  self.height = 0.8/nrows
85 
86 
87 # Write a set of pages, one for each subdetector.
88 # Arguments: identifier: regular expression to get the wanted plots,
89 # used together with subdetector name
90 # title: title of the plot type
91 # validations: list of relevant ValidationPlots objects.
92 # Returns the parsed script.
def fit(self, plots)
Definition: presentation.py:55

Member Data Documentation

presentation.PageLayout.height
presentation.PageLayout.pattern

Definition at line 46 of file presentation.py.

Referenced by presentation.PageLayout.fit(), and dataset.BaseDataset.printFiles().

presentation.PageLayout.width