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
7b8f189c
Commit
7b8f189c
authored
Nov 28, 2013
by
Daniel Brown
Browse files
Merge branch 'master' of gitmaster.atlas.aei.uni-hannover.de:pykat/pykat
parents
1e342a36
2a62fc59
Changes
2
Hide whitespace changes
Inline
Side-by-side
bin/test_plot.py
View file @
7b8f189c
...
...
@@ -16,6 +16,7 @@ m m2 0.5 0.5 0 n4 n5
s s3 10 1 n5 n6
"""
#kat = finesse.kat(katexe='/Users/adf/work/bin/kat')
kat
=
finesse
.
kat
()
kat
.
parseCommands
(
code
)
...
...
@@ -35,11 +36,11 @@ kat.m2.Rcy = 1000.0
kat
.
maxtem
=
0
run
=
kat
.
run
(
printout
=
0
,
printerr
=
0
)
out
=
kat
.
run
(
printout
=
0
,
printerr
=
0
)
pl
.
figure
()
pl
.
plot
(
run
.
x
,
run
.
y
)
pl
.
xlabel
(
run
.
xlabel
)
pl
.
plot
(
out
.
x
,
out
.
y
)
pl
.
xlabel
(
out
.
xlabel
)
pl
.
ylabel
(
"Intensity [W]"
)
pl
.
legend
(
run
.
ylabels
)
pl
.
legend
(
out
.
ylabels
)
pl
.
show
()
pykat/finesse.py
View file @
7b8f189c
...
...
@@ -133,7 +133,7 @@ class kat(object):
def
loadKatFile
(
self
,
katfile
):
with
open
(
katfile
)
as
f
:
parseCommands
(
f
.
readlines
())
self
.
parseCommands
(
f
.
readlines
())
def
parseCommands
(
self
,
commands
):
blockComment
=
False
...
...
@@ -199,18 +199,17 @@ class kat(object):
raise
MissingFinesse
()
# create a kat file which we will write the script into
katfile
=
tempfile
.
TemporaryFile
(
suffix
=
".kat"
)
katfile
=
tempfile
.
Named
TemporaryFile
(
suffix
=
".kat"
)
katfile
.
writelines
(
r
.
katScript
)
katfile
.
flush
()
flags
=
"--perl1 "
cmd
=
[
kat_exec
,
'--perl1'
]
if
self
.
__time_code
:
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
)
cmd
.
append
(
'--perf-timing'
)
cmd
.
append
(
'--no-backspace'
)
cmd
.
append
(
katfile
.
name
)
p
=
subprocess
.
Popen
(
cmd
,
shell
=
False
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
err
=
""
for
line
in
iter
(
p
.
stderr
.
readline
,
""
):
...
...
@@ -510,4 +509,4 @@ class kat(object):
setattr
(
self
,
'__comp_'
+
comp
.
name
,
comp
)
def
__get_component
(
self
,
name
):
return
getattr
(
self
,
'__comp_'
+
name
)
\ No newline at end of file
return
getattr
(
self
,
'__comp_'
+
name
)
Write
Preview
Markdown
is supported
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