# Class for parsing sigmaSet.out # # Written by k-fleak # class ParseSigmaSet def initialize(filename) @input = open(filename, "r") @numCluster, @sigmaProd = getData end def getNumCluster # [Cluster index(before sorting), num cluster] @numCluster end def getSigmaProd # [Cluster index, sigma product] @sigmaProd end private def getData ptmp = Hash.new() ptmp2 = Hash.new() cindex = 0 @input.each do |lines| unless lines.strip.empty? then lineArr = lines.strip.split # NumCluster is 8times for original cell. Therefore, # devide by "8". case cindex when 0 ptmp[cindex.to_i] = lineArr[1].to_f ptmp2[cindex.to_i] = lineArr[0].to_f else ptmp[cindex.to_i] = lineArr[1].to_f / 8 ptmp2[cindex.to_i] = lineArr[0].to_f / 8 end cindex += 1 end end return ptmp, ptmp2 end end