Public paste
Undefined
By: Guest | Date: Apr 27 2010 00:24 | Format: None | Expires: never | Size: 900 B | Hits: 925

  1. from os import getenv
  2. from re import compile
  3. from sys import argv
  4. from sys import stderr
  5. from struct import unpack
  6. from math import sqrt
  7. from math import log
  8. from math import pow
  9.  
  10.  
  11.  
  12. a = open('output/inputimage-out100-in100x100-p100-34.762.raw')
  13. b=a.read();
  14. fields=len(b)/4
  15. islice=[]
  16. jslice=[]
  17. kslice=[]
  18. for i in xrange(0,100):
  19.         for j in xrange(0,100):
  20.                 for k in xrange(0,100):
  21.                         value=unpack('f',b[(i*10000+j*100+k)*4:(i*10000+j*100+k+1)*4])
  22.                         if i==49:
  23.                                 islice.append(value[0])
  24.                         if j==49:
  25.                                 jslice.append(value[0])
  26.                         if k==49:
  27.                                 kslice.append(value[0])
  28.  
  29. print 'done'
  30. kfile=file('kslice','w');
  31.  
  32. for x in xrange(len(kslice)):
  33.         kfile.write(pack('f', kslice[x]))