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
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
finesse
pykat
Commits
4681357e
Commit
4681357e
authored
10 years ago
by
Daniel Brown
Browse files
Options
Downloads
Patches
Plain Diff
changing ROMHOM output file
parent
426c99be
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pykat/optics/maps.py
+12
-10
12 additions, 10 deletions
pykat/optics/maps.py
pykat/optics/romhom.py
+25
-14
25 additions, 14 deletions
pykat/optics/romhom.py
with
37 additions
and
24 deletions
pykat/optics/maps.py
+
12
−
10
View file @
4681357e
...
...
@@ -143,28 +143,30 @@ class surfacemap(object):
raise
BasePyKatException
(
"
Map type needs handling
"
)
def
generateROMWeights
(
self
,
isModeMatched
=
True
,
verbose
=
False
,
interpolate
=
False
,
tolerance
=
1e-12
,
sigma
=
1
,
sort
=
False
,
greedyfile
=
None
):
def
generateROMWeights
(
self
,
isModeMatched
=
True
,
verbose
=
False
,
interpolate
=
False
,
interpolate_N
=
None
,
tolerance
=
1e-12
,
sigma
=
1
,
sort
=
False
,
greedyfile
=
None
):
if
interpolate
:
from
scipy.interpolate
import
interp2d
import
numpy
as
np
D
=
interp2d
(
self
.
x
,
self
.
y
,
self
.
data
,
fill_value
=
0
)
if
interpolate_N
is
None
:
interpolate_N
=
(
self
.
size
[
0
],
self
.
size
[
1
])
# only want even number of data points spread equally
# about the axes
if
self
.
size
[
0
]
%
2
==
0
:
Nx
=
self
.
size
[
0
]
if
interpolate_N
[
0
]
%
2
==
0
:
Nx
=
interpolate_N
[
0
]
else
:
Nx
=
self
.
size
[
0
]
-
1
Nx
=
interpolate_N
[
0
]
-
1
if
self
.
size
[
1
]
%
2
==
0
:
Ny
=
self
.
size
[
1
]
if
interpolate_N
[
1
]
%
2
==
0
:
Ny
=
interpolate_N
[
1
]
else
:
Ny
=
self
.
size
[
1
]
-
1
Ny
=
interpolate_N
[
1
]
-
1
nx
=
np
.
linspace
(
min
(
self
.
x
),
max
(
self
.
x
),
Nx
)
ny
=
np
.
linspace
(
min
(
self
.
y
),
max
(
self
.
y
),
Ny
)
nx
=
np
.
linspace
(
min
(
self
.
x
),
max
(
self
.
x
),
interpolate_N
[
0
]
)
ny
=
np
.
linspace
(
min
(
self
.
y
),
max
(
self
.
y
),
interpolate_N
[
1
]
)
data
=
D
(
nx
-
self
.
offset
[
0
],
ny
-
self
.
offset
[
0
])
...
...
This diff is collapsed.
Click to expand it.
pykat/optics/romhom.py
+
25
−
14
View file @
4681357e
...
...
@@ -28,37 +28,48 @@ class ROMWeights:
self
.
limits
=
limits
def
writeToFile
(
self
,
filename
):
f
=
open
(
filename
,
'
w+
'
)
"""
Writes this map
'
s ROM weights to a file
that can be used with Finesse. The filename
is appended with
'
.rom
'
internally.
"""
f
=
open
(
filename
+
"
.rom
"
,
'
w+
'
)
f
.
write
(
"
zmin=%16.16e
\n
"
%
self
.
limits
.
zmin
)
f
.
write
(
"
zmax=%16.16e
\n
"
%
self
.
limits
.
zmax
)
f
.
write
(
"
w0min=%16.16e
\n
"
%
self
.
limits
.
w0min
)
f
.
write
(
"
w0max=%16.16e
\n
"
%
self
.
limits
.
w0max
)
f
.
write
(
"
maxorder=%i
\n
"
%
self
.
limits
.
max_order
)
f
.
write
(
"
xnodes=%i
\n
"
%
len
(
self
.
EI
[
"
xm
"
].
nodes
))
for
v
in
self
.
EI
[
"
xm
"
].
nodes
.
flatten
():
f
.
write
(
"
%s
\n
"
%
repr
(
float
(
v
)))
f
.
write
(
repr
(
self
.
limits
)
+
"
\n
"
)
f
.
write
(
"
ynodes=%i
\n
"
%
len
(
self
.
EI
[
"
ym
"
].
nodes
))
for
v
in
self
.
EI
[
"
ym
"
].
nodes
.
flatten
():
f
.
write
(
"
%s
\n
"
%
repr
(
float
(
v
)))
f
.
write
(
repr
(
self
.
w_ij_Q1
.
shape
)
+
"
\n
"
)
for
v
in
self
.
w_ij_Q1
.
flatten
():
f
.
write
(
"
%s
"
%
repr
(
complex
(
v
))[
1
:
-
1
])
f
.
write
(
"
\n
"
)
f
.
write
(
"
%s
\n
"
%
repr
(
complex
(
v
))[
1
:
-
1
])
f
.
write
(
repr
(
self
.
w_ij_Q2
.
shape
)
+
"
\n
"
)
for
v
in
self
.
w_ij_Q2
.
flatten
():
f
.
write
(
"
%s
"
%
repr
(
complex
(
v
))[
1
:
-
1
])
f
.
write
(
"
\n
"
)
f
.
write
(
"
%s
\n
"
%
repr
(
complex
(
v
))[
1
:
-
1
])
f
.
write
(
repr
(
self
.
w_ij_Q3
.
shape
)
+
"
\n
"
)
for
v
in
self
.
w_ij_Q3
.
flatten
():
f
.
write
(
"
%s
"
%
repr
(
complex
(
v
))[
1
:
-
1
])
f
.
write
(
"
\n
"
)
f
.
write
(
"
%s
\n
"
%
repr
(
complex
(
v
))[
1
:
-
1
])
f
.
write
(
repr
(
self
.
w_ij_Q4
.
shape
)
+
"
\n
"
)
for
v
in
self
.
w_ij_Q4
.
flatten
():
f
.
write
(
"
%s
"
%
repr
(
complex
(
v
))[
1
:
-
1
])
f
.
write
(
"
\n
"
)
f
.
write
(
"
%s
\n
"
%
repr
(
complex
(
v
))[
1
:
-
1
])
f
.
close
()
...
...
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