Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sebastian Steinlechner
pykat
Commits
4547bf69
Commit
4547bf69
authored
Jan 09, 2014
by
Andreas Freise
Browse files
adding pdtype as variable of the pd object.
parent
d7210aa5
Changes
2
Hide whitespace changes
Inline
Side-by-side
pykat/detectors.py
View file @
4547bf69
...
@@ -81,12 +81,13 @@ class Detector(object) :
...
@@ -81,12 +81,13 @@ class Detector(object) :
class
pd
(
Detector
):
class
pd
(
Detector
):
def
__init__
(
self
,
name
,
num_demods
,
node_name
,
senstype
=
None
,
alternate_beam
=
False
,
**
kwargs
):
def
__init__
(
self
,
name
,
num_demods
,
node_name
,
senstype
=
None
,
alternate_beam
=
False
,
pdtype
=
None
,
**
kwargs
):
Detector
.
__init__
(
self
,
name
,
node_name
)
Detector
.
__init__
(
self
,
name
,
node_name
)
self
.
__num_demods
=
num_demods
self
.
__num_demods
=
num_demods
self
.
__senstype
=
senstype
self
.
__senstype
=
senstype
self
.
__alternate_beam
=
alternate_beam
self
.
__alternate_beam
=
alternate_beam
self
.
__pdtype
=
pdtype
# create the parameters for all 5 demodulations regardless
# create the parameters for all 5 demodulations regardless
# 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
...
@@ -121,6 +122,11 @@ class pd(Detector):
...
@@ -121,6 +122,11 @@ class pd(Detector):
self
.
__senstype
=
value
self
.
__senstype
=
value
@
property
@
property
def
pdtype
(
self
):
return
self
.
__pdtype
@
pdtype
.
setter
def
pdtype
(
self
,
value
):
self
.
__pdtype
=
value
@
property
def
num_demods
(
self
):
return
self
.
__num_demods
def
num_demods
(
self
):
return
self
.
__num_demods
@
num_demods
.
setter
@
num_demods
.
setter
def
num_demods
(
self
,
value
):
def
num_demods
(
self
,
value
):
...
@@ -226,7 +232,7 @@ class photodiode(Detector):
...
@@ -226,7 +232,7 @@ class photodiode(Detector):
return
list
.
__getitem__
(
self
,
key
)
return
list
.
__getitem__
(
self
,
key
)
else
:
else
:
return
float
(
list
.
__getitem__
(
self
,
key
))
return
float
(
list
.
__getitem__
(
self
,
key
))
@
property
@
property
def
f
(
self
):
return
self
.
__f
def
f
(
self
):
return
self
.
__f
...
@@ -304,6 +310,9 @@ class photodiode(Detector):
...
@@ -304,6 +310,9 @@ class photodiode(Detector):
if
self
.
scale
!=
None
and
self
.
scale
!=
''
:
if
self
.
scale
!=
None
and
self
.
scale
!=
''
:
rtn
.
append
(
"scale {1} {0}"
.
format
(
self
.
name
,
self
.
scale
))
rtn
.
append
(
"scale {1} {0}"
.
format
(
self
.
name
,
self
.
scale
))
if
self
.
pdtype
!=
None
:
rtn
.
append
(
"pdtype {1} {0}"
.
format
(
self
.
name
,
self
.
pdtype
))
if
self
.
noplot
:
if
self
.
noplot
:
rtn
.
append
(
"noplot {0}"
.
format
(
self
.
name
))
rtn
.
append
(
"noplot {0}"
.
format
(
self
.
name
))
...
...
pykat/finesse.py
View file @
4547bf69
...
@@ -282,6 +282,8 @@ class kat(object):
...
@@ -282,6 +282,8 @@ class kat(object):
after_process
.
append
(
line
)
after_process
.
append
(
line
)
elif
(
first
==
"scale"
):
elif
(
first
==
"scale"
):
after_process
.
append
(
line
)
after_process
.
append
(
line
)
elif
(
first
==
"pdtype"
):
after_process
.
append
(
line
)
elif
(
first
==
"noxaxis"
):
elif
(
first
==
"noxaxis"
):
self
.
noxaxis
=
True
self
.
noxaxis
=
True
elif
(
first
==
"phase"
):
elif
(
first
==
"phase"
):
...
@@ -339,6 +341,16 @@ class kat(object):
...
@@ -339,6 +341,16 @@ class kat(object):
self
.
scale
=
SIfloat
(
v
[
1
])
self
.
scale
=
SIfloat
(
v
[
1
])
else
:
else
:
raise
pkex
.
BasePyKatException
(
"scale command `{0}` is incorrect."
.
format
(
text
))
raise
pkex
.
BasePyKatException
(
"scale command `{0}` is incorrect."
.
format
(
text
))
elif
(
first
==
"pdtype"
):
v
=
line
.
split
(
" "
)
if
len
(
v
)
==
3
:
component_name
=
v
[
1
]
if
component_name
in
self
.
__detectors
:
self
.
__detectors
[
component_name
].
type
=
v
[
2
]
else
:
raise
pkex
.
BasePyKatException
(
"pdtype command `{0}` refers to non-existing detector"
.
format
(
text
))
else
:
raise
pkex
.
BasePyKatException
(
"pdtype command `{0}` is incorrect."
.
format
(
text
))
...
@@ -614,7 +626,7 @@ class kat(object):
...
@@ -614,7 +626,7 @@ class kat(object):
if
fragment
in
obj
:
if
fragment
in
obj
:
print
" ** removing line '{0}'"
.
format
(
obj
)
print
" ** removing line '{0}'"
.
format
(
obj
)
objs
.
remove
(
obj
)
objs
.
remove
(
obj
)
def
generateKatScript
(
self
)
:
def
generateKatScript
(
self
)
:
""" Generates the kat file which can then be run """
""" Generates the kat file which can then be run """
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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