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
finesse
pykat
Commits
f05991ad
Commit
f05991ad
authored
Apr 12, 2016
by
Daniel Brown
Browse files
Merge branch 'master' of gitmaster.atlas.aei.uni-hannover.de:pykat/pykat
parents
97fcdafd
4a93bd25
Changes
3
Hide whitespace changes
Inline
Side-by-side
pykat/commands.py
View file @
f05991ad
...
...
@@ -94,9 +94,17 @@ class func(Command):
Command
.
__init__
(
self
,
name
,
False
)
self
.
value
=
value
self
.
noplot
=
False
def
getFinesseText
(
self
):
return
"func {name} = {value}"
.
format
(
name
=
self
.
name
,
value
=
str
(
self
.
value
))
rtn
=
[]
if
self
.
noplot
:
rtn
.
append
(
"noplot "
+
self
.
name
)
rtn
.
append
(
"func {name} = {value}"
.
format
(
name
=
self
.
name
,
value
=
str
(
self
.
value
)))
return
rtn
@
staticmethod
def
parseFinesseText
(
line
,
kat
):
...
...
pykat/detectors.py
View file @
f05991ad
...
...
@@ -134,7 +134,12 @@ class BaseDetector(object) :
def
getFinesseText
(
self
):
""" Base class for individual finesse optical components """
raise
NotImplementedError
(
"This function is not implemented"
)
#raise NotImplementedError("This function is not implemented")
if
self
.
noplot
:
return
[
"noplot "
+
self
.
name
]
else
:
return
[]
def
getQGraphicsItem
(
self
):
if
not
USE_GUI
:
...
...
@@ -258,7 +263,7 @@ class beam(Detector1):
raise
pkex
.
BasePyKatException
(
'Beam detector code "{0}" is not a valid FINESSE command'
.
format
(
text
))
def
getFinesseText
(
self
)
:
rtn
=
[]
rtn
=
BaseDetector
.
getFinesseText
(
self
)
if
self
.
alternate_beam
:
alt
=
'*'
...
...
@@ -269,7 +274,7 @@ class beam(Detector1):
rtn
.
append
(
"beam {name} {node}{alt}"
.
format
(
name
=
self
.
name
,
node
=
self
.
node
.
name
,
alt
=
alt
))
else
:
rtn
.
append
(
"beam {name} {f} {node}{alt}"
.
format
(
name
=
self
.
name
,
f
=
str
(
self
.
f
.
value
),
node
=
self
.
node
.
name
,
alt
=
alt
))
for
p
in
self
.
_params
:
rtn
.
extend
(
p
.
getFinesseText
())
...
...
@@ -321,7 +326,7 @@ class cp(Detector0):
raise
pkex
.
BasePyKatException
(
'Cavity parameter detector code "{0}" is not a valid FINESSE command'
.
format
(
text
))
def
getFinesseText
(
self
)
:
rtn
=
[]
rtn
=
BaseDetector
.
getFinesseText
(
self
)
rtn
.
append
(
"cp {name} {cavity} {direction} {parameter}"
.
format
(
name
=
self
.
name
,
cavity
=
str
(
self
.
cavity
),
...
...
@@ -348,7 +353,7 @@ class xd(Detector0):
raise
pkex
.
BasePyKatException
(
'Motion detector code "{0}" is not a valid FINESSE command'
.
format
(
text
))
def
getFinesseText
(
self
)
:
rtn
=
[]
rtn
=
BaseDetector
.
getFinesseText
(
self
)
rtn
.
append
(
"xd {name} {component} {motion}"
.
format
(
name
=
self
.
name
,
component
=
self
.
component
,
...
...
@@ -394,7 +399,7 @@ class ad(Detector1):
raise
pkex
.
BasePyKatException
(
'Amplitude detector code "{0}" is not a valid FINESSE command'
.
format
(
text
))
def
getFinesseText
(
self
)
:
rtn
=
[]
rtn
=
BaseDetector
.
getFinesseText
(
self
)
if
self
.
alternate_beam
:
alt
=
'*'
...
...
@@ -448,7 +453,7 @@ class gouy(Detector1):
raise
pkex
.
BasePyKatException
(
'Gouy detector code "{0}" is not a valid FINESSE command'
.
format
(
text
))
def
getFinesseText
(
self
)
:
rtn
=
[]
rtn
=
BaseDetector
.
getFinesseText
(
self
)
rtn
.
append
(
"gouy {name} {dir} {spaces}"
.
format
(
name
=
self
.
name
,
dir
=
str
(
self
.
direction
),
spaces
=
" "
.
join
(
self
.
spaces
)))
...
...
@@ -500,7 +505,7 @@ class bp(Detector1):
raise
pkex
.
BasePyKatException
(
'Gouy detector code "{0}" is not a valid FINESSE command'
.
format
(
text
))
def
getFinesseText
(
self
)
:
rtn
=
[]
rtn
=
BaseDetector
.
getFinesseText
(
self
)
if
self
.
alternate_beam
:
alt
=
"*"
...
...
@@ -721,7 +726,7 @@ class pd(Detector1):
def
getFinesseText
(
self
)
:
rtn
=
[]
rtn
=
BaseDetector
.
getFinesseText
(
self
)
if
self
.
enabled
:
alt_str
=
""
...
...
@@ -833,7 +838,7 @@ class qnoised(pd):
return
qnoised
(
values
[
1
],
demods
,
node
,
senstype
=
sens
,
alternate_beam
=
alt_beam
,
**
dict
)
def
getFinesseText
(
self
)
:
rtn
=
[]
rtn
=
BaseDetector
.
getFinesseText
(
self
)
if
self
.
enabled
:
alt_str
=
""
...
...
@@ -931,7 +936,7 @@ class qshot(pd):
return
qshot
(
values
[
1
],
demods
,
node
,
senstype
=
sens
,
alternate_beam
=
alt_beam
,
**
dict
)
def
getFinesseText
(
self
)
:
rtn
=
[]
rtn
=
BaseDetector
.
getFinesseText
(
self
)
if
self
.
enabled
:
alt_str
=
""
...
...
@@ -993,7 +998,7 @@ class hd(Detector2):
return
hd
(
values
[
1
],
float
(
values
[
2
]),
str
(
values
[
3
]),
str
(
values
[
4
]))
def
getFinesseText
(
self
):
rtn
=
[]
rtn
=
BaseDetector
.
getFinesseText
(
self
)
if
self
.
enabled
:
n1
=
self
.
node1
.
name
...
...
@@ -1052,7 +1057,7 @@ class qhd(Detector2):
return
qhd
(
values
[
1
],
float
(
values
[
2
]),
str
(
values
[
3
]),
str
(
values
[
4
]),
sensitivity
=
sens
)
def
getFinesseText
(
self
):
rtn
=
[]
rtn
=
BaseDetector
.
getFinesseText
(
self
)
if
self
.
enabled
:
n1
=
self
.
node1
.
name
...
...
pykat/finesse.py
View file @
f05991ad
...
...
@@ -356,7 +356,8 @@ class katRun(object):
dual_plot
=
True
elif
"abs"
in
kat
.
yaxis
:
_func1
=
np
.
abs
# _func1 = np.abs
_func1
=
np
.
real
plot_cmd1
=
plot_cmd
elif
"db"
in
kat
.
yaxis
:
_func1
=
lambda
x
:
10
*
np
.
log10
(
x
)
...
...
@@ -378,6 +379,7 @@ class katRun(object):
for
det
in
detectors
:
if
not
hasattr
(
kat
,
det
)
or
(
hasattr
(
kat
,
det
)
and
not
getattr
(
kat
,
det
).
noplot
):
if
dual_plot
:
ax
=
pyplot
.
subplot
(
2
,
1
,
1
)
...
...
@@ -1151,7 +1153,13 @@ class kat(object):
self
.
add
(
obj
,
block
=
self
.
__currentTag
)
# Before processing the rest, all "noplot" commands are moved to the
# end of the list to make sure they are after all "func" commands.
for
k
in
range
(
len
(
after_process
)
-
1
,
-
1
,
-
1
):
if
after_process
[
k
][
0
].
split
(
" "
,
1
)[
0
]
==
"noplot"
:
after_process
.
append
(
after_process
.
pop
(
k
))
# now process all the varous gauss/attr etc. commands which require
# components to exist first before they can be processed
for
item
in
after_process
:
...
...
@@ -1173,6 +1181,7 @@ class kat(object):
elif
(
first
==
"variable"
):
self
.
add
(
pykat
.
commands
.
variable
.
parseFinesseText
(
line
,
self
),
block
=
block
)
elif
(
first
==
"noplot"
):
if
not
hasattr
(
self
,
rest
):
raise
pkex
.
BasePyKatException
(
"noplot command `{0}` refers to non-existing detector"
.
format
(
line
))
...
...
@@ -1936,6 +1945,7 @@ class kat(object):
writeBlock
()
out
.
append
(
"%%% FTend "
+
key
+
"
\n
"
)
# write the NO_BLOCK blocks
for
key
in
self
.
__blocks
:
objs
=
self
.
__blocks
[
key
].
contents
...
...
@@ -2011,7 +2021,7 @@ class kat(object):
if
self
.
lambda0
!=
1064e-9
:
out
.
append
(
"lambda {0}
\n
"
.
format
(
self
.
lambda0
))
# ensure we don't do any plotting. That should be handled
# by user themselves
#out.append("gnuterm no\n")
...
...
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