コード例 #1
0
    def generateJS(self, rep, entries, clampTime, step):
        # Create the list of techniques filenames
        listCSVFiles = []
        for e in entries:
            if(e.time == ""):
                listCSVFiles.append(e.technique)
            else:
                listCSVFiles.append(e.technique+","+e.time)
        print(listCSVFiles)
        
        # Read all associated CSV
        useLog = self.log
        if self.csv == "time":
            # Special case when we need to display rendering time
            useLog = False

        techniques = showResults.readAllTechniques(listCSVFiles, rep, step, useLog,  basey='_'+self.csv+'.csv')
        
        # Generate JS file
        totalText = '$(function() { $.plot("#'+self.getName()+'",['
        for i in range(len(techniques)):
            t = techniques[i]
            if(clampTime != -1):
                if not self.log:
                    t.clampTime(clampTime)
                else:    
                    t.clampTime(math.log10(float(clampTime)))
                
            print(entries[i].name, t.name)
            # Data row
            
            totalText += "{data: "
            
            if self.csv == "time":
                if self.log:
                    totalText += str(t.generateConstantDataXLog())
                else:
                    totalText += str(t.generateConstantDataX())
            else:
                totalText += str(t.generatePairData())
            totalText += ', label: "' + entries[i].name + '"'
            if(entries[i].dashed):
                totalText += ', dashes: { show: true }'
            totalText += '}'
            
            if(t != techniques[-1]):
                totalText += ",\n"
        totalText += "]"
        
        # Color dicts
        totalText += ",{colors: ["
        for e in entries:
            totalText += '"' + e.color + '", '
        totalText += ']'
        
        totalText += """, xaxis: {
            axisLabel: '"""+self.xlabel+"""',
            axisLabelUseCanvas: true,
            axisLabelFontSizePixels: 14,
            axisLabelFontFamily: 'Ubuntu, Calibri, Lucida Grande',
            axisLabelPadding: 10,
        }, 
        yaxis: {
            ticks: 10,
            tickDecimals: 3,
            axisLabel: '"""+self.ylabel+"""',
            axisLabelUseCanvas: true,
            axisLabelFontSizePixels: 14,
            axisLabelFontFamily: 'Ubuntu, Calibri, Lucida Grande',
            axisLabelPadding: 10,
        }});\n"""
        
        # Close the end JS
        totalText += '});' 
        
        return totalText
コード例 #2
0
ファイル: paperplot_size.py プロジェクト: gradientpm/gvpm
    ]

    extractedData = {}
    maxLenghtData = 0
    print(opts.input)

    # Construct techniques names
    requestedTech = []
    for alg in algorithms:
        requestedTech.append(alg.metricBaseName)

    # Read all the requested techniques
    # And copy the data values
    techniques = showResults.readAllTechniques(requestedTech,
                                               opts.input,
                                               5,
                                               False,
                                               basey='_' + errorName + '.csv')
    for alg in algorithms:
        currentTech = None
        for tech in techniques:
            if tech.name == alg.metricBaseName.split(",")[0]:
                currentTech = tech

        (times, values) = (currentTech.x, currentTech.y)

        name = alg.name
        extractedData[name] = (times, values)
        #maxLenghtData = max(len(data), maxLenghtData)

    # Change the font option