Example #1
0
    def getResultPartPath(self, statName, part):
        syntaxDir = os.path.join(FileSystem.getResultsDir(),
                                 'syntaxStatistics')
        statDir = os.path.join(syntaxDir, statName)
        fileName = statName + '_' + str(part[0]) + '_' + str(part[1]) + '.csv'

        if not os.path.exists(statDir):
            os.makedirs(statDir)
        return os.path.join(statDir, fileName)
Example #2
0
 def getOutputPath(self, assn, Cidx, label):
     resultsDir = FileSystem.getResultsDir()
     clustersDir = os.path.join(resultsDir, 'clusters')
     if not os.path.exists(clustersDir):
         os.makedirs(clustersDir)
     connectedCompDir = os.path.join(clustersDir, 'connectedComponents')
     if not os.path.exists(connectedCompDir):
         os.makedirs(connectedCompDir)
     filename = label + 'cluster_' + str(assn) + '_' + str(Cidx) + '.txt'
     return os.path.join(connectedCompDir, filename)
 def load(self, statName, astNetwork):
     syntaxDir = os.path.join(FileSystem.getResultsDir(),
                              'interplayStatistics')
     statDir = os.path.join(syntaxDir, statName)
     fileName = statName + '_' + str(astNetwork.part[0]) + '_' + str(
         astNetwork.part[1]) + '.csv'
     path = os.path.join(statDir, fileName)
     if not os.path.exists(path):
         raise Exception('File not found')
     return numpy.loadtxt(path, delimiter=",")
 def save(self, statName, astNetwork, matrix):
     syntaxDir = os.path.join(FileSystem.getResultsDir(),
                              'interplayStatistics')
     statDir = os.path.join(syntaxDir, statName)
     fileName = statName + '_' + str(astNetwork.part[0]) + '_' + str(
         astNetwork.part[1]) + '.csv'
     if not os.path.exists(statDir):
         os.makedirs(statDir)
     path = os.path.join(statDir, fileName)
     numpy.savetxt(path, matrix, delimiter=",")
Example #5
0
 def GetClusterPath(self, assn, clusterId, label):
     resultsDir = FileSystem.getResultsDir()
     connectedCompDir = os.path.join(resultsDir, 'clusters',
                                     'connectedComponents')
     filename = label + 'cluster_' + str(assn) + '_' + str(
         clusterId) + '.txt'
     fullpath = os.path.join(connectedCompDir, filename)
     if not os.path.exists(fullpath):
         print('Error: file was not found')
         print('\tpath: ' + fullpath)
         sys.exit(1)
     else:
         return fullpath
Example #6
0
 def saveOverallStat(self, statName, values):
     dir = os.path.join(FileSystem.getResultsDir(), 'syntaxStatistics')
     dir = os.path.join(dir, 'overallStats')
     if not os.path.exists(dir):
         os.makedirs(dir)
     histogram = numpy.histogram(values, HISTOGRAM_BUCKETS, range=(0, 1))
     histogramMatrix = []
     for index in range(len(histogram[0])):
         x = histogram[1][index]
         y = histogram[0][index]
         histogramMatrix.append([x, y])
     histogramPath = os.path.join(dir, statName + 'Hist.csv')
     valuesPath = os.path.join(dir, statName + 'Values.csv')
     numpy.savetxt(valuesPath, values, delimiter=",")
     numpy.savetxt(histogramPath, histogramMatrix, delimiter=",")
Example #7
0
 def _getAffinityExemplarFile(self, assn):
     resultsDir = FileSystem.getResultsDir()
     fileDir =  os.path.join(resultsDir, 'clusters/affinityExemplars')
     fileName = 'exemplars_' + str(assn) + '.txt'
     exemplarFile = os.path.join(fileDir, fileName)
     return open(exemplarFile)