Mercurial Hosting > traffic-intelligence
comparison python/ubc_utils.py @ 67:ded58c424783
added indicator computation and modified severity indicator constructor
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Sun, 07 Nov 2010 04:21:26 -0500 |
parents | 290fceb125d2 |
children | fae55a4c7a5a |
comparison
equal
deleted
inserted
replaced
66:56fe4ef1377e | 67:ded58c424783 |
---|---|
138 while (lines != []) and ((nInteractions<0) or (interactionNum<nInteractions)): | 138 while (lines != []) and ((nInteractions<0) or (interactionNum<nInteractions)): |
139 parsedLine = [int(n) for n in lines[0].split(' ')] | 139 parsedLine = [int(n) for n in lines[0].split(' ')] |
140 inter = Interaction(interactionNum, TimeInterval(parsedLine[1],parsedLine[2]), parsedLine[3], parsedLine[4], categoryNum = parsedLine[5]) | 140 inter = Interaction(interactionNum, TimeInterval(parsedLine[1],parsedLine[2]), parsedLine[3], parsedLine[4], categoryNum = parsedLine[5]) |
141 | 141 |
142 indicatorFrameNums = [int(n) for n in lines[1].split(' ')] | 142 indicatorFrameNums = [int(n) for n in lines[1].split(' ')] |
143 indicators = [] | 143 inter.indicators = [] |
144 for indicatorNum,line in enumerate(lines[2:]): | 144 for indicatorNum,line in enumerate(lines[2:]): |
145 values = {} | 145 values = {} |
146 for i,v in enumerate([float(n) for n in line.split(' ')]): | 146 for i,v in enumerate([float(n) for n in line.split(' ')]): |
147 values[indicatorFrameNums[i]] = v | 147 values[indicatorFrameNums[i]] = v |
148 indicators.append(SeverityIndicator(severityIndicatorNames[indicatorNum], values, mostSevereIsMax[indicatorNum], ignoredValue[indicatorNum])) | 148 inter.indicators.append(SeverityIndicator(severityIndicatorNames[indicatorNum], values, None, mostSevereIsMax[indicatorNum], ignoredValue[indicatorNum])) |
149 inter.indicators = indicators | |
150 | 149 |
151 interactions.append(inter) | 150 interactions.append(inter) |
152 interactionNum+=1 | 151 interactionNum+=1 |
153 lines = utils.getLines(file) | 152 lines = utils.getLines(file) |
154 | 153 |