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
finesse
pykat
Commits
fe3973b9
Commit
fe3973b9
authored
Mar 02, 2014
by
Daniel Brown
Browse files
adding more detectors
parent
56045da2
Changes
3
Hide whitespace changes
Inline
Side-by-side
pykat/components.py
View file @
fe3973b9
...
...
@@ -155,7 +155,7 @@ class Component(object):
class
AbstractMirrorComponent
(
Component
):
__metaclass__
=
abc
.
ABCMeta
def
__init__
(
self
,
name
,
R
=
None
,
T
=
None
,
L
=
None
,
phi
=
0
,
Rcx
=
None
,
Rcy
=
None
,
xbeta
=
None
,
ybeta
=
None
,
mass
=
None
,
r_ap
=
None
,
Ix
=
None
,
Iy
=
None
):
def
__init__
(
self
,
name
,
R
=
None
,
T
=
None
,
L
=
None
,
phi
=
0
,
Rcx
=
None
,
Rcy
=
None
,
xbeta
=
None
,
ybeta
=
None
,
mass
=
None
,
r_ap
=
None
,
Ix
=
None
,
Iy
=
None
,
zmech
=
None
,
rxmech
=
None
,
rymech
=
None
):
super
(
AbstractMirrorComponent
,
self
).
__init__
(
name
)
if
(
L
!=
None
and
R
!=
None
and
T
!=
None
)
and
SIfloat
(
R
)
+
SIfloat
(
T
)
+
SIfloat
(
L
)
!=
1
:
...
...
@@ -183,6 +183,10 @@ class AbstractMirrorComponent(Component):
self
.
__Iy
=
AttrParam
(
"Iy"
,
self
,
SIfloat
(
Iy
))
self
.
__r_ap
=
AttrParam
(
"r_ap"
,
self
,
SIfloat
(
r_ap
))
self
.
__zmech
=
AttrParam
(
"zmech"
,
self
,
zmech
)
self
.
__rxmech
=
AttrParam
(
"rxmech"
,
self
,
rxmech
)
self
.
__rymech
=
AttrParam
(
"rymech"
,
self
,
rymech
)
@
property
def
L
(
self
):
return
self
.
__L
@
L
.
setter
...
...
@@ -243,6 +247,21 @@ class AbstractMirrorComponent(Component):
@
ybeta
.
setter
def
ybeta
(
self
,
value
):
self
.
__ybeta
.
value
=
SIfloat
(
value
)
@
property
def
zmech
(
self
):
return
self
.
__zmech
@
zmech
.
setter
def
zmech
(
self
,
value
):
self
.
__zmech
.
value
=
value
@
property
def
rxmech
(
self
):
return
self
.
__rxmech
@
rxmech
.
setter
def
rxmech
(
self
,
value
):
self
.
__rxmech
.
value
=
value
@
property
def
rymech
(
self
):
return
self
.
__rymech
@
rymech
.
setter
def
rymech
(
self
,
value
):
self
.
__rymech
.
value
=
value
@
property
def
Rc
(
self
):
if
self
.
Rcx
==
self
.
Rcy
:
...
...
@@ -278,6 +297,12 @@ class AbstractMirrorComponent(Component):
self
.
Ix
=
value
elif
key
in
[
"Iy"
,
"iy"
]:
self
.
Iy
=
value
elif
key
in
[
"zmech"
,
"mech"
]:
self
.
zmech
=
value
elif
key
in
[
"rxmech"
]:
self
.
rxmech
=
value
elif
key
in
[
"rymech"
]:
self
.
rymech
=
value
else
:
return
False
...
...
pykat/detectors.py
View file @
fe3973b9
...
...
@@ -217,10 +217,10 @@ class pd(Detector):
def
pdtype
(
self
,
value
):
self
.
__pdtype
=
value
def
__get_fphi
(
self
,
name
):
return
getattr
(
self
,
'_
'
+
self
.
__class__
.
__name__
+
'
__'
+
name
)
return
getattr
(
self
,
'_
pd
__'
+
name
)
def
__set_f
(
self
,
num
,
value
):
setattr
(
self
,
'_
'
+
self
.
__class__
.
__name__
+
'
__f'
+
num
,
float
(
value
))
setattr
(
self
,
'_
pd
__f'
+
num
,
float
(
value
))
def
__set_phi
(
self
,
num
,
value
):
if
value
==
None
and
num
!=
self
.
num_demods
:
...
...
@@ -337,10 +337,10 @@ class pd(Detector):
return
rtn
def
qnoised
(
pd
):
class
qnoised
(
pd
):
def
__init__
(
self
,
name
,
num_demods
,
node_name
,
alternate_beam
=
False
,
pdtype
=
None
,
**
kwargs
):
pd
.
__init__
(
self
,
name
,
num_demods
,
node_name
,
alternate_beam
=
F
al
s
e
,
**
kwargs
)
super
(
qnoised
,
self
)
.
__init__
(
name
,
num_demods
,
node_name
,
alternate_beam
=
al
ternate_beam
,
pdtype
=
pdtyp
e
,
**
kwargs
)
self
.
__homangle
=
AttrParam
(
"homangle"
,
self
,
None
)
...
...
@@ -350,31 +350,40 @@ def qnoised(pd):
def
homangle
(
self
,
value
):
self
.
__homangle
.
value
=
value
@
pd
.
pdtype
.
setter
def
pdtype
(
self
,
value
):
raise
pkex
.
BasePyKatException
(
"Setting pdtype is not possible with qnoised detectors"
)
def
pdtype
(
self
,
value
):
raise
pkex
.
BasePyKatException
(
"Setting pdtype is not possible with qnoised detectors"
)
@
pd
.
senstype
.
setter
def
senstype
(
self
,
value
):
raise
pkex
.
BasePyKatException
(
"qnoised detector has no sensitvity type"
)
def
senstype
(
self
,
value
):
raise
pkex
.
BasePyKatException
(
"qnoised detector has no sensitvity type"
)
def
parseAttributes
(
self
,
values
):
for
key
in
values
.
keys
():
if
key
in
[
"homangle"
]:
self
.
__homangle
.
value
=
values
[
key
]
else
:
raise
pkex
.
BasePyKatException
(
"No attribute {0} for qnoised"
.
format
(
key
))
@
staticmethod
def
parseFinesseText
(
text
):
values
=
text
.
split
()
if
len
(
values
)
<=
3
:
raise
pkex
.
BasePyKatException
(
"
Photodiode
code format incorrect '{0}' (2)"
.
format
(
text
))
raise
pkex
.
BasePyKatException
(
"
qnoised
code format incorrect '{0}' (2)"
.
format
(
text
))
demods
=
values
[
2
]
demods
=
int
(
values
[
2
]
)
if
len
(
values
)
<=
4
and
demods
>
0
:
raise
pkex
.
BasePyKatException
(
"
Photodiode
code format incorrect '{0}' (2)"
.
format
(
text
))
raise
pkex
.
BasePyKatException
(
"
qnoised
code format incorrect '{0}' (2)"
.
format
(
text
))
elif
len
(
values
)
>
4
and
demods
==
0
:
raise
pkex
.
BasePyKatException
(
"
Photodiode
code format incorrect '{0}' (3)"
.
format
(
text
))
raise
pkex
.
BasePyKatException
(
"
qnoised
code format incorrect '{0}' (3)"
.
format
(
text
))
num_f_phs
=
len
(
values
)
-
4
expected_f_phs
=
demods
*
2
if
not
(
num_f_phs
==
expected_f_phs
or
num_f_phs
==
expected_f_phs
-
1
):
raise
pkex
.
BasePyKatException
(
"
Photodiode
code format incorrect '{0}' (4)"
.
format
(
text
))
if
not
(
num_f_phs
==
expected_f_phs
or
num_f_phs
==
(
expected_f_phs
-
1
)
)
:
raise
pkex
.
BasePyKatException
(
"
qnoised
code format incorrect '{0}' (4)"
.
format
(
text
))
f
=
values
[
3
:
len
(
values
)
-
1
:
2
]
phs
=
values
[
4
:
len
(
values
)
-
1
:
2
]
...
...
@@ -425,7 +434,90 @@ def qnoised(pd):
rtn
.
extend
(
p
.
getFinesseText
())
return
rtn
class
qnoised
(
pd
):
def
__init__
(
self
,
name
,
num_demods
,
node_name
,
alternate_beam
=
False
,
**
kwargs
):
super
(
qnoised
,
self
).
__init__
(
name
,
num_demods
,
node_name
,
alternate_beam
=
alternate_beam
,
pdtype
=
None
,
senstype
=
None
,
**
kwargs
)
@
pd
.
pdtype
.
setter
def
pdtype
(
self
,
value
):
raise
pkex
.
BasePyKatException
(
"Setting pdtype is not possible with qshot detectors"
)
@
pd
.
senstype
.
setter
def
senstype
(
self
,
value
):
raise
pkex
.
BasePyKatException
(
"qshot detector has no sensitvity type"
)
@
staticmethod
def
parseFinesseText
(
text
):
values
=
text
.
split
()
if
len
(
values
)
<=
3
:
raise
pkex
.
BasePyKatException
(
"qshot code format incorrect '{0}' (2)"
.
format
(
text
))
demods
=
int
(
values
[
2
])
if
len
(
values
)
<=
4
and
demods
>
0
:
raise
pkex
.
BasePyKatException
(
"qshot code format incorrect '{0}' (2)"
.
format
(
text
))
elif
len
(
values
)
>
4
and
demods
==
0
:
raise
pkex
.
BasePyKatException
(
"qshot code format incorrect '{0}' (3)"
.
format
(
text
))
num_f_phs
=
len
(
values
)
-
4
expected_f_phs
=
demods
*
2
if
not
(
num_f_phs
==
expected_f_phs
or
num_f_phs
==
(
expected_f_phs
-
1
)):
raise
pkex
.
BasePyKatException
(
"qshot code format incorrect '{0}' (4)"
.
format
(
text
))
f
=
values
[
3
:
len
(
values
)
-
1
:
2
]
phs
=
values
[
4
:
len
(
values
)
-
1
:
2
]
dict
=
{}
for
i
in
range
(
len
(
f
)):
dict
[
'f{0}'
.
format
(
i
+
1
)]
=
f
[
i
]
for
i
in
range
(
len
(
phs
)):
dict
[
'phi{0}'
.
format
(
i
+
1
)]
=
phs
[
i
]
node
=
values
[
-
1
]
alt_beam
=
node
[
-
1
]
==
'*'
if
alt_beam
:
node
=
node
[
0
:
-
1
]
return
qnoised
(
values
[
1
],
demods
,
node
,
alternate_beam
=
alt_beam
,
**
dict
)
def
getFinesseText
(
self
)
:
rtn
=
[]
if
self
.
enabled
:
alt_str
=
""
fphi_str
=
""
if
self
.
alternate_beam
:
alt_str
=
"*"
for
n
in
range
(
1
,
1
+
self
.
num_demods
):
fphi_str
+=
" "
+
str
(
self
.
__getattribute__
(
"f"
+
str
(
n
)))
phi_val
=
self
.
__getattribute__
(
"phi"
+
str
(
n
))
if
phi_val
!=
None
:
fphi_str
+=
" "
+
str
(
phi_val
)
senstype
=
self
.
senstype
if
senstype
==
None
:
senstype
=
""
rtn
.
append
(
"qshot {0} {1} {2} {3}{4}"
.
format
(
self
.
name
,
self
.
num_demods
,
fphi_str
,
self
.
node
.
name
,
alt_str
))
if
self
.
scale
!=
None
:
rtn
.
append
(
"scale {1} {0}"
.
format
(
self
.
name
,
self
.
scale
))
for
p
in
self
.
_params
:
rtn
.
extend
(
p
.
getFinesseText
())
return
rtn
def
xd
(
Detector
):
def
__init__
(
self
,
name
,
node_name
,
component
,
motion
):
...
...
pykat/finesse.py
View file @
fe3973b9
...
...
@@ -445,6 +445,10 @@ class kat(object):
obj
=
pykat
.
detectors
.
ad
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
2
]
==
"pd"
and
first
!=
"pdtype"
):
obj
=
pykat
.
detectors
.
pd
.
parseFinesseText
(
line
)
elif
(
first
==
"qshot"
):
obj
=
pykat
.
detectors
.
qshot
.
parseFinesseText
(
line
)
elif
(
first
==
"qnoised"
):
obj
=
pykat
.
detectors
.
qnoised
.
parseFinesseText
(
line
)
elif
(
first
==
"xaxis"
or
first
==
"xaxis*"
):
obj
=
pykat
.
commands
.
xaxis
.
parseFinesseText
(
line
)
elif
(
first
==
"x2axis"
or
first
==
"x2axis*"
):
...
...
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