Example #1
0
def getvehicleAttribs(sncfFileName):
	'''
Function that returns the value of the meta-data of the vehicle attribute. getvehicleAttribs(sncfFileName)[1] returns the vehicle type ID.
	'''
	vehicleBuff=[]
	vehicleBet=strutils.betweenHeaders('@start_vehID_({uID,vTypeID,routeID,[R G B],entryTime,entryLane,entryPtPos,entrySpeed,exitLane,exitPos,exitSpeed,line})','@end_vehID',sncfFileName)
	lenBuff=len(vehicleBet)
	for itr in range(0,lenBuff):
		buffInBet=strutils.whatsInBetween('{','}',vehicleBet[itr])
		vehicleBuff.append(buffInBet.split(','))
	return vehicleBuff
Example #2
0
def getrouteEntryAttribs(sncfFileName):
	'''
Function that returns the value of the meta-data of the routeEntry attribute. getrouteEntryAttribs(sncfFileName)[1] returns the color triad value.
	'''
	routeBuff=[]
	routeEntryBet=strutils.betweenHeaders('@start_routeentry_({routeID,[R G B],[edgName_a edgName_b edgName_c  edgName_n]})','@end_routeentry',sncfFileName)
	lenBuff=len(routeEntryBet)
	for itr in range(0,lenBuff):
		buffInBet=strutils.whatsInBetween('{','}',routeEntryBet[itr])
		routeBuff.append(buffInBet.split(','))
	return routeBuff
Example #3
0
def getEdgeIDs(inp_fileName):
        '''
Function that returns the edge id of each edge as a list. Input argument: the sncf filename.
        '''
        # Check if the file is empty.
        edgIDBuff=[]
        edgBuff=strutils.betweenHeaders('@start_elist_(edgName,frmId,toId)','@end_elist',inp_fileName)
        lenOf=len(edgBuff)
        for itr in range(0,lenOf):
                edgIDBuff.append(edgBuff[itr].split(',')[0])
        return edgIDBuff
Example #4
0
def getvTypeAttribs(sncfFileName):
	'''
Function that returns the value of the meta-data of the vType attribute. There are 18 meta-data variables.
Hence, getvTypeAttribs(sncfFileName)[1] returns the acceleration value 'accel'.
	'''
	vTypeBuff=[]
	vTypeBet=strutils.betweenHeaders('@start_vTypeID_({vTypeID,accel,decel,sigma,tau,length,minGap,maxSpeed,speedFactor,speedDev,[R G B],vClass,emissionClass,guiShape,width,imgFile,impatience,laneChangeModel})','@end_vTypeID',sncfFileName)
	lenBuff=len(vTypeBet)
	for itr in range(0,lenBuff):
		buffInBet=strutils.whatsInBetween('{','}',vTypeBet[itr])
		vTypeBuff.append(buffInBet.split(','))
	return vTypeBuff