Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
finesse
pykat
Commits
126cf72b
Commit
126cf72b
authored
Jul 29, 2013
by
Daniel Brown
Browse files
adding percentage done from parsing kat stderr
parent
cdd1994e
Changes
4
Hide whitespace changes
Inline
Side-by-side
bin/parse.kat
View file @
126cf72b
...
...
@@ -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 n
2
pd PD1 n
xaxis m1 phi lin 0 360 1000
bin/test_parser.py
View file @
126cf72b
import
sys
sys
.
path
.
append
(
".
./
"
)
sys
.
path
.
append
(
"."
)
from
pykat
import
finesse
,
profiling
import
numpy
as
np
...
...
pykat/finesse.py
View file @
126cf72b
...
...
@@ -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
()
...
...
pykat/parser.py
View file @
126cf72b
...
...
@@ -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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment