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
32d715e3
Commit
32d715e3
authored
11 years ago
by
Andreas Freise
Browse files
Options
Downloads
Patches
Plain Diff
first working version of parsing f and phi of pds.
parent
35d22f32
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
pykat/detectors.py
+33
-41
33 additions, 41 deletions
pykat/detectors.py
with
33 additions
and
41 deletions
pykat/detectors.py
+
33
−
41
View file @
32d715e3
...
...
@@ -51,52 +51,47 @@ class Detector(object) :
class
photodiode
(
Detector
):
class
F
:
class
__F
(
list
)
:
def
__init__
(
self
,
values
=
None
):
if
values
is
None
:
self
.
values
=
[]
else
:
self
.
values
=
values
def
__len__
(
self
):
return
len
(
self
.
values
)
def
__getitem__
(
self
,
key
):
# if key is of invalid type or value, the list values will raise the error
return
self
.
values
[
key
]
if
values
==
None
:
values
=
[]
list
.
__init__
(
self
,[
SIfloat
(
value
)
for
value
in
values
])
def
__setitem__
(
self
,
key
,
value
):
print
"
setting
"
self
.
values
[
key
]
=
SIfloat
(
value
)
list
.
__setitem__
(
self
,
key
,
SIfloat
(
value
))
### todo add append with SIfloat
class
Phi
():
def
__init__
(
self
,
values
=
None
):
print
values
if
values
is
None
:
self
.
values
=
[]
class
__Phi
(
list
):
def
__convertValue
(
self
,
value
):
if
value
==
"
max
"
:
return
value
else
:
self
.
values
=
values
return
SIfloat
(
value
)
def
__init__
(
self
,
values
=
None
):
if
values
==
None
:
values
=
[]
list
.
__init__
(
self
,[
self
.
__convertValue
(
value
)
for
value
in
values
])
def
__getitem__
(
self
,
key
):
# probably not needed
print
"
boom
"
if
self
.
values
[
key
]
==
"
max
"
:
return
self
.
values
[
key
]
if
list
.
__getitem__
(
self
,
key
)
==
"
max
"
:
return
list
.
__getitem__
(
self
,
key
)
else
:
return
float
(
self
.
values
[
key
]
)
return
float
(
list
.
__getitem__
(
self
,
key
)
)
def
__setitem__
(
self
,
key
,
value
):
if
value
==
"
max
"
:
self
.
values
[
key
]
=
value
else
:
self
.
values
[
key
]
=
SIfloat
(
value
)
def
append
(
self
,
value
):
self
.
values
.
append
(
value
)
list
.
__setitem__
(
self
,
key
,
self
.
__convertValue
(
value
))
### todo add append with convertValue
@property
def
f
(
self
):
return
self
.
F
(
'
f
'
,
self
.
__f
)
@f.setter
def
f
(
self
,
key
,
value
):
self
.
__f
[
key
]
=
value
def
f
(
self
):
return
self
.
__f
@property
def
phi
(
self
):
return
self
.
__phi
def
__init__
(
self
,
name
,
node
,
senstype
=
None
,
num_demods
=
0
,
demods
=
[]):
Detector
.
__init__
(
self
,
name
,
node
)
...
...
@@ -106,15 +101,12 @@ class photodiode(Detector):
self
.
senstype
=
senstype
# every second element into f (starting at 1)
self
.
__f
=
self
.
F
(
demods
[::
2
])
self
.
__f
=
self
.
__
F
(
demods
[::
2
])
# Every second element into phi (starting at 2)
self
.
__phi
=
self
.
Phi
()
self
.
__phi
=
self
.
__
Phi
()
for
i
in
demods
[
1
::
2
]:
self
.
__phi
.
append
(
i
)
print
self
.
__phi
print
self
.
__phi
[
0
]
@staticmethod
def
parseFinesseText
(
text
):
...
...
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