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
Snippets
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sean Leavey
pykat
Commits
9d3bff31
Commit
9d3bff31
authored
9 years ago
by
Daniel Brown
Browse files
Options
Downloads
Patches
Plain Diff
adding min/max to out.info(), adding in cp detector. Updating version
parent
29228037
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
pykat/__init__.py
+1
-1
1 addition, 1 deletion
pykat/__init__.py
pykat/detectors.py
+55
-0
55 additions, 0 deletions
pykat/detectors.py
pykat/finesse.py
+17
-1
17 additions, 1 deletion
pykat/finesse.py
with
73 additions
and
2 deletions
pykat/__init__.py
+
1
−
1
View file @
9d3bff31
...
@@ -3,7 +3,7 @@ from __future__ import division
...
@@ -3,7 +3,7 @@ from __future__ import division
from
__future__
import
print_function
from
__future__
import
print_function
from
__future__
import
unicode_literals
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
# This flag is used to switch on the gui features in pkat at import time
USE_GUI
=
False
USE_GUI
=
False
...
...
This diff is collapsed.
Click to expand it.
pykat/detectors.py
+
55
−
0
View file @
9d3bff31
...
@@ -275,6 +275,61 @@ class beam(Detector1):
...
@@ -275,6 +275,61 @@ class beam(Detector1):
return
rtn
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
):
class
xd
(
Detector0
):
def
__init__
(
self
,
name
,
component
,
motion
):
def
__init__
(
self
,
name
,
component
,
motion
):
...
...
This diff is collapsed.
Click to expand it.
pykat/finesse.py
+
17
−
1
View file @
9d3bff31
...
@@ -249,15 +249,29 @@ class katRun(object):
...
@@ -249,15 +249,29 @@ class katRun(object):
detectors
=
list
(
set
([
lbl
.
split
()[
0
]
for
lbl
in
self
.
ylabels
]))
detectors
=
list
(
set
([
lbl
.
split
()[
0
]
for
lbl
in
self
.
ylabels
]))
detectors
.
sort
()
detectors
.
sort
()
print
(
""
)
print
(
"
--- Output info ---
"
)
print
(
"
--- Output info ---
"
)
print
(
""
)
print
(
"
Run date and time: %s
"
%
self
.
StartDateTime
)
print
(
"
Run date and time: %s
"
%
self
.
StartDateTime
)
print
(
"
Detectors used: %s
"
%
(
"
,
"
.
join
(
detectors
)))
print
(
"
Detectors used: %s
"
%
(
"
,
"
.
join
(
detectors
)))
print
(
""
)
if
kat
.
noxaxis
:
if
kat
.
noxaxis
:
print
(
"
No xaxis used
"
)
print
(
"
No xaxis used
"
)
else
:
else
:
print
(
"
One xaxis used: %s
"
%
kat
.
xaxis
.
getFinesseText
())
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
,
def
plot
(
self
,
detectors
=
None
,
filename
=
None
,
show
=
True
,
yaxis
=
None
,
legend
=
True
,
loc
=
0
,
title
=
None
,
styles
=
None
,
yaxis
=
None
,
legend
=
True
,
loc
=
0
,
title
=
None
,
styles
=
None
,
...
@@ -1025,6 +1039,8 @@ class kat(object):
...
@@ -1025,6 +1039,8 @@ class kat(object):
obj
=
pykat
.
detectors
.
xd
.
parseFinesseText
(
line
)
obj
=
pykat
.
detectors
.
xd
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
2
]
==
"
tf
"
):
elif
(
first
[
0
:
2
]
==
"
tf
"
):
obj
=
pykat
.
commands
.
tf
.
parseFinesseText
(
line
)
obj
=
pykat
.
commands
.
tf
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
2
]
==
"
cp
"
):
obj
=
pykat
.
detectors
.
cp
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
2
]
==
"
bp
"
):
elif
(
first
[
0
:
2
]
==
"
bp
"
):
obj
=
pykat
.
detectors
.
bp
.
parseFinesseText
(
line
)
obj
=
pykat
.
detectors
.
bp
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
4
]
==
"
gouy
"
):
elif
(
first
[
0
:
4
]
==
"
gouy
"
):
...
...
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