示例#1
0
def plotPerformanceData(csvLike, titleTemplate, outputTemplate, targetColumn, yLabel,
                        patternMap, params, scale=Decimal(1.0), xRange='*:*', debug=False):
                        
  """
  params :: [(pattern :: str, bsU :: str, yRange :: str|None)]
      list of parameters.
  
  """
  assert(isinstance(csvLike, CsvLike))
  assert(isinstance(titleTemplate, str))
  assert(isinstance(outputTemplate, str))
  assert(isinstance(targetColumn, str))
  assert(isinstance(yLabel, str))
  assert(isinstance(patternMap, dict))
  assert(isinstance(params, list))
  assert(isinstance(scale, Decimal))
  assert(isinstance(xRange, str))
  assert(isinstance(debug, bool))
  
  for pattern, blockSizeU, yRange in params:
    title = titleTemplate % (patternMap[pattern], blockSizeU)
    output = outputTemplate % (pattern, blockSizeU)
    blockSizeS = str(util.u2s(blockSizeU))
    if yRange is None:
      yRange = '0:*'
    rp = PerformancePlot(csvLike, pattern, blockSizeS,
                         targetColumn, yLabel, title, output,
                         scale, xRange, yRange, debug)
    rp.plot()
示例#2
0
def plotMultiData(relColLegList,
                  titleTemplate,
                  outputTemplate,
                  yLabel,
                  patternMap,
                  params,
                  scale=Decimal(1.0),
                  xRange='*:*',
                  debug=False):
    """
  relColLegList :: [(rel, col, legend)]
    rel :: Relation
    col :: str
      target column name
    legend :: str
      legend title in the plot.
    Each legend must be unique in the list.
  
  params :: [(pattern :: str, mode :: str, bsU :: str, yRange :: str|None)]
      list of parameters.
  
  """
    assert (isinstance(relColLegList, list))
    assert (isinstance(titleTemplate, str))
    assert (isinstance(outputTemplate, str))
    assert (isinstance(yLabel, str))
    assert (isinstance(patternMap, dict))
    assert (isinstance(params, list))
    assert (isinstance(scale, Decimal))
    assert (isinstance(xRange, str))
    assert (isinstance(debug, bool))

    for pattern, mode, bsU, yRange in params:
        title = titleTemplate % (patternMap[pattern], mode, bsU)
        output = outputTemplate % (pattern, mode, bsU)
        bsS = str(util.u2s(bsU))
        if yRange is None:
            yRange = '0:*'
        rp = MultiPlot(relColLegList, pattern, mode, bsS, yLabel, title,
                       output, scale, xRange, yRange, debug)
        rp.plot()

    pass
示例#3
0
def plotMultiData(relColLegList, titleTemplate, outputTemplate,
                  yLabel, patternMap,
                  params, scale=Decimal(1.0), xRange='*:*', debug=False):
  """
  relColLegList :: [(rel, col, legend)]
    rel :: Relation
    col :: str
      target column name
    legend :: str
      legend title in the plot.
    Each legend must be unique in the list.
  
  params :: [(pattern :: str, mode :: str, bsU :: str, yRange :: str|None)]
      list of parameters.
  
  """
  assert(isinstance(relColLegList, list))
  assert(isinstance(titleTemplate, str))
  assert(isinstance(outputTemplate, str))
  assert(isinstance(yLabel, str))
  assert(isinstance(patternMap, dict))
  assert(isinstance(params, list))
  assert(isinstance(scale, Decimal))
  assert(isinstance(xRange, str))
  assert(isinstance(debug, bool))

  if len(params) == 0:
    raise "params list is empty."

  for pattern, mode, bsU, yRange in params:
    title = titleTemplate % (patternMap[pattern], mode, bsU)
    output = outputTemplate % (pattern, mode, bsU)
    bsS = str(util.u2s(bsU))
    if yRange is None:
      yRange = '0:*'
    rp = MultiPlot(relColLegList, pattern, mode, bsS,
                   yLabel, title, output,
                   scale, xRange, yRange, debug)
    rp.plot()
  
  pass
示例#4
0
def plotPerformanceData(csvLike,
                        titleTemplate,
                        outputTemplate,
                        targetColumn,
                        yLabel,
                        patternMap,
                        params,
                        scale=Decimal(1.0),
                        xRange='*:*',
                        debug=False):
    """
  params :: [(pattern :: str, bsU :: str, yRange :: str|None)]
      list of parameters.
  
  """
    assert (isinstance(csvLike, CsvLike))
    assert (isinstance(titleTemplate, str))
    assert (isinstance(outputTemplate, str))
    assert (isinstance(targetColumn, str))
    assert (isinstance(yLabel, str))
    assert (isinstance(patternMap, dict))
    assert (isinstance(params, list))
    assert (isinstance(scale, Decimal))
    assert (isinstance(xRange, str))
    assert (isinstance(debug, bool))

    for pattern, blockSizeU, yRange in params:
        title = titleTemplate % (patternMap[pattern], blockSizeU)
        output = outputTemplate % (pattern, blockSizeU)
        blockSizeS = str(util.u2s(blockSizeU))
        if yRange is None:
            yRange = '0:*'
        rp = PerformancePlot(csvLike, pattern, blockSizeS, targetColumn,
                             yLabel, title, output, scale, xRange, yRange,
                             debug)
        rp.plot()
示例#5
0
文件: expr.py 项目: herumi/ioreth
 def setBsU(self, bsU):
     assert(isinstance(bsU, str))
     assert(isinstance(util.u2s(bsU), int))
     self.__bsU = bsU
     self.__bs = util.u2s(bsU)
示例#6
0
文件: param.py 项目: herumi/ioreth
 def blockSizeUnitListCheck(self):
     self.checkParamList('blockSizeUnitList', str)
     for bsU in self.blockSizeUnitList():
         bs = util.u2s(bsU)
         checkAndThrow(isinstance(bs, int), 'bs must be int.')
         checkAndThrow(bs > 0, 'bs must > 0.')
示例#7
0
                  for bsU in blockSizeUnitList for nth in nThreadsList
                  for width in widthList]

    def histogramG(f):
        for line in f:
            rec = line.rstrip().split()
            yield (Decimal(rec[0]), int(rec[1]))

    for plotDir, outDir in zip(plotDirList, outDirList):

        if not os.path.exists(outDir):
            os.makedirs(outDir)

        for pattern, mode, bsU, nth, width in paramsList:
            fn = '%s/%s/%s/%s/%s/histogram_%s' % \
                (plotDir, pattern, mode, nth, str(util.u2s(bsU)), width)
            title = 'Histogram with %s %s, blocksize %s, nThreads %s, width %s' % \
                (patternMap[pattern], mode, bsU, nth, width)
            outputFile = outFileTemplate % (pattern, mode, bsU, nth, width)
            output = "%s/%s" % (outDir, outputFile)
            f = open(fn)
            hp = HistogramPlot(histogramG(f),
                               width,
                               title,
                               output,
                               debug=False)
            hp.plot()
            f.close()


if __name__ == "__main__":
示例#8
0
 def blockSizeUnitListCheck(self):
     self.checkParamList('blockSizeUnitList', str)
     for bsU in self.blockSizeUnitList():
         bs = util.u2s(bsU)
         checkAndThrow(isinstance(bs, int), 'bs must be int.')
         checkAndThrow(bs > 0, 'bs must > 0.')
示例#9
0
  paramsList = [(pattern, mode, bsU, nth, width)
                for (pattern, mode) in patternModeList
                for bsU in blockSizeUnitList
                for nth in nThreadsList
                for width in widthList]
  
  def histogramG(f):
    for line in f:
      rec = line.rstrip().split()
      yield (Decimal(rec[0]), int(rec[1]))
  
  for plotDir, outDir in zip(plotDirList, outDirList):

    if not os.path.exists(outDir):
      os.makedirs(outDir)
    
    for pattern, mode, bsU, nth, width in paramsList:
      fn = '%s/%s/%s/%s/%s/histogram_%s' % \
          (plotDir, pattern, mode, nth, str(util.u2s(bsU)), width)
      title = 'Histogram with %s %s, blocksize %s, nThreads %s, width %s' % \
          (patternMap[pattern], mode, bsU, nth, width)
      outputFile = outFileTemplate % (pattern, mode, bsU, nth, width)
      output = "%s/%s" % (outDir, outputFile)
      f = open(fn)
      hp = HistogramPlot(histogramG(f), width, title, output, debug=False)
      hp.plot()
      f.close()
  
if __name__ == "__main__":
  doMain()