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
121fe5fc
Commit
121fe5fc
authored
9 years ago
by
Daniel Brown
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of gitmaster.atlas.aei.uni-hannover.de:pykat/pykat
parents
9212e608
06194b20
No related branches found
No related tags found
No related merge requests found
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pykat/maths/zernike.py
+73
-0
73 additions, 0 deletions
pykat/maths/zernike.py
pykat/optics/maps.py
+807
-294
807 additions, 294 deletions
pykat/optics/maps.py
with
880 additions
and
294 deletions
pykat/maths/zernike.py
+
73
−
0
View file @
121fe5fc
import
numpy
as
np
import
numpy
as
np
from
scipy.misc
import
factorial
as
fac
from
scipy.misc
import
factorial
as
fac
import
math
def
zernike_R
(
m
,
n
,
rho
):
def
zernike_R
(
m
,
n
,
rho
):
...
@@ -36,3 +37,75 @@ def zernike(m, n, rho, phi):
...
@@ -36,3 +37,75 @@ def zernike(m, n, rho, phi):
else
:
else
:
return
zernike_R
(
0
,
n
,
rho
)
return
zernike_R
(
0
,
n
,
rho
)
def
znm2Rc
(
A
,
R
):
'''
Convertes amplitudes of Zernike polynomials of order n=2 into
spherical radius of curvature. In case the astigmatic modes
(m=-1,m=2) are included, the functon returns the maximum and
minimum curvature.
Inputs: A, R
A - List of amplitudes of order 2 Zernike polynomials, ordered so that m
increases with list index. 1 <= len(A) <= 3. [m]
R - Radius of the mirror surface in the xy-plane. [m]
Returns: Rc
Rc - If astigmatic modes are used (len(A) == 2 or 3) a numpy.array of length
2 containing max and min curvatures is returned. If only the
'
defocus
'
mode is used Rc is a float number. [m]
Based on the Simtools function
'
FT_Znm_to_Rc.m
'
by Charlotte Bond.
'''
if
isinstance
(
A
,
list
):
if
len
(
A
)
==
3
:
a20
=
A
[
1
]
a22
=
math
.
sqrt
(
A
[
0
]
**
2
+
A
[
2
]
**
2
)
s
=
np
.
array
([
1.0
,
-
1.0
])
elif
len
(
A
)
==
2
:
a20
=
0
a22
=
math
.
sqrt
(
A
[
0
]
**
2
+
A
[
1
]
**
2
)
s
=
np
.
array
([
1.0
,
-
1.0
])
elif
len
(
A
)
==
1
:
a20
=
A
[
0
]
a22
=
0
s
=
0
elif
isinstance
(
A
,
float
)
or
isinstance
(
A
,
int
):
a20
=
A
a22
=
0
s
=
0
Rc
=
((
2
*
a20
+
s
*
a22
)
**
2
+
R
**
2
)
/
(
2
*
(
2
*
a20
+
s
*
a22
))
return
Rc
def
Rc2znm
(
Rc
,
R
):
'''
Converts Radius of curvatue to amplitudes of the second order Zernike
polynomials.
Iputs: Rc, R
Rc - Radius of curvature. Either a number or a numpy.ndarray with
minimum and maximum curvature.
R - Radius of mirror in xy-plane.
Returns: A
A - Ampltude(s) of the second order Zernike polynomials needed. Is
a number if Rc is a number, and if R is a numpy.ndarray so is A.
Based on Simtools function
'
FT_Rc_to_Znm.m
'
by Charlotte Bond.
'''
# Amplitude in x and y directions
c
=
(
Rc
-
np
.
sign
(
Rc
)
*
np
.
sqrt
(
Rc
**
2
-
R
**
2
)
)
/
2
if
isinstance
(
Rc
,
np
.
ndarray
):
A
=
np
.
array
([])
# Adding Z(2,0) amplitude
A
=
np
.
append
(
A
,
c
.
mean
())
# Adding Z(2,2) amplitude
A
=
np
.
append
(
A
,
2
*
(
c
[
0
]
-
A
[
0
]))
elif
isinstance
(
Rc
,
float
)
or
isinstance
(
Rc
,
int
):
A
=
c
return
A
This diff is collapsed.
Click to expand it.
pykat/optics/maps.py
+
807
−
294
View file @
121fe5fc
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