当前位置: 首页>>代码示例>>Python>>正文


Python Reader.readAnalysisInfo方法代码示例

本文整理汇总了Python中util.Reader.readAnalysisInfo方法的典型用法代码示例。如果您正苦于以下问题:Python Reader.readAnalysisInfo方法的具体用法?Python Reader.readAnalysisInfo怎么用?Python Reader.readAnalysisInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在util.Reader的用法示例。


在下文中一共展示了Reader.readAnalysisInfo方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getBars

# 需要导入模块: from util import Reader [as 别名]
# 或者: from util.Reader import readAnalysisInfo [as 别名]
def getBars():
   """Classifies the time difference in single bars."""
   taxis=reader.readAnalysisInfo(WEE)   
   barsDict={}
   barsDictSim={}
   stdDev=[]
   mw=[]
   for taxi in taxis:
        if len(taxi.getSteps())<1:
            continue        
        try:
            #diff=getTimeDiff(taxi.getSteps(),False)
            diffSim,fcd,sim,no=getTimeDiff(taxi.getSteps())
            
            #anna     
            if diffSim>150:  
                print diffSim," ",taxi.id," ",no," ",fcd," ",sim                 
            
            #standard deviation 
            stdDev.append((diffSim-9.46)*(diffSim-9.46))   
            mw.append(diffSim) 
            #classify the absolute time difference
            #barsDict[(diff/10)*10]=barsDict.setdefault((diff/10)*10,0)+1   
            barsDictSim[(diffSim/10)*10]=barsDictSim.setdefault((diffSim/10)*10,0)+1 
        except TypeError, e:
            tueNichts=True
开发者ID:florianjomrich,项目名称:veinsSimConnectionToUnity,代码行数:28,代码来源:Traveltime.py

示例2: getBarsMulti

# 需要导入模块: from util import Reader [as 别名]
# 或者: from util.Reader import readAnalysisInfo [as 别名]
def getBarsMulti():
    """Classifies the time difference in single bars.
     But uses insted of getBars() several analysis-File and calculates a mean value"""          
        
    fileIter=iglob(path.newPath(path.main,"auswertung/reisezeit/analysisFiles/taxiAnalysisInformation*.xml"))
    fcdDiffDict={}
    simDiffDict={}
    barsDict={}
    barsDictSim={}
    stdDev=[]
    mw=[]
    #calc diffs
    for file in fileIter: #for each 
        path.analysisWEE=path.newPath(file)
        print path.analysisWEE
        taxis=reader.readAnalysisInfo(WEE)
        
        for taxi in taxis:
            if len(taxi.getSteps())<1:                
                continue        
            try:
                #diff=getTimeDiff(taxi.getSteps(),False)
                diffSim,fcd,sim,no=getTimeDiff(taxi.getSteps())
                simDiffDict.setdefault(taxi.id,[]).append(sim)
                fcdDiffDict.setdefault(taxi.id,fcd)
                
            except TypeError, e:
                tueNichts=True                
开发者ID:cathyyul,项目名称:sumo-0.18,代码行数:30,代码来源:TraveltimeMulti.py

示例3: getBars

# 需要导入模块: from util import Reader [as 别名]
# 或者: from util.Reader import readAnalysisInfo [as 别名]
def getBars():
    """Classifies the time difference in single bars."""
    taxis = reader.readAnalysisInfo(WEE)
    barsDict = {}
    barsDictSim = {}
    stdDev = []
    mw = []
    for taxi in taxis:
        if len(taxi.getSteps()) < 1:
            continue
        try:
            # diff=getTimeDiff(taxi.getSteps(),False)
            diffSim, fcd, sim, no = getTimeDiff(taxi.getSteps())

            # anna
            if diffSim > 150:
                print(diffSim, " ", taxi.id, " ", no, " ", fcd, " ", sim)

            # standard deviation
            stdDev.append((diffSim - 9.46) * (diffSim - 9.46))
            mw.append(diffSim)
            # classify the absolute time difference
            # barsDict[(diff/10)*10]=barsDict.setdefault((diff/10)*10,0)+1
            barsDictSim[
                (diffSim / 10) * 10] = barsDictSim.setdefault((diffSim / 10) * 10, 0) + 1
        except TypeError as e:
            tueNichts = True
            # print "Error by taxi %s : %s"  %(taxi.id,e.message)
    print("mw", sum(mw) / (len(mw) + 0.0))  # 9.46
    print("standard deviation ", sqrt(sum(stdDev) / (len(stdDev) + 0.0)))
    return (barsDictSim, barsDict)
开发者ID:702nADOS,项目名称:sumo,代码行数:33,代码来源:Traveltime.py

示例4: getPiePieces

# 需要导入模块: from util import Reader [as 别名]
# 或者: from util.Reader import readAnalysisInfo [as 别名]
def getPiePieces():
    """Classifies the relative time difference into pieces (intervals) used for drawing the pie chart."""
    taxis = reader.readAnalysisInfo()
    pieces = [0, 0, 0, 0, 0, 0]
    for taxi in taxis:
        try:
            diff = getTimeDiff(taxi.getSteps())
        except TypeError as e:
            print("Error by taxi %s : %s" % (taxi.id, e.message))

        # classify the relative time difference
        #<10%', '10%-30%', '30%-50%', '50%-70%', '70%-90%', '>90%
        if diff < 10:
            pieces[0] += 1
        elif diff < 30:
            pieces[1] += 1
        elif diff < 50:
            pieces[2] += 1
        elif diff < 70:
            pieces[3] += 1
        elif diff < 90:
            pieces[4] += 1
        else:
            pieces[5] += 1
    print(pieces)
    print(sum(pieces))
    return pieces
开发者ID:702nADOS,项目名称:sumo,代码行数:29,代码来源:Traveltime.py

示例5: getAveragedValues

# 需要导入模块: from util import Reader [as 别名]
# 或者: from util.Reader import readAnalysisInfo [as 别名]
def getAveragedValues(interval):
    """catches all data in the given interval steps and calculates the average speed for each interval."""
    timeValues = range(0, 86410, interval)
    fcdValues = [[] for i in range(0, 86410, interval)]
    simFcdValues = [[] for i in range(0, 86410, interval)]
    vtypeValues = [[] for i in range(0, 86410, interval)]
    relErrorValues = [[] for i in range(0, 86410, interval)]
    absErrorValues = [[] for i in range(0, 86410, interval)]
    fcdValuesNo = [set() for i in range(0, 86410, interval)]
    simFcdValuesNo = [set() for i in range(0, 86410, interval)]
    vtypeValuesNo = [set() for i in range(0, 86410, interval)]
    taxis = reader.readAnalysisInfo(WEE)

    # helper function
    def calcAverageOrLen(list, no=False):
        for i in range(len(list)):
            if len(list[i]) > 0:
                if no:  # if no True clac Len
                    list[i] = len(list[i])
                else:
                    list[i] = sum(list[i]) / len(list[i])
            else:
                list[i] = None
        return list

    for taxi in taxis:
        for step in taxi.getSteps():
            if step.source == SOURCE_FCD:
                # add the speed to the corresponding time interval
                fcdValues[step.time / interval].append(step.speed)
                fcdValuesNo[step.time / interval].add(taxi.id)
            elif step.source == SOURCE_SIMFCD:
                # add the speed to the corresponding time interval
                simFcdValues[step.time / interval].append(step.speed)
                simFcdValuesNo[step.time / interval].add(taxi.id)
            elif step.source == SOURCE_VTYPE:
                # add the speed to the corresponding time interval
                vtypeValues[step.time / interval].append(step.speed)
                vtypeValuesNo[step.time / interval].add(taxi.id)

    vtypeValues = calcAverageOrLen(vtypeValues)
    fcdValues = calcAverageOrLen(fcdValues)
    simFcdValues = calcAverageOrLen(simFcdValues)
    vtypeValuesNo = calcAverageOrLen(vtypeValuesNo, True)
    fcdValuesNo = calcAverageOrLen(fcdValuesNo, True)
    simFcdValuesNo = calcAverageOrLen(simFcdValuesNo, True)

    # calc relative Error
    for i in range(len(fcdValues)):
        if simFcdValues[i] is None or fcdValues[i] is None:
            relErrorValues[i] = None
            absErrorValues[i] = None
        else:
            # (angezeigter-richtiger Wert)
            absErr = simFcdValues[i] - fcdValues[i]
            relErrorValues[i] = absErr / float(fcdValues[i]) * 100
            absErrorValues[i] = absErr
    return ([timeValues, fcdValues, simFcdValues, vtypeValues, fcdValuesNo, simFcdValuesNo, vtypeValuesNo,
            relErrorValues, absErrorValues], interval)
开发者ID:fieryzig,项目名称:sumo,代码行数:61,代码来源:VelocityCurve.py

示例6: main

# 需要导入模块: from util import Reader [as 别名]
# 或者: from util.Reader import readAnalysisInfo [as 别名]
def main(): 
    print "start program"
    global taxis, edgeDict 
    #load data
    edgeDict=load(open(path.edgeLengthDict,'r'))
    taxis=reader.readAnalysisInfo(WEE)
    plotAllTaxis()
    #plotIt(taxiId)
    #reader.readEdgesLength()
    print "end"
开发者ID:harora,项目名称:ITS,代码行数:12,代码来源:VelocityOverRoute.py

示例7: clacAvg

# 需要导入模块: from util import Reader [as 别名]
# 或者: from util.Reader import readAnalysisInfo [as 别名]
def clacAvg():
   durationList=[]
   taxis=reader.readAnalysisInfo()   
   for taxi in taxis:
       try:    
           dur=getTimeDiff(taxi.getSteps())
           durationList.append(dur)
           if dur >=1479:
               print "maxtaxi", taxi
       except TypeError, e:
            print "Error by taxi %s : %s"  %(taxi.id,e.message) 
开发者ID:florianjomrich,项目名称:veinsSimConnectionToUnity,代码行数:13,代码来源:Traveltime.py

示例8: getBarsMulti

# 需要导入模块: from util import Reader [as 别名]
# 或者: from util.Reader import readAnalysisInfo [as 别名]
def getBarsMulti():
    """Classifies the time difference in single bars.
     But uses insted of getBars() several analysis-File and calculates a mean value"""

    fileIter = iglob(path.newPath(
        path.main, "auswertung/reisezeit/analysisFiles/taxiAnalysisInformation*.xml"))
    fcdDiffDict = {}
    simDiffDict = {}
    barsDict = {}
    barsDictSim = {}
    stdDev = []
    mw = []
    # calc diffs
    for file in fileIter:  # for each
        path.analysisWEE = path.newPath(file)
        print(path.analysisWEE)
        taxis = reader.readAnalysisInfo(WEE)

        for taxi in taxis:
            if len(taxi.getSteps()) < 1:
                continue
            try:
                # diff=getTimeDiff(taxi.getSteps(),False)
                diffSim, fcd, sim, no = getTimeDiff(taxi.getSteps())
                simDiffDict.setdefault(taxi.id, []).append(sim)
                fcdDiffDict.setdefault(taxi.id, fcd)

            except TypeError as e:
                tueNichts = True
                # print "Error by taxi %s : %s"  %(taxi.id,e.message)

    for taxi, simList in simDiffDict.iteritems():
        simDiffDict[taxi] = sum(simList) / (len(simList) + 0.0)
    # create barsDict
    for taxi in fcdDiffDict:
        fcd = fcdDiffDict[taxi]
        sim = simDiffDict[taxi]
        diff = sim - fcd
        relDiff = int(round(((100.0 * diff) / fcd)))
        barsDictSim[
            (relDiff / 10) * 10] = barsDictSim.setdefault((relDiff / 10) * 10, 0) + 1
        # standard deviation
        stdDev.append((relDiff - 9.53) * (relDiff - 9.53))
        mw.append(relDiff)
    print("mw", sum(mw) / (len(mw) + 0.0))  # 9.91 #kor 0.48
    print("standard deviation ", sqrt(sum(stdDev) / (len(stdDev) + 0.0)))
    return (barsDictSim, barsDict)
开发者ID:702nADOS,项目名称:sumo,代码行数:49,代码来源:TraveltimeMulti.py

示例9: clacAvg

# 需要导入模块: from util import Reader [as 别名]
# 或者: from util.Reader import readAnalysisInfo [as 别名]
def clacAvg():
    durationList = []
    taxis = reader.readAnalysisInfo()
    for taxi in taxis:
        try:
            dur = getTimeDiff(taxi.getSteps())
            durationList.append(dur)
            if dur >= 1479:
                print("maxtaxi", taxi)
        except TypeError as e:
            print("Error by taxi %s : %s" % (taxi.id, e.message))
    print("no", len(durationList))
    print("avg", sum(durationList) / (len(durationList) + 0.0), "s =", end=" ")
    CalcTime.getSecsInTime(int(round(sum(durationList) / (len(durationList) + 0.0))))
    print("min", min(durationList), "s =", end=" ")
    CalcTime.getSecsInTime(min(durationList))
    print("max", max(durationList), "s =", end=" ")
    CalcTime.getSecsInTime(max(durationList))
开发者ID:planetsumo,项目名称:sumo,代码行数:20,代码来源:TraveltimeMulti.py

示例10: getDataForTaxi

# 需要导入模块: from util import Reader [as 别名]
# 或者: from util.Reader import readAnalysisInfo [as 别名]
def getDataForTaxi(taxiId):
     """Gets the Data for a single Taxi"""     
     values=[[],[],[],[],[],[]] #x1,y1,x2,y2,x3,y3
     starttime=0
     
     taxis=reader.readAnalysisInfo(WEE) 
     for step in taxis[taxis.index(taxiId)].getSteps():
        if step.source==SOURCE_FCD:
            values[0].append(step.time-starttime)
            values[1].append(step.speed)  
        elif step.source==SOURCE_SIMFCD:
            values[2].append(step.time-starttime)
            values[3].append(step.speed)           
        elif step.source==SOURCE_VTYPE: 
            if starttime==0:             
                starttime=step.time
            values[4].append(step.time-starttime)
            values[5].append(step.speed)
     return (values,starttime)       
开发者ID:namnatulco,项目名称:sumo-complete,代码行数:21,代码来源:VelocityCurve.py

示例11: main

# 需要导入模块: from util import Reader [as 别名]
# 或者: from util.Reader import readAnalysisInfo [as 别名]
def main():
    print("start program")
    global taxis, edgeDict

    # decide if you want to save charts for every taxi or show a single one
    all = False
    taxiId = "316_3"

    # load data
    edgeDict = load(open(path.edgeLengthDict, "r"))
    taxis = reader.readAnalysisInfo(WEE)
    # reader.readEdgesLength()

    if all:
        plotAllTaxis()
    else:
        plotIt(taxiId)
        show()

    print("end")
开发者ID:702nADOS,项目名称:sumo,代码行数:22,代码来源:VelocityOverTime.py

示例12: getSpeeds

# 需要导入模块: from util import Reader [as 别名]
# 或者: from util.Reader import readAnalysisInfo [as 别名]
def getSpeeds():
    """Reads the speeds from the analysis file"""
    
    taxis=reader.readAnalysisInfo(WEE)   
    #read speeds for every edge
    for taxi in taxis:
        for step in taxi.getSteps():
            if step.source==SOURCE_SIMFCD:            
                vtypeEdgeDict.setdefault(step.edge,[]).append(float(step.speed))    
            elif step.source==SOURCE_FCD:
                fcdEdgeDict.setdefault(step.edge,[]).append(float(step.speed))
    #calc avg speed for each edge
    #print fcdEdgeDict["558300689"]
    #print vtypeEdgeDict["558300689"]
    for edge in fcdEdgeDict:        
        fcdEdgeDict[edge]=sum(fcdEdgeDict[edge])/len(fcdEdgeDict[edge])
    print len(fcdEdgeDict)
    
    for edge in vtypeEdgeDict:        
        vtypeEdgeDict[edge]=sum(vtypeEdgeDict[edge])/len(vtypeEdgeDict[edge])
    print len(vtypeEdgeDict)
开发者ID:harora,项目名称:ITS,代码行数:23,代码来源:CompareVelocitys.py


注:本文中的util.Reader.readAnalysisInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。