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
e5c36c9b
Commit
e5c36c9b
authored
Dec 01, 2013
by
Daniel Brown
Browse files
updates for blocks
parent
9002c286
Changes
4
Hide whitespace changes
Inline
Side-by-side
pykat/commands.py
View file @
e5c36c9b
...
...
@@ -11,6 +11,9 @@ from components import *
from
structs
import
*
class
Command
(
object
):
def
__init__
(
self
):
self
.
tag
=
None
def
getFinesseText
(
self
):
""" Base class for individual finesse optical components """
raise
NotImplementedError
(
"This function is not implemented"
)
...
...
pykat/components.py
View file @
e5c36c9b
...
...
@@ -34,6 +34,7 @@ class Component(object) :
self
.
_nodes
=
None
self
.
_requested_node_names
=
[]
self
.
_kat
=
None
self
.
tag
=
None
# store a unique ID for this component
global
next_component_id
...
...
pykat/detectors.py
View file @
e5c36c9b
...
...
@@ -18,6 +18,7 @@ class Detector(object) :
self
.
_kat
=
None
self
.
noplot
=
False
self
.
enabled
=
True
self
.
tag
=
None
if
node
.
find
(
'*'
):
self
.
_alternate_beam
=
True
...
...
pykat/finesse.py
View file @
e5c36c9b
...
...
@@ -141,11 +141,19 @@ class kat(object):
if
values
[
0
]
==
"%%%"
:
if
values
[
1
]
==
"FTblock"
:
newTag
=
values
[
2
]
if
newTag
!=
self
.
__currentTag
and
self
.
__currentTag
:
if
self
.
__currentTag
!=
None
and
newTag
!=
self
.
__currentTag
:
warnings
.
warn
(
"found block {0} before block {1} ended"
.
format
(
newTag
,
self
.
__currentTag
))
if
newTag
in
self
.
__blocks
:
raise
pkex
.
BasePyKatException
(
"Block `{0}` has already been read"
)
self
.
__blocks
{
newTag
}
=
[]
# create new list to store all references to components in block
self
.
__currentTag
=
newTag
if
values
[
1
]
==
"FTend"
:
self
.
__currentTag
=
""
self
.
__currentTag
=
None
continue
#warnings.warn("current tag {0}".format(self.__currentTag))
...
...
@@ -174,6 +182,7 @@ class kat(object):
else
:
print
"Parsing `{0}` into pykat object not implemented yet, added as extra line."
.
format
(
line
)
self
.
__extra_lines
.
append
(
line
+
"
\n
"
)
self
.
__currentTag
=
""
def
run
(
self
,
printout
=
1
,
printerr
=
1
,
save_output
=
False
,
save_kat
=
False
,
kat_name
=
None
)
:
...
...
@@ -308,6 +317,7 @@ class kat(object):
def
add
(
self
,
obj
)
:
try
:
obj
.
tag
=
self
.
__currentTag
if
isinstance
(
obj
,
Component
):
if
obj
.
name
in
self
.
__components
:
...
...
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