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
9bc20d85
Commit
9bc20d85
authored
Dec 14, 2013
by
Andreas Freise
Browse files
Merge branch 'master' of gitmaster.atlas.aei.uni-hannover.de:pykat/pykat
parents
44663f7e
1487f402
Changes
3
Hide whitespace changes
Inline
Side-by-side
bin/test_pass_though.py
View file @
9bc20d85
...
...
@@ -16,6 +16,8 @@ l l1 1 0 0 n1
s s1 10 1 n1 n2
m m1 1 0 0 n2 n3
gr4 grating 1500 n4 n5 n6 n7
isol isolator 60 n8 n9
lens lens 10 n10 n11
pd refl n2
...
...
pykat/components.py
View file @
9bc20d85
...
...
@@ -368,9 +368,9 @@ class space(Component):
values
.
pop
(
0
)
# remove initial value
if
len
(
values
)
==
5
:
return
space
(
values
[
0
],
values
[
3
],
values
[
4
],
L
=
values
[
1
],
n
=
values
[
2
])
return
space
(
values
[
0
],
values
[
3
],
values
[
4
],
values
[
1
],
values
[
2
])
elif
len
(
values
)
==
4
:
return
space
(
values
[
0
],
values
[
2
],
values
[
3
],
L
=
values
[
1
])
return
space
(
values
[
0
],
values
[
2
],
values
[
3
],
values
[
1
])
else
:
raise
exceptions
.
RuntimeError
(
"Space Finesse code format incorrect '{0}'"
.
format
(
text
))
...
...
@@ -519,6 +519,80 @@ class grating(Component):
self
.
_QItem
=
pykat
.
gui
.
graphics
.
SpaceQGraphicsItem
(
self
)
# TODO: make SVG graphic for grating
return
self
.
_QItem
class
isolator
(
Component
):
def
__init__
(
self
,
name
,
node1
,
node2
,
S
=
0
):
Component
.
__init__
(
self
,
name
)
self
.
_requested_node_names
.
append
(
node1
)
self
.
_requested_node_names
.
append
(
node2
)
self
.
__S
=
SIfloat
(
S
)
@
property
def
S
(
self
):
return
Param
(
'S'
,
self
.
__S
)
@
S
.
setter
def
S
(
self
,
value
):
self
.
__S
=
SIfloat
(
value
)
@
staticmethod
def
parseFinesseText
(
text
):
values
=
text
.
split
(
" "
)
if
values
[
0
]
!=
"isol"
:
raise
exceptions
.
RuntimeError
(
"'{0}' not a valid Finesse isolator command"
.
format
(
text
))
values
.
pop
(
0
)
# remove initial value
if
len
(
values
)
==
4
:
return
isolator
(
values
[
0
],
values
[
2
],
values
[
3
],
values
[
1
])
else
:
raise
exceptions
.
RuntimeError
(
"Isolator Finesse code format incorrect '{0}'"
.
format
(
text
))
def
getFinesseText
(
self
):
return
'isol {0} {1} {2} {3}'
.
format
(
self
.
name
,
self
.
S
,
self
.
nodes
[
0
].
name
,
self
.
nodes
[
1
].
name
)
def
getQGraphicsItem
(
self
):
if
self
.
_QItem
==
None
:
self
.
_QItem
=
pykat
.
gui
.
graphics
.
SpaceQGraphicsItem
(
self
)
# TODO: make isolator graphic
return
self
.
_QItem
class
lens
(
Component
):
def
__init__
(
self
,
name
,
node1
,
node2
,
f
):
Component
.
__init__
(
self
,
name
)
self
.
_requested_node_names
.
append
(
node1
)
self
.
_requested_node_names
.
append
(
node2
)
self
.
__f
=
SIfloat
(
f
)
@
property
def
f
(
self
):
return
Param
(
'f'
,
self
.
__f
)
@
f
.
setter
def
f
(
self
,
value
):
self
.
__f
=
SIfloat
(
value
)
@
staticmethod
def
parseFinesseText
(
text
):
values
=
text
.
split
(
" "
)
if
values
[
0
]
!=
"lens"
:
raise
exceptions
.
RuntimeError
(
"'{0}' not a valid Finesse lens command"
.
format
(
text
))
values
.
pop
(
0
)
# remove initial value
if
len
(
values
)
==
4
:
return
lens
(
values
[
0
],
values
[
2
],
values
[
3
],
values
[
1
])
else
:
raise
exceptions
.
RuntimeError
(
"Lens Finesse code format incorrect '{0}'"
.
format
(
text
))
def
getFinesseText
(
self
):
return
'lens {0} {1} {2} {3}'
.
format
(
self
.
name
,
self
.
f
,
self
.
nodes
[
0
].
name
,
self
.
nodes
[
1
].
name
)
def
getQGraphicsItem
(
self
):
if
self
.
_QItem
==
None
:
self
.
_QItem
=
pykat
.
gui
.
graphics
.
SpaceQGraphicsItem
(
self
)
# TODO: make lens graphic
return
self
.
_QItem
class
laser
(
Component
):
def
__init__
(
self
,
name
,
node
,
P
=
1
,
f_offset
=
0
,
phase
=
0
):
...
...
pykat/finesse.py
View file @
9bc20d85
...
...
@@ -219,6 +219,10 @@ class kat(object):
obj
=
pykat
.
components
.
beamSplitter
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
2
]
==
"gr"
):
obj
=
pykat
.
components
.
grating
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
4
]
==
"isol"
):
obj
=
pykat
.
components
.
isolator
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
4
]
==
"lens"
):
obj
=
pykat
.
components
.
lens
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
2
]
==
"pd"
):
obj
=
pykat
.
detectors
.
photodiode
.
parseFinesseText
(
line
)
elif
(
first
==
"xaxis"
or
first
==
"x2axis"
or
first
==
"xaxis*"
or
first
==
"x2axis*"
):
...
...
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