# Class for parsing CORRELATION file. # # Written by k-fleak # class ParseCorrelation def initialize(filename) @input = open(filename, "r") calcCorrelation end def getCorrelation # key => structure index, value: correlations @correlation end private def calcCorrelation @correlation = Hash.new() @input.each do |lines| unless lines.strip.empty? then if /str/ =~ lines then lineArr = lines.strip.split(/:/) @structure = lineArr[1] corrTmp = Array.new @correlation[@structure] = corrTmp else @correlation[@structure].push(lines.strip.to_f) end end end end end #parse = ParseCorrelation.new("CORRELATION.surf") #p parse.getCorrelation["0103"]