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
100345ec
Commit
100345ec
authored
Jan 06, 2017
by
Daniel Brown
Browse files
Adding in another layer of processing for commands that rely on other commands
parent
5b0a621d
Pipeline
#1760
passed with stage
in 20 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
pykat/finesse.py
View file @
100345ec
...
...
@@ -1146,8 +1146,9 @@ class kat(object):
commands
=
self
.
processConstants
(
commands
)
after_process
=
[]
# list of commands that should be processed after
# objects have been set and created
# Some commands need to be processed after others, and some after that.
# Here we have two lists of processing priority.
after_process
=
([],
[])
for
line
in
commands
:
if
len
(
line
.
strip
())
>=
2
:
...
...
@@ -1246,21 +1247,21 @@ class kat(object):
elif
(
first
==
"x2axis"
or
first
==
"x2axis*"
):
obj
=
pykat
.
commands
.
x2axis
.
parseFinesseText
(
line
)
elif
(
first
==
"gauss"
or
first
==
"gauss*"
or
first
==
"gauss**"
):
after_process
.
append
((
line
,
self
.
__currentTag
))
after_process
[
0
]
.
append
((
line
,
self
.
__currentTag
))
elif
(
first
==
"scale"
):
after_process
.
append
((
line
,
self
.
__currentTag
))
after_process
[
1
]
.
append
((
line
,
self
.
__currentTag
))
elif
(
first
==
"pdtype"
):
after_process
.
append
((
line
,
self
.
__currentTag
))
after_process
[
0
]
.
append
((
line
,
self
.
__currentTag
))
elif
(
first
==
"cav"
):
after_process
.
append
((
line
,
self
.
__currentTag
))
after_process
[
0
]
.
append
((
line
,
self
.
__currentTag
))
elif
(
first
==
"func"
):
after_process
.
append
((
line
,
self
.
__currentTag
))
after_process
[
0
]
.
append
((
line
,
self
.
__currentTag
))
elif
(
first
==
"variable"
):
after_process
.
append
((
line
,
self
.
__currentTag
))
after_process
[
0
]
.
append
((
line
,
self
.
__currentTag
))
elif
(
first
==
"lock"
):
after_process
.
append
((
line
,
self
.
__currentTag
))
after_process
[
0
]
.
append
((
line
,
self
.
__currentTag
))
elif
(
first
==
"attr"
):
after_process
.
append
((
line
,
self
.
__currentTag
))
after_process
[
0
]
.
append
((
line
,
self
.
__currentTag
))
elif
(
first
==
"noxaxis"
):
self
.
noxaxis
=
True
elif
(
first
==
"lambda"
):
...
...
@@ -1306,11 +1307,11 @@ class kat(object):
if
self
.
verbose
:
print
(
"Ignoring Gnuplot/Python terminal command '{0}'"
.
format
(
line
))
elif
(
first
==
"fsig"
):
after_process
.
append
((
line
,
self
.
__currentTag
))
after_process
[
0
]
.
append
((
line
,
self
.
__currentTag
))
elif
(
first
==
"noplot"
):
after_process
.
append
((
line
,
self
.
__currentTag
))
after_process
[
1
]
.
append
((
line
,
self
.
__currentTag
))
elif
(
first
==
"put"
or
first
==
"put*"
):
after_process
.
append
((
line
,
self
.
__currentTag
))
after_process
[
1
]
.
append
((
line
,
self
.
__currentTag
))
else
:
if
self
.
verbose
:
print
(
"Parsing `{0}` into pykat object not implemented yet, added as extra line."
.
format
(
line
))
...
...
@@ -1327,16 +1328,10 @@ class kat(object):
self
.
add
(
obj
,
block
=
self
.
__currentTag
)
# Before processing the rest, all "noplot" commands are moved to the
# end of the list to make sure they are after all "func" commands.
for
k
in
range
(
len
(
after_process
)
-
1
,
-
1
,
-
1
):
if
after_process
[
k
][
0
].
split
(
" "
,
1
)[
0
]
==
"noplot"
:
after_process
.
append
(
after_process
.
pop
(
k
))
# now process all the varous gauss/attr etc. commands which require
# components to exist first before they can be processed
for
item
in
after_process
:
for
_
in
after_process
:
for
item
in
_
:
line
=
item
[
0
]
first
,
rest
=
line
.
split
(
" "
,
1
)
block
=
item
[
1
]
...
...
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