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
9d3bff31
Commit
9d3bff31
authored
Mar 16, 2016
by
Daniel Brown
Browse files
adding min/max to out.info(), adding in cp detector. Updating version
parent
29228037
Changes
3
Hide whitespace changes
Inline
Side-by-side
pykat/__init__.py
View file @
9d3bff31
...
...
@@ -3,7 +3,7 @@ from __future__ import division
from
__future__
import
print_function
from
__future__
import
unicode_literals
__version__
=
"0.8.
8
"
__version__
=
"0.8.
9
"
# This flag is used to switch on the gui features in pkat at import time
USE_GUI
=
False
...
...
pykat/detectors.py
View file @
9d3bff31
...
...
@@ -275,6 +275,61 @@ class beam(Detector1):
return
rtn
class
cp
(
Detector0
):
def
__init__
(
self
,
name
,
cavity
,
direction
,
parameter
):
BaseDetector
.
__init__
(
self
,
name
,
None
)
self
.
cavity
=
str
(
cavity
)
self
.
direction
=
direction
self
.
parameter
=
parameter
@
property
def
direction
(
self
):
return
self
.
__direction
@
direction
.
setter
def
direction
(
self
,
value
):
if
value
.
lower
()
not
in
[
"x"
,
"y"
]:
raise
pkex
.
BasePyKatException
(
'Cavity parameter detector direction must be x or y.'
)
self
.
__direction
=
value
@
property
def
parameter
(
self
):
return
self
.
__param
@
parameter
.
setter
def
parameter
(
self
,
value
):
params
=
[
"w0"
,
"w"
,
"zr"
,
"z"
,
"r"
,
"q"
,
"finesse"
,
"m"
,
"stability"
,
"loss"
,
"length"
,
"fsr"
,
"fwhm"
,
"pole"
,
"gouy"
,
"fsep"
,
"A"
,
"B"
,
"C"
,
"D"
]
if
value
not
in
params
:
raise
pkex
.
BasePyKatException
(
'Cavity parameter detector direction must be one of: '
+
", "
.
join
(
params
))
self
.
__param
=
value
@
staticmethod
def
parseFinesseText
(
text
):
values
=
text
.
split
()
if
len
(
values
)
==
4
:
# For FINESSE version < 2.1
# Old format the name of the detector is a combination of the arguments
return
cp
(
values
[
1
]
+
"_"
+
values
[
2
]
+
"_"
+
values
[
3
],
values
[
1
],
values
[
2
],
values
[
3
])
elif
len
(
values
)
==
5
:
return
cp
(
values
[
1
],
values
[
2
],
values
[
3
],
values
[
4
])
else
:
raise
pkex
.
BasePyKatException
(
'Cavity parameter detector code "{0}" is not a valid FINESSE command'
.
format
(
text
))
def
getFinesseText
(
self
)
:
rtn
=
[]
rtn
.
append
(
"cp {name} {cavity} {direction} {parameter}"
.
format
(
name
=
self
.
name
,
cavity
=
str
(
self
.
cavity
),
direction
=
self
.
direction
,
parameter
=
self
.
parameter
))
return
rtn
class
xd
(
Detector0
):
def
__init__
(
self
,
name
,
component
,
motion
):
...
...
pykat/finesse.py
View file @
9d3bff31
...
...
@@ -249,14 +249,28 @@ class katRun(object):
detectors
=
list
(
set
([
lbl
.
split
()[
0
]
for
lbl
in
self
.
ylabels
]))
detectors
.
sort
()
print
(
""
)
print
(
"--- Output info ---"
)
print
(
""
)
print
(
"Run date and time: %s"
%
self
.
StartDateTime
)
print
(
"Detectors used: %s"
%
(
", "
.
join
(
detectors
)))
print
(
""
)
if
kat
.
noxaxis
:
print
(
"No xaxis used"
)
else
:
print
(
"One xaxis used: %s"
%
kat
.
xaxis
.
getFinesseText
())
import
numpy
as
np
maxs
=
np
.
max
(
self
.
y
,
0
)
mins
=
np
.
min
(
self
.
y
,
0
)
maxlbl
=
max
([
len
(
lbl
)
for
lbl
in
self
.
ylabels
])
for
i
,
lbl
in
enumerate
(
self
.
ylabels
):
a
=
"{0:"
+
str
(
maxlbl
)
+
"} : min = {1:.15e} max = {2:.15e}"
print
(
a
.
format
(
lbl
,
mins
[
i
],
maxs
[
i
]))
def
plot
(
self
,
detectors
=
None
,
filename
=
None
,
show
=
True
,
...
...
@@ -1025,6 +1039,8 @@ class kat(object):
obj
=
pykat
.
detectors
.
xd
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
2
]
==
"tf"
):
obj
=
pykat
.
commands
.
tf
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
2
]
==
"cp"
):
obj
=
pykat
.
detectors
.
cp
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
2
]
==
"bp"
):
obj
=
pykat
.
detectors
.
bp
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
4
]
==
"gouy"
):
...
...
Write
Preview
Markdown
is supported
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