コード例 #1
0
ファイル: start.py プロジェクト: xiao-bo/PaaS
		title='Tsa-Tse without background traffic '
	elif index==2:
		timestamp_former=dp.read_file('edison/data.txt',0)
		timestamp_backer=dp.read_file("serial/data.txt",2)
		title='Edison-Serial'
	elif index==3:
		timestamp_former=dp.read_file('edison/data3.txt',3)##edison receiver
		timestamp_backer=dp.read_file('edison/data3.txt',0)##edison sender
		
		###if sync ? ie , remove offset??
		#timestamp_backer=dp.time_sync(timestamp_backer,offset)
		title='Network delay (Mac_receiver-Edison_send)'
	elif index==4:
		title='ptpd'
	##error=former-backer
	if index!=4:
		error_data=dp.data_process_2(timestamp_former,timestamp_backer)
		print error_data
                if error_data:## check list is empty
			statistics=[dp.compute_statistics(error_data)]
        '''	
	elif index==4:
		error_data=offset
		statistics=[[0,0,0]]
        '''
	#print offset
	#print error_data
	#print statistics
	draw.curve(error_data,title,statistics)
コード例 #2
0
ファイル: parser.py プロジェクト: dlin8/my3D
def parseFile(fileName, screens, color, edgeMatrix, transformMatrix):
    scriptFile = open('{}'.format(fileName), 'r')
    for line in scriptFile:
        currentLine = line.split()
        if (currentLine[0][0] == '#'):
            pass
        elif (currentLine[0] == 'line'):
            argumentLine = scriptFile.readline().split()
            a = [
                float(argumentLine[0]),
                float(argumentLine[1]),
                float(argumentLine[2])
            ]
            b = [
                float(argumentLine[3]),
                float(argumentLine[4]),
                float(argumentLine[5])
            ]
            matrix.addEdge(edgeMatrix, a, b)
        elif (currentLine[0] == 'ident'):
            matrix.setIdentityMatrix(transformMatrix)
        elif (currentLine[0] == 'move'):
            argumentLine = scriptFile.readline().split()
            moveMatrix = matrix.createTranslateMatrix(float(argumentLine[0]),
                                                      float(argumentLine[1]),
                                                      float(argumentLine[2]))
            matrix.matrixMultiplication(moveMatrix, transformMatrix)
        elif (currentLine[0] == 'scale'):
            argumentLine = scriptFile.readline().split()
            scaleMatrix = matrix.createScaleMatrix(float(argumentLine[0]),
                                                   float(argumentLine[1]),
                                                   float(argumentLine[2]))
            matrix.matrixMultiplication(scaleMatrix, transformMatrix)
        elif (currentLine[0] == 'rotate'):
            argumentLine = scriptFile.readline().split()
            rotateMatrix = matrix.createRotateMatrix(argumentLine[0],
                                                     float(argumentLine[1]))
            matrix.matrixMultiplication(rotateMatrix, transformMatrix)
        elif (currentLine[0] == 'circle'):
            argumentLine = scriptFile.readline().split()
            draw.circle(edgeMatrix, float(argumentLine[0]),
                        float(argumentLine[1]), float(argumentLine[2]),
                        float(argumentLine[3]), 0)
        elif (currentLine[0] == 'hermite'):
            argumentLine = scriptFile.readline().split()
            draw.curve(edgeMatrix, float(argumentLine[0]),
                       float(argumentLine[1]), float(argumentLine[2]),
                       float(argumentLine[3]), float(argumentLine[4]),
                       float(argumentLine[5]), float(argumentLine[6]),
                       float(argumentLine[7]), 0, 'hermite')
        elif (currentLine[0] == 'bezier'):
            argumentLine = scriptFile.readline().split()
            draw.curve(edgeMatrix, float(argumentLine[0]),
                       float(argumentLine[1]), float(argumentLine[2]),
                       float(argumentLine[3]), float(argumentLine[4]),
                       float(argumentLine[5]), float(argumentLine[6]),
                       float(argumentLine[7]), 0, 'bezier')
        elif (currentLine[0] == 'box'):
            argumentLine = scriptFile.readline().split()
            draw.box(edgeMatrix, float(argumentLine[0]),
                     float(argumentLine[1]), float(argumentLine[2]),
                     float(argumentLine[3]), float(argumentLine[4]),
                     float(argumentLine[5]))
        elif (currentLine[0] == 'sphere'):
            argumentLine = scriptFile.readline().split()
            draw.sphere(edgeMatrix, float(argumentLine[0]),
                        float(argumentLine[1]), float(argumentLine[2]),
                        float(argumentLine[3]), 0)
        elif (currentLine[0] == 'torus'):
            argumentLine = scriptFile.readline().split()
            draw.torus(edgeMatrix, float(argumentLine[0]),
                       float(argumentLine[1]), float(argumentLine[2]),
                       float(argumentLine[3]), float(argumentLine[4]), 0)
        elif (currentLine[0] == 'clear'):
            edgeMatrix = [[], [], [], []]
        elif (currentLine[0] == 'apply'):
            matrix.matrixMultiplication(transformMatrix, edgeMatrix)
        elif (currentLine[0] == 'display'):
            matrix.drawEdges(screens, edgeMatrix, color)
            screen.display(screens)
            screen.clearScreen(screens)
            time.sleep(.01)
        elif (currentLine[0] == 'save'):
            argumentLine = scriptFile.readline().split()
            matrix.drawEdges(screens, edgeMatrix, color)
            screen.saveExtension(screens, argumentLine[0])
        else:
            print('Bad command, ' + currentLine[0])
コード例 #3
0
ファイル: data_processing.py プロジェクト: xiao-bo/PaaS
	print '------------\ndelay_edison_serial\n------------'
	print delay_edison_serial
	print '------------\ndelay_edison_receive_send\n------------'
	print delay_edison_receive_send
	
	'''
	
	##evalute average , standard deviation, mean square error
	'''
	if delay_arduino_edison:## check list is empty
		compute_statistics(delay_arduino_edison)
	if delay_arduino_serial:
		compute_statistics(delay_arduino_serial)
	if delay_edison_serial:
		compute_statistics(delay_edison_serial)
	if delay_edison_receive_send:
		compute_statistics(delay_edison_receive_send)
	'''
	###debug message
	
	
	return [delay_arduino_edison]
	'''
	#return offset
	#return [delay_edison_receive_send,max(delay_edison_receive_send)]
	return delay_edison_receive_send
	'''
if __name__=='__main__':
        error_data=data_process()
        draw.curve(error_data,"s")
コード例 #4
0
ファイル: start.py プロジェクト: carriercomm/PaaS-7
import data_processing as dp
import draw
import sys
if __name__=="__main__":
	data=dp.data_process()
	index=int(sys.argv[1])
	draw.curve(data[0],index)
コード例 #5
0
ファイル: sampling.py プロジェクト: xiao-bo/PaaS
    if board=="arduino": ## for 1 hz
        readline=open("save/scalable/different_freq/arduino_1Hz.txt","rb")
        for line in readline:
	    send=line.split(":")[0]## for arduino
	    sendTime.append(send)
        sendInterval=CounterInterval(sendTime) ##for arduino
        Title="arduino sender's sampling error in "+freq+"hz"
    elif board=="edison":
        if freq=="1":## for 1 Hz
            readline=open("edison/edison_1023.txt","rb")
            for line in readline:
	        send=line.split(":")[0]## for arduino
	        sendTime.append(send)
            sendInterval=getRealClockInterval(sendTime)## for edison
            Title="edison's sampling period for 1023"
        else:## for all data
            readline=open("edison/edison_all_timer.txt","rb")
            for line in readline:
	        send=line.split(" ")[1]## for edison all data
	        sendTime.append(send)
            sendInterval=getRealClockIntervalForMillisecond(sendTime)## for edison
            statistics=[dp.compute_statistics(sendInterval)]
            Title="edison's sampling period for all data"
            draw.curve(sendInterval,Title,statistics)
        

    sendSamplingBias=getSamplingBias(sendInterval,float(freq))
    statistics=[dp.compute_statistics(sendSamplingBias)]
    draw.curve(sendSamplingBias,Title,statistics)