Home | History | Annotate | Download | only in cros_utils

Lines Matching defs:Cell

229   def _Literal(self, cell, values, baseline_values):
230 cell.value = ' '.join([str(v) for v in values])
232 def _ComputeFloat(self, cell, values, baseline_values):
233 self._Literal(cell, values, baseline_values)
235 def _ComputeString(self, cell, values, baseline_values):
236 self._Literal(cell, values, baseline_values)
238 def _InvertIfLowerIsBetter(self, cell):
252 def Compute(self, cell, values, baseline_values):
256 cell: A cell data structure to populate.
264 cell.value = ''
279 cell.value = ''
283 self._ComputeFloat(cell, float_values, float_baseline_values)
284 self._InvertIfLowerIsBetter(cell)
286 self._ComputeString(cell, values, baseline_values)
296 def Compute(self, cell, values, baseline_values):
298 cell.value = values[self.iteration]
300 cell.value = '-'
306 The number of non-empty values will be stored in the cell.
309 def Compute(self, cell, values, baseline_values):
310 """Put the number of non-empty values in the cell result.
313 cell: Put the result in cell.value.
317 cell.value = len(_StripNone(values))
321 if cell.value == base_value:
326 tmp_cell = Cell()
327 tmp_cell.value = 1.0 + (float(cell.value - base_value) /
330 cell.bgcolor = tmp_cell.bgcolor
336 def _ComputeString(self, cell, values, baseline_values):
338 cell.value = str(values[0])
340 cell.value = '?'
346 def _ComputeFloat(self, cell, values, baseline_values):
347 cell.value = numpy.mean(values)
358 def _ComputeFloat(self, cell, values, baseline_values):
359 cell.value = min(values)
361 def _ComputeString(self, cell, values, baseline_values):
363 cell.value = min(values)
365 cell.value = ''
371 def _ComputeFloat(self, cell, values, baseline_values):
372 cell.value = max(values)
374 def _ComputeString(self, cell, values, baseline_values):
376 cell.value = max(values)
378 cell.value = ''
384 def _ComputeString(self, cell, values, baseline_values):
385 cell.value = '?'
391 def _ComputeFloat(self, cell, values, baseline_values):
392 cell.value = numpy.std(values)
398 def _ComputeFloat(self, cell, values, baseline_values):
403 cell.value = noise
412 def _ComputeString(self, cell, values, baseline_values):
421 cell.value = 'SAME'
423 cell.value = 'DIFFERENT'
425 cell.value = '?'
431 def _ComputeFloat(self, cell, values, baseline_values):
433 cell.value = float('nan')
436 _, cell.value = stats.lttest_ind(values, baseline_values)
438 def _ComputeString(self, cell, values, baseline_values):
476 def _InvertIfLowerIsBetter(self, cell):
477 if self._IsLowerBetter(cell.name):
478 if cell.value:
479 cell.value = 1.0 / cell.value
485 def _ComputeFloat(self, cell, values, baseline_values):
487 cell.value = numpy.mean(values) / numpy.mean(baseline_values)
489 cell.value = 0.00
490 # cell.value = 0 means the values and baseline_values have big difference
492 cell.value = 1.00
499 def _ComputeFloat(self, cell, values, baseline_values):
501 cell.value = self._GetGmean(values) / self._GetGmean(baseline_values)
503 cell.value = 0.00
505 cell.value = 1.00
557 def Compute(self, cell):
558 """Computes the attributes of a cell based on its value.
563 cell: The cell whose attributes are to be populated.
565 if cell.value is None:
566 cell.string_value = ''
567 if isinstance(cell.value, float):
568 self._ComputeFloat(cell)
570 cell)
572 def _ComputeFloat(self, cell):
573 cell.string_value = '{0:.2f}'.format(cell.value)
575 def _ComputeString(self, cell):
576 cell.string_value = str(cell.value)
608 def _ComputeFloat(self, cell):
609 cell.string_value = '%0.2f' % float(cell.value)
610 if float(cell.value) < 0.05:
611 cell.bgcolor = self._GetColor(cell.value,
620 """Format the cell as a storage number.
623 If the cell contains a value of 1024, the string_value will be 1.0K.
626 def _ComputeFloat(self, cell):
629 v = float(cell.value)
636 cell.string_value = '%1.1f%s' % ((v / divisor), suffices[current - 1])
638 cell.string_value = str(cell.value)
642 """Format the cell as a percent.
645 If the cell contains a value of 1.5, the string_value will be +150%.
648 def _ComputeFloat(self, cell):
649 cell.string_value = '%1.1f%%' % (float(cell.value) * 100)
650 cell.color = self._GetColor(cell.value,
659 """Format the cell as a percent.
662 If the cell contains a value of 1.5, the string_value will be +50%.
665 def _ComputeFloat(self, cell):
666 cell.string_value = '%+1.1f%%' % ((float(cell.value) - 1) * 100)
667 cell.color = self._GetColor(cell.value, Color(255, 0, 0, 0),
672 """Format the cell as a ratio.
675 If the cell contains a value of 1.5642, the string_value will be 1.56.
678 def _ComputeFloat(self, cell):
679 cell.string_value = '%+1.1f%%' % ((cell.value - 1) * 100)
680 cell.color = self._GetColor(cell.value, Color(255, 0, 0, 0),
685 """Format the cell as a color box.
688 If the cell contains a value of 1.5, it will get a green color.
689 If the cell contains a value of 0.5, it will get a red color.
694 def _ComputeFloat(self, cell):
695 cell.string_value = '--'
696 bgcolor = self._GetColor(cell.value, Color(255, 0, 0, 0),
698 cell.bgcolor = bgcolor
699 cell.color = bgcolor
702 class Cell(object):
703 """A class to represent a cell in a table.
706 value: The raw value of the cell.
707 color: The color of the cell.
708 bgcolor: The background color of the cell.
709 string_value: The string value of the cell.
712 color_row: Indicates whether the whole row is to inherit this cell's color.
713 bgcolor_row: Indicates whether the whole row is to inherit this cell's
717 colspan: Set the colspan of the cell in the HTML table, this is used for
719 name: the test name of the cell.
769 """Class to convert a plain table into a cell-table.
800 key = Cell()
806 cell = Cell()
807 cell.name = key.string_value
810 column.result.Compute(cell, values, baseline)
811 column.fmt.Compute(cell)
812 out_row.append(cell)
816 column.result.Compute(cell, values, baseline)
817 column.fmt.Compute(cell)
818 out_row.append(cell)
832 key = Cell()
838 cell = Cell()
839 cell.name = key.string_value
840 column.result.Compute(cell, ['Fail'], baseline)
841 column.fmt.Compute(cell)
842 out_row.append(cell)
849 key = Cell()
854 cell = Cell()
855 cell.header = True
857 cell.string_value = column.name
862 cell.string_value = '%s %s' % (result_name.replace('Result', ''),
865 header.append(cell)
871 cell = Cell()
872 cell.header = True
873 cell.string_value = str(s)
874 header = [cell]
876 cell.colspan = colspan
904 # The first cell has colspan 1, the second is base_colspan
908 cell = Cell()
909 cell.header = True
915 cell.string_value = str(label) + ' (pass:%d fail:%d)' % (passes,
918 cell.string_value = str(label)
920 cell.string_value = str(label)
922 cell.colspan = base_colspan
924 cell.colspan = compare_colspan
925 top_header.append(cell)
932 for cell in row:
933 o += str(cell) + ' '
948 A table of cells with each cell having the properties and string values as
951 # Generate the cell table, creating a list of dynamic columns on the fly.
961 """Class to print a cell table to the console, file or html."""
969 """Constructor that stores the cell table and output type."""
979 row_style = Cell()
980 for cell in row:
981 if cell.color_row:
982 assert cell.color, 'Cell color not set but color_row set!'
984 row_style.color = cell.color
985 if cell.bgcolor_row:
986 assert cell.bgcolor, 'Cell bgcolor not set but bgcolor_row set!'
988 row_style.bgcolor = cell.bgcolor
996 column_style = Cell()
998 if not any([cell.colspan != 1 for cell in row]):
1042 cell = self._table[i][j]
1043 out = cell.string_value
1046 if cell.color:
1047 p, s = self._GetColorFix(cell.color)
1050 if cell.bgcolor:
1051 p, s = self._GetBGColorFix(cell.bgcolor)
1055 if cell.width:
1056 width = cell.width
1061 width = len(cell.string_value)
1062 if cell.colspan > 1:
1067 for k in range(cell.colspan):
1074 if cell.header:
1078 out = "<{0} colspan = \"{2}\"> {1} </{0}>".format(tag, out, cell.colspan)