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
ad7ef75a
Commit
ad7ef75a
authored
Feb 12, 2014
by
Daniel Brown
Browse files
fixing loss parsing/inputs and fixing rsub on Param and gaussbeam
parent
553f88ea
Changes
4
Hide whitespace changes
Inline
Side-by-side
pykat/components.py
View file @
ad7ef75a
...
...
@@ -159,7 +159,7 @@ class AbstractMirrorComponent(Component):
super
(
AbstractMirrorComponent
,
self
).
__init__
(
name
)
if
(
L
!=
None
and
R
!=
None
and
T
!=
None
)
and
SIfloat
(
R
)
+
SIfloat
(
T
)
+
SIfloat
(
L
)
!=
1
:
raise
pkex
.
BasePyKatException
(
'L+R+T must equal 1 if all are specified
'
)
raise
pkex
.
BasePyKatException
(
'L+R+T must equal 1 if all are specified
at {0}'
.
format
(
self
.
name
)
)
elif
(
R
!=
None
and
L
is
None
and
T
!=
None
):
L
=
1
-
(
SIfloat
(
R
)
+
SIfloat
(
T
))
elif
(
R
is
None
and
L
!=
None
and
T
!=
None
):
...
...
@@ -320,20 +320,17 @@ class beamSplitter(AbstractMirrorComponent):
if
len
(
values
[
0
])
==
2
:
values
.
pop
(
0
)
# remove initial value
return
beamSplitter
(
values
[
0
],
values
[
5
],
values
[
6
],
values
[
7
],
values
[
8
],
values
[
1
],
values
[
2
],
values
[
3
],
values
[
4
])
return
beamSplitter
(
values
[
0
],
values
[
5
],
values
[
6
],
values
[
7
],
values
[
8
],
values
[
1
],
values
[
2
],
None
,
values
[
3
],
values
[
4
])
elif
values
[
0
][
2
]
==
"1"
:
values
.
pop
(
0
)
# remove initial value
return
beamSplitter
(
values
[
0
],
values
[
5
],
values
[
6
],
values
[
7
],
values
[
8
],
None
,
values
[
1
],
values
[
2
],
values
[
3
],
values
[
4
])
else
:
if
values
[
0
][
2
]
==
"1"
:
values
.
pop
(
0
)
# remove initial value
return
beamSplitter
(
values
[
0
],
values
[
5
],
values
[
6
],
values
[
7
],
values
[
8
],
1.0
-
SIfloat
(
values
[
1
])
-
SIfloat
(
values
[
2
]),
values
[
1
],
values
[
3
],
values
[
4
])
else
:
values
.
pop
(
0
)
# remove initial value
return
beamSplitter
(
values
[
0
],
values
[
5
],
values
[
6
],
values
[
7
],
values
[
8
],
values
[
1
],
1.0
-
SIfloat
(
values
[
1
])
-
SIfloat
(
values
[
2
]),
values
[
3
],
values
[
4
])
values
.
pop
(
0
)
# remove initial value
return
beamSplitter
(
values
[
0
],
values
[
5
],
values
[
6
],
values
[
7
],
values
[
8
],
values
[
1
],
None
,
values
[
3
],
values
[
4
])
def
getFinesseText
(
self
):
if
self
.
R
+
self
.
T
+
self
.
L
>
1
:
raise
pkex
.
BasePyKatException
(
"Beamsplitter {0} has R+T+L > 1"
.
format
(
self
.
name
))
...
...
pykat/finesse.py
View file @
ad7ef75a
...
...
@@ -507,11 +507,11 @@ class kat(object):
if
component_name
in
self
.
__detectors
:
self
.
__detectors
[
component_name
].
scale
=
SIfloat
(
v
[
1
])
else
:
raise
pkex
.
BasePyKatException
(
"scale command `{0}` refers to non-existing output"
.
format
(
text
))
raise
pkex
.
BasePyKatException
(
"scale command `{0}` refers to non-existing output"
.
format
(
component_name
))
elif
len
(
values
)
==
2
:
self
.
scale
=
SIfloat
(
v
[
1
])
else
:
raise
pkex
.
BasePyKatException
(
"scale command `{0}` is incorrect."
.
format
(
text
))
raise
pkex
.
BasePyKatException
(
"scale command `{0}` is incorrect."
.
format
(
line
))
elif
(
first
==
"pdtype"
):
v
=
line
.
split
()
if
len
(
v
)
==
3
:
...
...
@@ -519,9 +519,9 @@ class kat(object):
if
component_name
in
self
.
__detectors
:
self
.
__detectors
[
component_name
].
pdtype
=
v
[
2
]
else
:
raise
pkex
.
BasePyKatException
(
"pdtype command `{0}` refers to non-existing detector"
.
format
(
text
))
raise
pkex
.
BasePyKatException
(
"pdtype command `{0}` refers to non-existing detector"
.
format
(
component_name
))
else
:
raise
pkex
.
BasePyKatException
(
"pdtype command `{0}` is incorrect."
.
format
(
text
))
raise
pkex
.
BasePyKatException
(
"pdtype command `{0}` is incorrect."
.
format
(
line
))
self
.
__currentTag
=
NO_BLOCK
...
...
pykat/param.py
View file @
ad7ef75a
...
...
@@ -138,7 +138,8 @@ class Param(putable, putter):
def
__isub__
(
self
,
a
):
return
self
.
value
-
(
a
)
__rsub__
=
__sub__
def
__rsub__
(
self
,
a
):
return
(
a
)
-
self
.
value
def
__div__
(
self
,
a
):
return
self
.
value
/
(
a
)
...
...
pykat/utilities/optics/gaussian_beams.py
View file @
ad7ef75a
...
...
@@ -117,7 +117,8 @@ class gauss_param(object):
self
.
__q
-=
complex
(
a
)
return
self
__rsub__
=
__sub__
def
__rsub__
(
self
,
a
):
return
gauss_param
(
self
.
__lambda
,
self
.
__nr
,
complex
(
a
)
-
self
.
__q
)
def
__div__
(
self
,
a
):
return
gauss_param
(
self
.
__lambda
,
self
.
__nr
,
self
.
__q
/
complex
(
a
))
...
...
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