Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sebastian Steinlechner
pykat
Commits
925906a0
Commit
925906a0
authored
Feb 04, 2014
by
Daniel Brown
Browse files
sorting out multiple dump node connection issues
parent
1e7b76c7
Changes
5
Hide whitespace changes
Inline
Side-by-side
bin/test_const.py
100644 → 100755
View file @
925906a0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from
pykat
import
finesse
from
pykat.detectors
import
*
from
pykat.components
import
*
...
...
pykat/commands.py
View file @
925906a0
...
...
@@ -44,11 +44,34 @@ class cavity(Command):
class
gauss
(
object
):
@
staticmethod
def
parseFinesseText
(
text
,
kat
):
values
=
text
.
split
(
" "
)
values
=
text
.
split
()
if
not
values
[
0
].
startswith
(
"gauss"
):
if
not
values
[
0
].
startswith
(
"gauss"
)
or
(
len
(
values
)
!=
6
and
len
(
values
!=
8
))
:
raise
exceptions
.
RuntimeError
(
"'{0}' not a valid Finesse gauss command"
.
format
(
text
))
name
=
values
[
1
]
component
=
values
[
2
]
node
=
values
[
3
]
if
values
[
0
].
endswith
(
"**"
):
if
len
(
values
)
==
6
:
print
""
elif
len
(
values
)
==
8
:
print
""
elif
values
[
0
].
endswith
(
"*"
):
if
len
(
values
)
==
6
:
print
""
elif
len
(
values
)
==
8
:
print
""
else
:
if
len
(
values
)
==
6
:
print
""
elif
len
(
values
)
==
8
:
print
""
class
xaxis
(
Command
):
def
__init__
(
self
,
scale
,
limits
,
param
,
steps
,
comp
=
None
,
axis_type
=
"xaxis"
):
...
...
@@ -94,7 +117,7 @@ class xaxis(Command):
@
staticmethod
def
parseFinesseText
(
text
):
values
=
text
.
split
(
" "
)
values
=
text
.
split
()
if
values
[
0
]
!=
"xaxis"
and
values
[
0
]
!=
"xaxis*"
:
raise
exceptions
.
RuntimeError
(
"'{0}' not a valid Finesse xaxis command"
.
format
(
text
))
...
...
@@ -125,7 +148,7 @@ class x2axis(xaxis):
@
staticmethod
def
parseFinesseText
(
text
):
values
=
text
.
split
(
" "
)
values
=
text
.
split
()
if
values
[
0
]
!=
"x2axis"
and
values
[
0
]
!=
"x2axis*"
:
raise
exceptions
.
RuntimeError
(
"'{0}' not a valid Finesse xaxis command"
.
format
(
text
))
...
...
pykat/components.py
View file @
925906a0
...
...
@@ -234,7 +234,7 @@ class mirror(AbstractMirrorComponent):
@
staticmethod
def
parseFinesseText
(
text
):
values
=
text
.
split
(
" "
)
values
=
text
.
split
()
if
values
[
0
]
!=
"m"
and
values
[
0
]
!=
"m1"
and
values
[
0
]
!=
"m2"
:
raise
pkex
.
BasePyKatException
(
"'{0}' not a valid Finesse mirror command"
.
format
(
text
))
...
...
@@ -289,7 +289,7 @@ class beamSplitter(AbstractMirrorComponent):
@
staticmethod
def
parseFinesseText
(
text
):
values
=
text
.
split
(
" "
)
values
=
text
.
split
()
if
values
[
0
]
!=
"bs"
and
values
[
0
]
!=
"bs1"
and
values
[
0
]
!=
"bs2"
:
raise
pkex
.
BasePyKatException
(
"'{0}' not a valid Finesse beam splitter command"
.
format
(
text
))
...
...
@@ -355,7 +355,7 @@ class space(Component):
@
staticmethod
def
parseFinesseText
(
text
):
values
=
text
.
split
(
" "
)
values
=
text
.
split
()
if
values
[
0
]
!=
"s"
:
raise
pkex
.
BasePyKatException
(
"'{0}' not a valid Finesse space command"
.
format
(
text
))
...
...
@@ -465,7 +465,7 @@ class grating(Component):
@
staticmethod
def
parseFinesseText
(
text
):
values
=
text
.
split
(
" "
)
values
=
text
.
split
()
if
values
[
0
][
0
:
2
]
!=
"gr"
:
raise
pkex
.
BasePyKatException
(
"'{0}' not a valid Finesse grating command"
.
format
(
text
))
...
...
@@ -533,7 +533,7 @@ class isolator(Component):
@
staticmethod
def
parseFinesseText
(
text
):
values
=
text
.
split
(
" "
)
values
=
text
.
split
()
if
values
[
0
]
!=
"isol"
:
raise
pkex
.
BasePyKatException
(
"'{0}' not a valid Finesse isolator command"
.
format
(
text
))
...
...
@@ -575,7 +575,7 @@ class lens(Component):
@
staticmethod
def
parseFinesseText
(
text
):
values
=
text
.
split
(
" "
)
values
=
text
.
split
()
if
values
[
0
]
!=
"lens"
:
raise
pkex
.
BasePyKatException
(
"'{0}' not a valid Finesse lens command"
.
format
(
text
))
...
...
@@ -650,7 +650,7 @@ class modulator(Component):
@
staticmethod
def
parseFinesseText
(
text
):
v
=
text
.
split
(
" "
)
v
=
text
.
split
()
if
v
[
0
]
!=
"mod"
:
raise
pkex
.
BasePyKatException
(
"'{0}' not a valid Finesse modulator command"
.
format
(
text
))
...
...
@@ -706,7 +706,7 @@ class laser(Component):
@
staticmethod
def
parseFinesseText
(
text
):
values
=
text
.
split
(
" "
)
values
=
text
.
split
()
if
values
[
0
]
!=
"l"
:
raise
pkex
.
BasePyKatException
(
"'{0}' not a valid Finesse laser command"
.
format
(
text
))
...
...
pykat/finesse.py
View file @
925906a0
...
...
@@ -497,7 +497,7 @@ class kat(object):
for
line
in
after_process
:
first
=
line
.
split
(
" "
,
1
)[
0
]
if
first
==
"gauss"
or
first
==
"gauss*"
or
first
==
"gauss**"
:
pykat
.
commands
.
gauss
.
parseFinesseText
(
line
)
pykat
.
commands
.
gauss
.
parseFinesseText
(
line
,
self
)
elif
(
first
==
"scale"
):
v
=
line
.
split
()
if
len
(
v
)
==
3
:
...
...
pykat/node_network.py
View file @
925906a0
...
...
@@ -86,7 +86,7 @@ class NodeNetwork(object):
comps
=
(
None
,)
*
2
if
len
(
comps
)
>=
2
and
comps
[
0
]
!=
None
and
comps
[
1
]
!=
None
:
raise
pkex
.
BasePyKatException
(
"Node is already connected to 2 components
"
)
raise
pkex
.
BasePyKatException
(
"Node
'{0}'
is already connected to 2 components
({1}, {2})"
.
format
(
node
.
name
,
comps
[
0
],
comps
[
1
])
)
l
=
list
(
comps
)
...
...
@@ -118,6 +118,7 @@ class NodeNetwork(object):
return
n
def
removeNode
(
self
,
node
):
if
not
isinstance
(
node
,
Node
):
raise
exceptions
.
ValueError
(
"node argument is not of type Node"
)
...
...
@@ -326,9 +327,12 @@ class Node(object):
@
property
def
name
(
self
):
return
self
.
__name
class
DumpNode
(
Node
):
__total_dump_node_id
=
0
def
__init__
(
self
):
Node
.
__init__
(
self
,
'dump'
,
None
,
-
1
)
DumpNode
.
__total_dump_node_id
-=
1
Node
.
__init__
(
self
,
'dump'
,
None
,
DumpNode
.
__total_dump_node_id
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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