added simple output about progress

This commit is contained in:
Christoph Kords 2013-05-07 14:32:38 +00:00
parent fb5f94812f
commit ed9413a008
1 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
import os, sys, math, string, re import os, sys, math, string, re, time
import damask import damask
from optparse import OptionParser, OptionGroup, Option from optparse import OptionParser, OptionGroup, Option
@ -393,8 +393,12 @@ if not os.path.isdir(dirname):
# --- loop over positions # --- loop over positions
time_start = time.time()
for incCount,position in enumerate(locations): # walk through locations for incCount,position in enumerate(locations): # walk through locations
p.moveto(position+1) # wind to correct position p.moveto(position+1) # wind to correct position
time_delta = (float(stat['NumberOfIncrements']) / float(incCount+1) - 1.0) * (time.time() - time_start)
sys.stdout.write("\r(%02i:%02i:%02i) processing increment %i of %i..."%(time_delta//3600,time_delta%3600//60,time_delta%60,incCount+1,len(locations)))
sys.stdout.flush()
# --- write header # --- write header
@ -433,5 +437,6 @@ for incCount,position in enumerate(locations): # walk through locations
myfile.write('\t'.join(map(str,[e,i]+ipData[i]))+'\n') myfile.write('\t'.join(map(str,[e,i]+ipData[i]))+'\n')
p.close() p.close()
sys.stdout.write("\n")
# --------------------------- DONE -------------------------------- # --------------------------- DONE --------------------------------