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 43 of file presentation.py.

Constructor & Destructor Documentation

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

Definition at line 44 of file presentation.py.

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

Member Function Documentation

def presentation.PageLayout.fit (   self,
  plots 
)

Definition at line 54 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().

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

Member Data Documentation

presentation.PageLayout.height
presentation.PageLayout.pattern

Definition at line 45 of file presentation.py.

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

presentation.PageLayout.width