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
489129df
Commit
489129df
authored
9 years ago
by
Daniel Brown
Browse files
Options
Downloads
Patches
Plain Diff
fixing fsig parsing of 'fsig signal frequency'. Adding code to allow surface motions.
parent
449bf621
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
pykat/components.py
+5
-0
5 additions, 0 deletions
pykat/components.py
pykat/finesse.py
+68
-53
68 additions, 53 deletions
pykat/finesse.py
pykat/optics/maps.py
+19
-10
19 additions, 10 deletions
pykat/optics/maps.py
pykat/optics/romhom.py
+2
-1
2 additions, 1 deletion
pykat/optics/romhom.py
with
94 additions
and
64 deletions
pykat/components.py
+
5
−
0
View file @
489129df
...
...
@@ -321,6 +321,11 @@ class AbstractMirrorComponent(Component):
self
.
__Frx
=
Param
(
"
Frx
"
,
self
,
None
,
canFsig
=
True
,
isPutable
=
False
,
isPutter
=
False
,
isTunable
=
False
,
fsig_name
=
"
Frx
"
)
self
.
__Fry
=
Param
(
"
Fry
"
,
self
,
None
,
canFsig
=
True
,
isPutable
=
False
,
isPutter
=
False
,
isTunable
=
False
,
fsig_name
=
"
Fry
"
)
self
.
__Fs0
=
Param
(
"
Fs0
"
,
self
,
None
,
canFsig
=
True
,
isPutable
=
False
,
isPutter
=
False
,
isTunable
=
False
,
fsig_name
=
"
Fs0
"
)
self
.
__Fs1
=
Param
(
"
Fs1
"
,
self
,
None
,
canFsig
=
True
,
isPutable
=
False
,
isPutter
=
False
,
isTunable
=
False
,
fsig_name
=
"
Fs1
"
)
self
.
__Fs0
=
Param
(
"
s0
"
,
self
,
None
,
canFsig
=
True
,
isPutable
=
False
,
isPutter
=
False
,
isTunable
=
False
,
fsig_name
=
"
s0
"
)
self
.
__Fs1
=
Param
(
"
s1
"
,
self
,
None
,
canFsig
=
True
,
isPutable
=
False
,
isPutter
=
False
,
isTunable
=
False
,
fsig_name
=
"
s1
"
)
self
.
_default_fsig_param
=
self
.
__phi
@property
...
...
This diff is collapsed.
Click to expand it.
pykat/finesse.py
+
68
−
53
View file @
489129df
...
...
@@ -382,6 +382,7 @@ class Signals(object):
return
rtn
@property
def
name
(
self
):
# if we don't have any signals yet then use a dummy name
...
...
@@ -389,7 +390,7 @@ class Signals(object):
# so need to get the name of at least one of them
# as if you tune one you tune them all
if
len
(
self
.
targets
)
==
0
:
return
"
fsignal
"
return
self
.
_default_name
else
:
return
self
.
targets
[
0
].
name
...
...
@@ -408,6 +409,7 @@ class Signals(object):
def
f
(
self
,
value
):
self
.
__f
.
value
=
SIfloat
(
value
)
def
__init__
(
self
,
kat
):
self
.
_default_name
=
"
fsignal
"
self
.
targets
=
[]
self
.
_params
=
[]
self
.
__f
=
Param
(
"
f
"
,
self
,
1
)
...
...
@@ -429,6 +431,11 @@ class Signals(object):
def
getFinesseText
(
self
):
rtn
=
[]
if
len
(
self
.
targets
)
==
0
and
self
.
f
!=
0
:
rtn
.
append
(
"
fsig {name} {frequency}
"
.
format
(
name
=
self
.
name
,
frequency
=
str
(
self
.
f
)))
else
:
for
t
in
self
.
targets
:
rtn
.
extend
(
t
.
getFinesseText
())
...
...
@@ -1003,6 +1010,10 @@ class kat(object):
name
=
str
(
v
[
1
])
if
len
(
v
)
==
3
:
self
.
signals
.
_default_name
=
name
self
.
signals
.
f
=
SIfloat
(
v
[
2
])
else
:
if
v
[
2
]
not
in
self
.
__components
:
raise
pkex
.
BasePyKatException
(
"
Could not find the component
'
{0}
'
. Line:
'
{1}
'"
.
format
(
v
[
2
],
line
))
...
...
@@ -1014,7 +1025,10 @@ class kat(object):
param_name
=
None
amp
=
None
if
len
(
v
)
==
5
:
if
len
(
v
)
==
3
:
self
.
signals
.
_default_name
=
name
freq
=
SIfloat
(
v
[
3
])
elif
len
(
v
)
==
5
:
#param is None
freq
=
SIfloat
(
v
[
3
])
phase
=
SIfloat
(
v
[
4
])
...
...
@@ -1044,6 +1058,7 @@ class kat(object):
raise
pkex
.
BasePyKatException
(
"'
{0}
'
isnot a valid fsig command
"
.
format
(
line
))
self
.
signals
.
f
=
freq
param
=
None
if
param_name
is
None
:
...
...
This diff is collapsed.
Click to expand it.
pykat/optics/maps.py
+
19
−
10
View file @
489129df
...
...
@@ -16,6 +16,7 @@ from __future__ import print_function
from
pykat.optics.romhom
import
makeWeightsNew
from
scipy.interpolate
import
interp2d
,
interp1d
from
pykat.maths.zernike
import
*
from
pykat.exceptions
import
BasePyKatException
import
numpy
as
np
import
math
...
...
@@ -108,11 +109,11 @@ class surfacemap(object):
@property
def
x
(
self
):
return
self
.
step_size
[
0
]
*
(
np
.
array
(
range
(
1
,
self
.
data
.
shape
[
0
]
+
1
))
-
self
.
center
[
0
])
return
self
.
step_size
[
0
]
*
(
np
.
array
(
range
(
0
,
self
.
data
.
shape
[
0
]))
-
self
.
center
[
0
])
@property
def
y
(
self
):
return
self
.
step_size
[
1
]
*
(
np
.
array
(
range
(
1
,
self
.
data
.
shape
[
1
]
+
1
))
-
self
.
center
[
1
])
return
self
.
step_size
[
1
]
*
(
np
.
array
(
range
(
0
,
self
.
data
.
shape
[
1
]))
-
self
.
center
[
1
])
@property
def
size
(
self
):
...
...
@@ -120,7 +121,7 @@ class surfacemap(object):
@property
def
offset
(
self
):
return
np
.
array
(
self
.
step_size
)
*
(
np
.
array
(
self
.
center
)
-
1
/
2.
-
np
.
array
(
self
.
size
)
/
2.0
)
return
np
.
array
(
self
.
step_size
)
*
(
np
.
array
(
self
.
center
)
-
(
np
.
array
(
self
.
size
)
-
1
)
/
2.0
)
@property
def
ROMWeights
(
self
):
...
...
@@ -176,6 +177,11 @@ class surfacemap(object):
return
np
.
sqrt
(
1.0
-
data
)
else
:
return
np
.
sqrt
(
1.0
-
data
[:,
::
-
1
])
elif
"
surface_motion
"
in
self
.
type
:
if
direction
==
"
reflection_front
"
:
return
data
else
:
return
data
[:,
::
-
1
]
else
:
raise
BasePyKatException
(
"
Map type needs handling
"
)
...
...
@@ -193,6 +199,9 @@ class surfacemap(object):
return
np
.
sqrt
(
1.0
-
data
)
else
:
return
np
.
sqrt
(
1.0
-
data
[:,
::
-
1
])
elif
"
surface_motion
"
in
self
.
type
:
return
np
.
ones
(
data
.
shape
)
else
:
raise
BasePyKatException
(
"
Map type needs handling
"
)
...
...
@@ -274,10 +283,10 @@ class surfacemap(object):
D
=
interp2d
(
self
.
x
,
self
.
y
,
self
.
data
,
**
kwargs
)
data
=
D
(
nx
-
self
.
offset
[
0
],
ny
-
self
.
offset
[
0
])
data
=
D
(
nx
-
self
.
offset
[
0
],
ny
-
self
.
offset
[
1
])
Dx
=
interp1d
(
nx
,
np
.
arange
(
1
,
len
(
nx
)
+
1
))
Dy
=
interp1d
(
ny
,
np
.
arange
(
1
,
len
(
ny
)
+
1
))
Dx
=
interp1d
(
nx
,
np
.
arange
(
0
,
len
(
nx
)))
Dy
=
interp1d
(
ny
,
np
.
arange
(
0
,
len
(
ny
)))
self
.
center
=
(
Dx
(
0
),
Dy
(
0
))
self
.
step_size
=
(
nx
[
1
]
-
nx
[
0
],
ny
[
1
]
-
ny
[
0
])
...
...
@@ -313,7 +322,7 @@ class surfacemap(object):
yrange
=
100
*
self
.
y
fig
=
pylab
.
figure
()
axes
=
pylab
.
pcolormesh
(
xrange
,
yrange
,
self
.
data
,
vmin
=
zmin
,
vmax
=
zmax
)
axes
=
pylab
.
pcolormesh
(
xrange
,
yrange
,
self
.
data
*
self
.
scaling
,
vmin
=
zmin
,
vmax
=
zmax
)
pylab
.
xlabel
(
'
x [cm]
'
)
pylab
.
ylabel
(
'
y [cm]
'
)
...
...
@@ -406,11 +415,11 @@ class mergedmap:
@property
def
x
(
self
):
return
self
.
step_size
[
0
]
*
(
np
.
array
(
range
(
1
,
self
.
size
[
0
]
+
1
))
-
self
.
center
[
0
])
return
self
.
step_size
[
0
]
*
(
np
.
array
(
range
(
0
,
self
.
size
[
0
]))
-
self
.
center
[
0
])
@property
def
y
(
self
):
return
self
.
step_size
[
1
]
*
(
np
.
array
(
range
(
1
,
self
.
size
[
1
]
+
1
))
-
self
.
center
[
1
])
return
self
.
step_size
[
1
]
*
(
np
.
array
(
range
(
0
,
self
.
size
[
1
]))
-
self
.
center
[
1
])
@property
def
size
(
self
):
...
...
@@ -418,7 +427,7 @@ class mergedmap:
@property
def
offset
(
self
):
return
np
.
array
(
self
.
step_size
)
*
(
np
.
array
(
self
.
center
)
-
1
/
2.
-
np
.
array
(
self
.
size
)
/
2.0
)
return
np
.
array
(
self
.
step_size
)
*
(
np
.
array
(
self
.
center
)
-
(
np
.
array
(
self
.
size
)
-
1
)
/
2.0
)
@property
def
ROMWeights
(
self
):
...
...
This diff is collapsed.
Click to expand it.
pykat/optics/romhom.py
+
2
−
1
View file @
489129df
...
...
@@ -481,6 +481,7 @@ def MakeROMFromHDF5(hdf5Filename, greedyFilename=None, EIFilename=None, tol=1e-1
V
[
m
][
l
]
=
RB_matrix
[
l
][
EI_indices
[
m
]]
# Part of (5) of Algorithm 2: making V_{ij}
invV
=
inv
(
V
[
0
:
len
(
EI_indices
),
0
:
len
(
EI_indices
)])
B
=
B_matrix
(
invV
,
np
.
array
(
RB_matrix
))
_TS
=
TS
[
str
(
next_RB_index
)]
...
...
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