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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sean Leavey
pykat
Commits
741fe40e
Commit
741fe40e
authored
9 years ago
by
Andreas Freise
Browse files
Options
Downloads
Patches
Plain Diff
making lkat files python2/3 compatible'
parent
b310015f
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/lkat_optimisation.py
+9
-4
9 additions, 4 deletions
examples/lkat_optimisation.py
examples/lkat_trace.py
+7
-3
7 additions, 3 deletions
examples/lkat_trace.py
with
16 additions
and
7 deletions
examples/lkat_optimisation.py
+
9
−
4
View file @
741fe40e
...
@@ -10,6 +10,11 @@ https://code.google.com/p/ctypesgen/. The command I use to generate the wrapper
...
@@ -10,6 +10,11 @@ https://code.google.com/p/ctypesgen/. The command I use to generate the wrapper
You then also need to build libkat.so shared library from the python_shared branch of Finesse.
You then also need to build libkat.so shared library from the python_shared branch of Finesse.
Once the above is done the following script may or may not work...
Once the above is done the following script may or may not work...
"""
"""
from
__future__
import
absolute_import
from
__future__
import
division
from
__future__
import
print_function
from
__future__
import
unicode_literals
import
ctypes
import
ctypes
import
pylibkat
import
pylibkat
...
@@ -29,7 +34,7 @@ def callback(lkat, maxphi):
...
@@ -29,7 +34,7 @@ def callback(lkat, maxphi):
lkat - The handle to the finesse instance
lkat - The handle to the finesse instance
maxphi - a shared object between this and the main process, see multiprocessing.Value
maxphi - a shared object between this and the main process, see multiprocessing.Value
"""
"""
print
"
Entering callback...
"
print
(
"
Entering callback...
"
)
# first we need to get a handle on the internals of Finesse
# first we need to get a handle on the internals of Finesse
inter
=
pylibkat
.
interferometer
.
in_dll
(
lkat
,
"
inter
"
)
inter
=
pylibkat
.
interferometer
.
in_dll
(
lkat
,
"
inter
"
)
...
@@ -51,8 +56,8 @@ def callback(lkat, maxphi):
...
@@ -51,8 +56,8 @@ def callback(lkat, maxphi):
maxphi
.
value
=
m1
.
phi
maxphi
.
value
=
m1
.
phi
print
"
Process: Maximum power =
"
,
circ
.
re
print
(
"
Process: Maximum power =
"
,
circ
.
re
)
print
"
Process: Mirror tuning =
"
,
m1
.
phi
print
(
"
Process: Mirror tuning =
"
,
m1
.
phi
)
cmd
=
"""
cmd
=
"""
l l1 1 0 n1
l l1 1 0 n1
...
@@ -80,4 +85,4 @@ p = kat.getProcess(callback, maxphi=maxphi)
...
@@ -80,4 +85,4 @@ p = kat.getProcess(callback, maxphi=maxphi)
p
.
start
()
p
.
start
()
p
.
join
()
p
.
join
()
print
"
Host: Received maximum phi =
"
,
maxphi
.
value
print
(
"
Host: Received maximum phi =
"
,
maxphi
.
value
)
This diff is collapsed.
Click to expand it.
examples/lkat_trace.py
+
7
−
3
View file @
741fe40e
from
__future__
import
absolute_import
from
__future__
import
division
from
__future__
import
print_function
from
__future__
import
unicode_literals
import
pykat
import
pykat
import
pylab
import
pylab
import
numpy
import
numpy
...
@@ -28,9 +32,9 @@ kat.parseCommands(cmd)
...
@@ -28,9 +32,9 @@ kat.parseCommands(cmd)
info
=
kat
.
lkat_trace
()
info
=
kat
.
lkat_trace
()
print
"
n1 qx =
"
,
info
[
"
n1
"
].
qx
print
(
"
n1 qx =
"
,
info
[
"
n1
"
].
qx
)
print
"
Cavity info
"
,
info
[
"
c1
"
]
print
(
"
Cavity info
"
,
info
[
"
c1
"
]
)
import
numpy
import
numpy
...
@@ -66,7 +70,7 @@ try:
...
@@ -66,7 +70,7 @@ try:
g_factors
.
append
(
cav
.
stability_x
)
g_factors
.
append
(
cav
.
stability_x
)
except
Exception
as
ex
:
except
Exception
as
ex
:
print
"
Exception caught in python:
"
,
ex
.
message
print
(
"
Exception caught in python:
"
,
ex
.
message
)
finally
:
finally
:
# This should always be called no matter what
# This should always be called no matter what
lkat
.
_pykat_finish
(
0
)
lkat
.
_pykat_finish
(
0
)
...
...
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