-
Notifications
You must be signed in to change notification settings - Fork 1
CompareVolumeT
Adrian Quintana edited this page Dec 11, 2017
·
1 revision
baseFileName='PROJ' ext='Fourier' FileName1=baseFileName+'_1_'+ext+'.vol' FileName2=baseFileName+'_2_'+ext+'.vol' FileName3=baseFileName+'_all_'+ext+'.vol' outPutFileName='./Both_'+ext+'.vol' INPUT1 = open(FileName1, 'rb') INPUT2 = open(FileName2, 'rb') INPUT3 = open(FileName3, 'rb') OUTPUT = open(outPutFileName, 'wb') import struct format` 'd' buffsize = struct.calcsize(format) import os filesize = os.stat(FileName1).st_size / buffsize print 'filesize`', filesize, os.stat(FileName1).st_size #filesize=9 for i in range(0,filesize): data1 = struct.unpack(format, INPUT1.read(buffsize))[0] # Unpacking 64-bit data, C-double data2 = struct.unpack(format, INPUT2.read(buffsize))[0] # Unpacking 64-bit data, C-double data3 = struct.unpack(format, INPUT3.read(buffsize))[0] # Unpacking 64-bit data, C-double sumT = data1 + data2 OUTPUT.write(struct.pack(format,sumT)) #print data1, data2, sumT, data3 OUTPUT.close()
--Main.RobertoMarabini - 13 Mar 2009