Commit 126cf72b authored by Daniel Brown's avatar Daniel Brown
Browse files

adding percentage done from parsing kat stderr

parent cdd1994e
......@@ -3,7 +3,8 @@ s s1 10 1 n1 n2
m m1 0.5 0.5 0 n2 n3
s s2 10 1 n3 n4
m m2 0.5 0.5 0 n4 dump
maxtem 10
pd PD1 n2
pd PD1 n
xaxis m1 phi lin 0 360 1000
import sys
sys.path.append("../")
sys.path.append(".")
from pykat import finesse, profiling
import numpy as np
......
......@@ -157,18 +157,22 @@ class kat(object):
flags = "--perl1 "
if self.__time_code:
flags = flags + " --perf-timing "
flags = flags + " --perf-timing --no-backspace"
kat_exec = "{0} {1} {2}".format(kat_exec, flags, katfile.name)
p=subprocess.Popen(kat_exec, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
for line in iter(p.stderr.readline, ""):
if "%" in line:
sys.stdout.write("%\n")
vals = line.split("-")
if len(vals) == 2:
action = vals[0].strip()
prc = vals[1].strip()[:-1]
sys.stdout.write('\r'+line[:-1] + '\n')
sys.stdout.flush()
#sys.stdout.write("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b")
sys.stdout.write("\r{0} {1}%".format(action, prc))
sys.stdout.flush()
[out,err] = p.communicate()
......
......@@ -29,8 +29,8 @@ def parse_kat_file(kat_filename):
kat_cmps.append()
elif (commands == arg).any():
print ""
def parse_m(line):
return line
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment