added conversion of 'resolution' in result file to integer array

This commit is contained in:
Martin Diehl 2010-12-02 14:53:17 +00:00
parent 096a4803b0
commit 2f47d4b09b
1 changed files with 20 additions and 9 deletions

View File

@ -1,8 +1,10 @@
import binascii import array
import struct
print('post processing for mpie_spectral') print('post processing for mpie_spectral')
results = open('results.out', 'rb') filename ='results.out'
results = open(filename, 'rb')
print('filename:', filename)
header = results.read(4) #read header header = results.read(4) #read header
begin = results.tell() begin = results.tell()
@ -22,7 +24,7 @@ end = results.read(1024).find(header) #find header (second time)
results.seek(begin+11) #position: header + string "workingdir " results.seek(begin+11) #position: header + string "workingdir "
workingdir = results.read(end -11) workingdir = results.read(end -11)
print('workingdir:', workingdir) print('workingdir:', workingdir)
#
results.seek(begin+end+4) results.seek(begin+end+4)
header = results.read(4) header = results.read(4)
@ -32,8 +34,17 @@ results.seek(begin+8) #position: header + string "workingdir "
jobname = results.read(end -8) jobname = results.read(end -8)
print('jobname:', jobname) print('jobname:', jobname)
header = b'a' results.seek(results.tell()+4)
results.seek(begin+end+19) header = results.read(4)
print(results.seek(begin+end+19))
begin = results.read(1024).find(header)
print(begin) resolution = array.array('i',[0,0,0])
header1 = b'a'
begin = results.seek(results.tell()+11)
begin = begin + results.read(1024).find(header1)
results.seek(begin+1)
resolution[0]=struct.unpack('i',results.read(4))[0]
print(resolution)