Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pykat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sebastian Steinlechner
pykat
Commits
fe3973b9
Commit
fe3973b9
authored
11 years ago
by
Daniel Brown
Browse files
Options
Downloads
Patches
Plain Diff
adding more detectors
parent
56045da2
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
pykat/components.py
+26
-1
26 additions, 1 deletion
pykat/components.py
pykat/detectors.py
+104
-12
104 additions, 12 deletions
pykat/detectors.py
pykat/finesse.py
+4
-0
4 additions, 0 deletions
pykat/finesse.py
with
134 additions
and
13 deletions
pykat/components.py
+
26
−
1
View file @
fe3973b9
...
@@ -155,7 +155,7 @@ class Component(object):
...
@@ -155,7 +155,7 @@ class Component(object):
class
AbstractMirrorComponent
(
Component
):
class
AbstractMirrorComponent
(
Component
):
__metaclass__
=
abc
.
ABCMeta
__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
)
super
(
AbstractMirrorComponent
,
self
).
__init__
(
name
)
if
(
L
!=
None
and
R
!=
None
and
T
!=
None
)
and
SIfloat
(
R
)
+
SIfloat
(
T
)
+
SIfloat
(
L
)
!=
1
:
if
(
L
!=
None
and
R
!=
None
and
T
!=
None
)
and
SIfloat
(
R
)
+
SIfloat
(
T
)
+
SIfloat
(
L
)
!=
1
:
...
@@ -183,6 +183,10 @@ class AbstractMirrorComponent(Component):
...
@@ -183,6 +183,10 @@ class AbstractMirrorComponent(Component):
self
.
__Iy
=
AttrParam
(
"
Iy
"
,
self
,
SIfloat
(
Iy
))
self
.
__Iy
=
AttrParam
(
"
Iy
"
,
self
,
SIfloat
(
Iy
))
self
.
__r_ap
=
AttrParam
(
"
r_ap
"
,
self
,
SIfloat
(
r_ap
))
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
@property
def
L
(
self
):
return
self
.
__L
def
L
(
self
):
return
self
.
__L
@L.setter
@L.setter
...
@@ -243,6 +247,21 @@ class AbstractMirrorComponent(Component):
...
@@ -243,6 +247,21 @@ class AbstractMirrorComponent(Component):
@ybeta.setter
@ybeta.setter
def
ybeta
(
self
,
value
):
self
.
__ybeta
.
value
=
SIfloat
(
value
)
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
@property
def
Rc
(
self
):
def
Rc
(
self
):
if
self
.
Rcx
==
self
.
Rcy
:
if
self
.
Rcx
==
self
.
Rcy
:
...
@@ -278,6 +297,12 @@ class AbstractMirrorComponent(Component):
...
@@ -278,6 +297,12 @@ class AbstractMirrorComponent(Component):
self
.
Ix
=
value
self
.
Ix
=
value
elif
key
in
[
"
Iy
"
,
"
iy
"
]:
elif
key
in
[
"
Iy
"
,
"
iy
"
]:
self
.
Iy
=
value
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
:
else
:
return
False
return
False
...
...
This diff is collapsed.
Click to expand it.
pykat/detectors.py
+
104
−
12
View file @
fe3973b9
...
@@ -217,10 +217,10 @@ class pd(Detector):
...
@@ -217,10 +217,10 @@ class pd(Detector):
def
pdtype
(
self
,
value
):
self
.
__pdtype
=
value
def
pdtype
(
self
,
value
):
self
.
__pdtype
=
value
def
__get_fphi
(
self
,
name
):
def
__get_fphi
(
self
,
name
):
return
getattr
(
self
,
'
_
'
+
self
.
__class__
.
__name__
+
'
__
'
+
name
)
return
getattr
(
self
,
'
_
pd
__
'
+
name
)
def
__set_f
(
self
,
num
,
value
):
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
):
def
__set_phi
(
self
,
num
,
value
):
if
value
==
None
and
num
!=
self
.
num_demods
:
if
value
==
None
and
num
!=
self
.
num_demods
:
...
@@ -337,10 +337,10 @@ class pd(Detector):
...
@@ -337,10 +337,10 @@ class pd(Detector):
return
rtn
return
rtn
def
qnoised
(
pd
):
class
qnoised
(
pd
):
def
__init__
(
self
,
name
,
num_demods
,
node_name
,
alternate_beam
=
False
,
pdtype
=
None
,
**
kwargs
):
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
)
self
.
__homangle
=
AttrParam
(
"
homangle
"
,
self
,
None
)
...
@@ -350,31 +350,40 @@ def qnoised(pd):
...
@@ -350,31 +350,40 @@ def qnoised(pd):
def
homangle
(
self
,
value
):
self
.
__homangle
.
value
=
value
def
homangle
(
self
,
value
):
self
.
__homangle
.
value
=
value
@pd.pdtype.setter
@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
@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
@staticmethod
def
parseFinesseText
(
text
):
def
parseFinesseText
(
text
):
values
=
text
.
split
()
values
=
text
.
split
()
if
len
(
values
)
<=
3
:
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
:
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
:
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
num_f_phs
=
len
(
values
)
-
4
expected_f_phs
=
demods
*
2
expected_f_phs
=
demods
*
2
if
not
(
num_f_phs
==
expected_f_phs
or
num_f_phs
==
expected_f_phs
-
1
):
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
))
raise
pkex
.
BasePyKatException
(
"
qnoised
code format incorrect
'
{0}
'
(4)
"
.
format
(
text
))
f
=
values
[
3
:
len
(
values
)
-
1
:
2
]
f
=
values
[
3
:
len
(
values
)
-
1
:
2
]
phs
=
values
[
4
:
len
(
values
)
-
1
:
2
]
phs
=
values
[
4
:
len
(
values
)
-
1
:
2
]
...
@@ -426,6 +435,89 @@ def qnoised(pd):
...
@@ -426,6 +435,89 @@ def qnoised(pd):
return
rtn
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
xd
(
Detector
):
def
__init__
(
self
,
name
,
node_name
,
component
,
motion
):
def
__init__
(
self
,
name
,
node_name
,
component
,
motion
):
...
...
This diff is collapsed.
Click to expand it.
pykat/finesse.py
+
4
−
0
View file @
fe3973b9
...
@@ -445,6 +445,10 @@ class kat(object):
...
@@ -445,6 +445,10 @@ class kat(object):
obj
=
pykat
.
detectors
.
ad
.
parseFinesseText
(
line
)
obj
=
pykat
.
detectors
.
ad
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
2
]
==
"
pd
"
and
first
!=
"
pdtype
"
):
elif
(
first
[
0
:
2
]
==
"
pd
"
and
first
!=
"
pdtype
"
):
obj
=
pykat
.
detectors
.
pd
.
parseFinesseText
(
line
)
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*
"
):
elif
(
first
==
"
xaxis
"
or
first
==
"
xaxis*
"
):
obj
=
pykat
.
commands
.
xaxis
.
parseFinesseText
(
line
)
obj
=
pykat
.
commands
.
xaxis
.
parseFinesseText
(
line
)
elif
(
first
==
"
x2axis
"
or
first
==
"
x2axis*
"
):
elif
(
first
==
"
x2axis
"
or
first
==
"
x2axis*
"
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment