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
68a1300c
Commit
68a1300c
authored
11 years ago
by
Daniel Brown
Browse files
Options
Downloads
Patches
Plain Diff
setting pd as default photodiode type, includes parsing now
parent
83f5980c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pykat/detectors.py
+73
-6
73 additions, 6 deletions
pykat/detectors.py
pykat/finesse.py
+1
-1
1 addition, 1 deletion
pykat/finesse.py
with
74 additions
and
7 deletions
pykat/detectors.py
+
73
−
6
View file @
68a1300c
...
@@ -12,6 +12,8 @@ from pykat.gui.graphics import *
...
@@ -12,6 +12,8 @@ from pykat.gui.graphics import *
from
pykat.node_network
import
*
from
pykat.node_network
import
*
from
pykat.param
import
Param
from
pykat.param
import
Param
import
pykat.exceptions
as
pkex
import
warnings
class
Detector
(
object
)
:
class
Detector
(
object
)
:
def
__init__
(
self
,
name
,
node
):
def
__init__
(
self
,
name
,
node
):
...
@@ -93,11 +95,11 @@ class pd(Detector):
...
@@ -93,11 +95,11 @@ class pd(Detector):
# of how many the user specifies. Later we add properties to
# of how many the user specifies. Later we add properties to
# those which correspond to the number of demodulations
# those which correspond to the number of demodulations
self
.
__f1
=
Param
(
"
f1
"
,
self
,
0
)
self
.
__f1
=
Param
(
"
f1
"
,
self
,
None
)
self
.
__f2
=
Param
(
"
f2
"
,
self
,
0
)
self
.
__f2
=
Param
(
"
f2
"
,
self
,
None
)
self
.
__f3
=
Param
(
"
f3
"
,
self
,
0
)
self
.
__f3
=
Param
(
"
f3
"
,
self
,
None
)
self
.
__f4
=
Param
(
"
f4
"
,
self
,
0
)
self
.
__f4
=
Param
(
"
f4
"
,
self
,
None
)
self
.
__f5
=
Param
(
"
f5
"
,
self
,
0
)
self
.
__f5
=
Param
(
"
f5
"
,
self
,
None
)
self
.
__phi1
=
Param
(
"
phi1
"
,
self
,
None
)
self
.
__phi1
=
Param
(
"
phi1
"
,
self
,
None
)
self
.
__phi2
=
Param
(
"
phi2
"
,
self
,
None
)
self
.
__phi2
=
Param
(
"
phi2
"
,
self
,
None
)
...
@@ -105,6 +107,27 @@ class pd(Detector):
...
@@ -105,6 +107,27 @@ class pd(Detector):
self
.
__phi4
=
Param
(
"
phi4
"
,
self
,
None
)
self
.
__phi4
=
Param
(
"
phi4
"
,
self
,
None
)
self
.
__phi5
=
Param
(
"
phi5
"
,
self
,
None
)
self
.
__phi5
=
Param
(
"
phi5
"
,
self
,
None
)
fs
=
[
self
.
__f1
,
self
.
__f2
,
self
.
__f3
,
self
.
__f4
,
self
.
__f5
]
ps
=
[
self
.
__phi1
,
self
.
__phi2
,
self
.
__phi3
,
self
.
__phi4
,
self
.
__phi5
]
for
i
in
range
(
num_demods
):
f
=
'
f{0}
'
.
format
(
i
+
1
)
if
f
in
kwargs
:
fs
[
i
].
value
=
kwargs
[
f
]
else
:
raise
pkex
.
BasePyKatException
(
"
Missing demodulation frequency {0} (f{0})
"
.
format
(
i
+
1
))
p
=
'
phi{0}
'
.
format
(
i
+
1
)
if
p
in
kwargs
:
if
kwargs
[
p
]
==
None
and
i
<
num_demods
-
1
:
raise
pkex
.
BasePyKatException
(
"
Missing demodulation phase {0} (phi{0})
"
.
format
(
i
+
1
))
ps
[
i
].
value
=
kwargs
[
p
]
elif
i
<
num_demods
-
1
:
raise
pkex
.
BasePyKatException
(
"
Missing demodulation phase {0} (phi{0})
"
.
format
(
i
+
1
))
# define new class for assigning new attributes
# define new class for assigning new attributes
cls
=
type
(
self
)
cls
=
type
(
self
)
self
.
__class__
=
type
(
cls
.
__name__
,
(
cls
,),
{})
self
.
__class__
=
type
(
cls
.
__name__
,
(
cls
,),
{})
...
@@ -179,6 +202,50 @@ class pd(Detector):
...
@@ -179,6 +202,50 @@ class pd(Detector):
else
:
else
:
return
return
@staticmethod
def
parseFinesseText
(
text
):
values
=
text
.
split
(
"
"
)
demods
=
0
senstype
=
None
if
len
(
values
[
0
])
==
4
:
senstype
=
values
[
0
][
2
]
demods
=
int
(
values
[
0
][
3
])
elif
len
(
values
[
0
])
==
3
:
demods
=
int
(
values
[
0
][
2
])
elif
len
(
values
[
0
]
!=
2
):
raise
pkex
.
BasePyKatException
(
"
Photodiode code format incorrect
'
{0}
'"
.
format
(
text
))
if
len
(
values
)
<=
3
and
demods
>
0
:
raise
pkex
.
BasePyKatException
(
"
Photodiode code format incorrect
'
{0}
'"
.
format
(
text
))
elif
len
(
values
)
>=
3
and
demods
==
0
:
raise
pkex
.
BasePyKatException
(
"
Photodiode code format incorrect
'
{0}
'"
.
format
(
text
))
num_f_phs
=
len
(
values
)
-
3
expected_f_phs
=
demods
*
2
if
num_f_phs
!=
expected_f_phs
and
num_f_phs
-
1
!=
expected_f_phs
:
raise
pkex
.
BasePyKatException
(
"
Photodiode code format incorrect
'
{0}
'"
.
format
(
text
))
f
=
values
[
2
:
len
(
values
)
-
1
:
2
]
phs
=
values
[
3
:
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
pd
(
values
[
1
],
demods
,
node
,
senstype
=
senstype
,
alternate_beam
=
alt_beam
,
**
dict
)
def
getFinesseText
(
self
)
:
def
getFinesseText
(
self
)
:
rtn
=
[]
rtn
=
[]
...
...
This diff is collapsed.
Click to expand it.
pykat/finesse.py
+
1
−
1
View file @
68a1300c
...
@@ -393,7 +393,7 @@ class kat(object):
...
@@ -393,7 +393,7 @@ class kat(object):
elif
(
first
[
0
:
3
]
==
"
mod
"
):
elif
(
first
[
0
:
3
]
==
"
mod
"
):
obj
=
pykat
.
components
.
modulator
.
parseFinesseText
(
line
)
obj
=
pykat
.
components
.
modulator
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
2
]
==
"
pd
"
and
first
!=
"
pdtype
"
):
elif
(
first
[
0
:
2
]
==
"
pd
"
and
first
!=
"
pdtype
"
):
obj
=
pykat
.
detectors
.
p
hotodiode
.
parseFinesseText
(
line
)
obj
=
pykat
.
detectors
.
p
d
.
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