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
finesse
pykat
Commits
328f1b88
Commit
328f1b88
authored
11 years ago
by
Andreas Freise
Browse files
Options
Downloads
Patches
Plain Diff
pd object still not working, just backing up.
parent
ab37de12
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
+61
-35
61 additions, 35 deletions
pykat/detectors.py
pykat/finesse.py
+1
-0
1 addition, 0 deletions
pykat/finesse.py
with
62 additions
and
35 deletions
pykat/detectors.py
+
61
−
35
View file @
328f1b88
...
...
@@ -49,31 +49,56 @@ class Detector(object) :
class
photodiode
(
Detector
):
def
__init__
(
self
,
name
,
node
,
type
,
num_demods
,
demods
):
class
f
(
list
):
def
__init__
(
self
,
values
=
None
):
print
"
tadaaaaaaaaaaaaaaa
"
if
values
is
None
:
self
.
values
=
[]
else
:
self
.
values
=
values
def
__getitem__
(
self
,
key
):
return
self
.
values
[
key
]
def
__setitem__
(
self
,
key
,
value
):
self
.
values
[
key
]
=
SIfloat
(
value
)
class
phi
(
list
):
def
__init__
(
self
,
values
=
None
):
print
values
if
values
is
None
:
self
.
values
=
[]
else
:
self
.
values
=
values
def
__getitem__
(
self
,
key
):
# probably not needed
print
"
boom
"
if
self
.
values
[
key
]
==
"
max
"
:
return
self
.
values
[
key
]
else
:
return
float
(
self
.
values
[
key
])
def
__setitem__
(
self
,
key
,
value
):
if
value
==
"
max
"
:
self
.
values
[
key
]
=
value
else
:
self
.
values
[
key
]
=
SIfloat
(
value
)
def
__init__
(
self
,
name
,
node
,
senstype
,
num_demods
,
demods
):
Detector
.
__init__
(
self
,
name
,
node
)
if
num_demods
>
2
:
raise
NotImplementedError
(
"
pd with more than two demodulations not implemented yet
"
)
self
.
num_demods
=
num_demods
self
.
type
=
type
self
@property
def
num_demods
(
self
):
return
Param
(
'
num_demods
'
,
self
.
__num_demods
)
@num_demods.setter
def
num_demods
(
self
,
value
):
self
.
__num_demods
=
int
(
value
)
@property
def
type
(
self
):
return
Param
(
'
type
'
,
self
.
__type
)
@type.setter
def
type
(
self
,
value
):
self
.
__type
=
value
@property
def
f1
(
self
):
return
Param
(
'
f1
'
,
self
.
__f1
)
@f1.setter
def
f1
(
self
,
value
):
self
.
__f1
=
SIfloat
(
value
)
@property
def
phi1
(
self
):
return
Param
(
'
phi1
'
,
self
.
__phi1
)
@phi1.setter
def
phi1
(
self
,
value
):
self
.
__phi1
=
SIfloat
(
value
)
self
.
senstype
=
senstype
# every second element into f (starting at 1)
self
.
f
(
demods
[::
2
])
print
self
.
f
[
1
]
# every second element into phi (starting at 2)
self
.
phi
([
1
,
2
])
print
self
.
phi
[
1
]
for
i
in
demods
[
1
::
2
]:
self
.
phi
.
append
(
i
)
@staticmethod
def
parseFinesseText
(
text
):
...
...
@@ -81,23 +106,24 @@ class photodiode(Detector):
if
values
[
0
][
0
:
2
]
!=
"
pd
"
:
raise
exceptions
.
FinesseParse
(
"'
{0}
'
not a valid photodiode command
"
.
format
(
text
))
if
len
(
value
[
0
])
==
2
:
if
len
(
value
s
[
0
])
==
2
:
__num_demods
=
0
__type
=
""
elif
len
(
value
[
0
])
==
3
or
len
(
value
[
0
])
==
4
:
if
value
[
0
][
3
]
==
"
S
"
:
__type
=
"
S
"
elif
value
[
0
][
3
]
==
"
N
"
:
__type
=
"
N
"
__senstype
=
""
elif
len
(
values
[
0
])
==
3
or
len
(
values
[
0
])
==
4
:
print
len
(
values
[
0
])
if
values
[
0
][
2
]
==
"
S
"
:
__senstype
=
"
S
"
elif
values
[
0
][
2
]
==
"
N
"
:
__senstype
=
"
N
"
else
:
try
:
__num_demods
=
int
(
values
[
0
][
3
])
__type
=
""
__num_demods
=
int
(
values
[
0
][
2
])
__
sens
type
=
""
except
ValueError
:
raise
exceptions
.
FinesseParse
(
"'
{0}
'
not a valid photodiode command
"
.
format
(
text
))
if
len
(
value
[
0
])
==
4
:
if
len
(
value
s
[
0
])
==
4
:
try
:
__num_demods
=
int
(
values
[
0
][
4
])
__num_demods
=
int
(
values
[
0
][
3
])
except
ValueError
:
raise
exceptions
.
FinesseParse
(
"'
{0}
'
not a valid photodiode command
"
.
format
(
text
))
else
:
...
...
@@ -109,7 +135,7 @@ class photodiode(Detector):
values
.
pop
(
0
)
# remove initial value
if
len
(
values
)
==
2
*
__num_demods
+
1
or
len
(
values
)
==
2
*
__num_demods
+
2
:
return
photodiode
(
value
[
0
],
values
[
-
1
],
__type
,
__num_demods
,
values
[
1
:
len
(
values
-
1
)
])
return
photodiode
(
value
s
[
0
],
values
[
-
1
],
__
sens
type
,
__num_demods
,
values
[
1
:
len
(
values
)
-
1
])
else
:
raise
exceptions
.
FinesseParse
(
"
Photodiode code format incorrect
'
{0}
'"
.
format
(
text
))
...
...
This diff is collapsed.
Click to expand it.
pykat/finesse.py
+
1
−
0
View file @
328f1b88
...
...
@@ -315,6 +315,7 @@ class kat(object):
def
add
(
self
,
obj
)
:
print
type
(
obj
)
try
:
obj
.
tag
=
self
.
__currentTag
if
isinstance
(
obj
,
Component
):
...
...
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