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
Sebastian Steinlechner
pykat
Commits
bcb877ba
Commit
bcb877ba
authored
10 years ago
by
Andreas Freise
Browse files
Options
Downloads
Patches
Plain Diff
fixed bug, some debugging stuff added
parent
41c70111
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/aligo/FFT_ArmCavity_precompute.py
+24
-13
24 additions, 13 deletions
examples/aligo/FFT_ArmCavity_precompute.py
with
24 additions
and
13 deletions
examples/aligo/FFT_ArmCavity_precompute.py
+
24
−
13
View file @
bcb877ba
...
@@ -16,6 +16,7 @@ from pykat.external.progressbar import ProgressBar, ETA, Percentage, Bar
...
@@ -16,6 +16,7 @@ from pykat.external.progressbar import ProgressBar, ETA, Percentage, Bar
from
pykat.optics.maps
import
*
from
pykat.optics.maps
import
*
from
pykat.optics.gaussian_beams
import
HG_beam
,
beam_param
from
pykat.optics.gaussian_beams
import
HG_beam
,
beam_param
from
pykat.optics.fft
import
*
from
pykat.optics.fft
import
*
from
pykat.utilities.plotting.tools
import
plot_field
,
plot_propagation
from
aligo
import
*
from
aligo
import
*
...
@@ -64,7 +65,7 @@ def main():
...
@@ -64,7 +65,7 @@ def main():
# setup grid for FFT propagation
# setup grid for FFT propagation
[
xpoints
,
ypoints
]
=
surface
.
size
[
xpoints
,
ypoints
]
=
surface
.
size
xsize
=
xpoints
*
surface
.
step_size
[
0
]
xsize
=
xpoints
*
surface
.
step_size
[
0
]
ysize
=
0.05
*
surface
.
step_size
[
0
]
ysize
=
ypoints
*
surface
.
step_size
[
0
]
xoffset
=
0.0
xoffset
=
0.0
yoffset
=
0.0
yoffset
=
0.0
...
@@ -74,24 +75,38 @@ def main():
...
@@ -74,24 +75,38 @@ def main():
y
=
shape
.
yaxis
y
=
shape
.
yaxis
result
[
'
shape
'
]
=
shape
result
[
'
shape
'
]
=
shape
global
gx
,
gy
,
beam
,
laser
# generate roughly mode-matched input beam
# generate roughly mode-matched input beam
gx
=
beam_param
(
w0
=
0.012
,
z
=-
1834.0
)
gx
=
beam_param
(
w0
=
0.012
,
z
=-
1834.0
)
gy
=
gx
gy
=
gx
beam
=
HG_beam
(
gx
,
gy
,
0
,
0
)
beam
=
HG_beam
(
gx
,
gy
,
0
,
0
)
laser
=
beam
.
Unm
(
x
,
y
)
laser
=
beam
.
Unm
(
x
,
y
)
# some debugging plots
#plot_field(laser)
#Lrange= np.linspace(0,4000,200)
#plot_propagation(laser, shape, Lambda, 0, 1, Lrange, 1)
precompute_roundtrips
(
shape
,
laser
)
# now save any `result' variables:
tmpfile
=
shelve
.
open
(
tmpresultfile
)
tmpfile
[
'
result
'
]
=
result
tmpfile
.
close
()
def
precompute_roundtrips
(
shape
,
laser
):
R
=
aligo
.
etmX_R
*
aligo
.
itmX_R
R
=
aligo
.
etmX_R
*
aligo
.
itmX_R
Loss
=
1
-
R
Loss
=
1
-
R
accuracy
=
100E-6
accuracy
=
100E-6
print
(
"
cavity loss: {0}
"
.
format
(
Loss
))
print
(
"
cavity loss: {0}
"
.
format
(
Loss
))
N
=
int
(
required_roundtrips
(
Loss
,
accuracy
))
N
=
int
(
required_roundtrips
(
Loss
,
accuracy
))
print
(
"
required rountrips: {0} (for accuracy of {1})
"
.
format
(
N
,
accuracy
))
print
(
"
required rountrips: {0} (for accuracy of {1})
"
.
format
(
N
,
accuracy
))
print
(
"
Estimated memory requirement: {0:.2f} MBytes
"
.
format
(
2
*
8
*
xpoints
*
ypoints
*
N
/
1024.0
/
1024.0
))
print
(
"
Estimated memory requirement: {0:.2f} MBytes
"
.
format
(
2
*
8
*
shape
.
xpoints
*
shape
.
ypoints
*
N
/
1024.0
/
1024.0
))
global
f_round
global
f_round
f_circ
=
np
.
zeros
((
xpoints
,
ypoints
),
dtype
=
np
.
complex128
)
f_circ
=
np
.
zeros
((
shape
.
xpoints
,
shape
.
ypoints
),
dtype
=
np
.
complex128
)
f_round
=
np
.
zeros
((
xpoints
,
ypoints
,
N
),
dtype
=
np
.
complex128
)
f_round
=
np
.
zeros
((
shape
.
xpoints
,
shape
.
ypoints
,
N
),
dtype
=
np
.
complex128
)
# move impinging field into cavity
# move impinging field into cavity
f_circ
=
np
.
sqrt
(
aligo
.
itmX_T
)
*
laser
f_circ
=
np
.
sqrt
(
aligo
.
itmX_T
)
*
laser
...
@@ -103,10 +118,10 @@ def main():
...
@@ -103,10 +118,10 @@ def main():
p
=
ProgressBar
(
maxval
=
N
,
widgets
=
[
"
computing f_circ:
"
,
Percentage
(),
"
|
"
,
ETA
(),
Bar
()])
p
=
ProgressBar
(
maxval
=
N
,
widgets
=
[
"
computing f_circ:
"
,
Percentage
(),
"
|
"
,
ETA
(),
Bar
()])
for
n
in
range
(
2
,
N
):
for
n
in
range
(
2
,
N
):
f_circ
=
FFT_propagate
(
f_circ
,
shape
,
Lambda
,
aligo
.
LX
,
1
)
f_circ
=
FFT_propagate
(
f_circ
,
shape
,
aligo
.
Lambda
,
aligo
.
LX
,
1
)
f_circ
=
aligo
.
etmX_r
*
FFT_apply_map
(
f_circ
,
etm
,
Lambda
)
f_circ
=
aligo
.
etmX_r
*
FFT_apply_map
(
f_circ
,
etm
,
aligo
.
Lambda
)
f_circ
=
FFT_propagate
(
f_circ
,
shape
,
Lambda
,
aligo
.
LX
,
1
)
f_circ
=
FFT_propagate
(
f_circ
,
shape
,
aligo
.
Lambda
,
aligo
.
LX
,
1
)
f_circ
=
aligo
.
itmX_r
*
FFT_apply_map
(
f_circ
,
itm
,
Lambda
)
f_circ
=
aligo
.
itmX_r
*
FFT_apply_map
(
f_circ
,
itm
,
aligo
.
Lambda
)
f_round
[:,:,
n
]
=
f_circ
;
f_round
[:,:,
n
]
=
f_circ
;
p
.
update
(
n
)
p
.
update
(
n
)
...
@@ -115,10 +130,6 @@ def main():
...
@@ -115,10 +130,6 @@ def main():
timestr
=
time
.
strftime
(
"
%Y:%m:%d-%H:%M:%S
"
)
timestr
=
time
.
strftime
(
"
%Y:%m:%d-%H:%M:%S
"
)
np
.
save
(
'
fround-
'
+
timestr
,
f_round
)
np
.
save
(
'
fround-
'
+
timestr
,
f_round
)
# now the result variables:
tmpfile
=
shelve
.
open
(
tmpresultfile
)
tmpfile
[
'
result
'
]
=
result
tmpfile
.
close
()
def
FFT_apply_map
(
field
,
Map
,
Lambda
):
def
FFT_apply_map
(
field
,
Map
,
Lambda
):
...
...
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