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
30b5ac1c
Commit
30b5ac1c
authored
May 4, 2014
by
Daniel Brown
Browse files
Options
Downloads
Patches
Plain Diff
update to gauss beam
parent
1b268608
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
pykat/utilities/optics/gaussian_beams.py
+16
-28
16 additions, 28 deletions
pykat/utilities/optics/gaussian_beams.py
with
16 additions
and
28 deletions
pykat/utilities/optics/gaussian_beams.py
+
16
−
28
View file @
30b5ac1c
...
@@ -9,14 +9,14 @@ from pykat.SIfloat import SIfloat
...
@@ -9,14 +9,14 @@ from pykat.SIfloat import SIfloat
class
gauss_param
(
object
):
class
gauss_param
(
object
):
"""
"""
Use beam_param instead,
prefer that as a name
Use beam_param instead,
will be future name of this object.
Gaussian beam complex parameter
Gaussian beam complex parameter
gauss
_param is effectively a complex number with extra
beam
_param is effectively a complex number with extra
functionality to determine beam parameters.
functionality to determine beam parameters.
d
efaults to 1064e-9m for wavelength and refractive index 1
D
efaults to 1064e-9m for wavelength and refractive index 1
usage:
usage:
q = gauss_param(w0=w0, z=z)
q = gauss_param(w0=w0, z=z)
q = gauss_param(z=z, zr=zr)
q = gauss_param(z=z, zr=zr)
...
@@ -95,7 +95,7 @@ class gauss_param(object):
...
@@ -95,7 +95,7 @@ class gauss_param(object):
return
float
(
"
inf
"
)
return
float
(
"
inf
"
)
def
conjugate
(
self
):
def
conjugate
(
self
):
return
gauss
_param
(
self
.
__lambda
,
self
.
__nr
,
self
.
__q
.
conjugate
())
return
beam
_param
(
self
.
__lambda
,
self
.
__nr
,
self
.
__q
.
conjugate
())
def
__complex__
(
self
):
def
__complex__
(
self
):
return
self
.
__q
return
self
.
__q
...
@@ -104,7 +104,7 @@ class gauss_param(object):
...
@@ -104,7 +104,7 @@ class gauss_param(object):
return
str
(
self
.
__q
)
return
str
(
self
.
__q
)
def
__mul__
(
self
,
a
):
def
__mul__
(
self
,
a
):
return
gauss
_param
(
self
.
__lambda
,
self
.
__nr
,
self
.
__q
*
complex
(
a
))
return
beam
_param
(
self
.
__lambda
,
self
.
__nr
,
self
.
__q
*
complex
(
a
))
def
__imul__
(
self
,
a
):
def
__imul__
(
self
,
a
):
self
.
__q
*=
complex
(
a
)
self
.
__q
*=
complex
(
a
)
...
@@ -113,7 +113,7 @@ class gauss_param(object):
...
@@ -113,7 +113,7 @@ class gauss_param(object):
__rmul__
=
__mul__
__rmul__
=
__mul__
def
__add__
(
self
,
a
):
def
__add__
(
self
,
a
):
return
gauss
_param
(
self
.
__lambda
,
self
.
__nr
,
self
.
__q
+
complex
(
a
))
return
beam
_param
(
self
.
__lambda
,
self
.
__nr
,
self
.
__q
+
complex
(
a
))
def
__iadd__
(
self
,
a
):
def
__iadd__
(
self
,
a
):
self
.
__q
+=
complex
(
a
)
self
.
__q
+=
complex
(
a
)
...
@@ -122,27 +122,27 @@ class gauss_param(object):
...
@@ -122,27 +122,27 @@ class gauss_param(object):
__radd__
=
__add__
__radd__
=
__add__
def
__sub__
(
self
,
a
):
def
__sub__
(
self
,
a
):
return
gauss
_param
(
self
.
__lambda
,
self
.
__nr
,
self
.
__q
-
complex
(
a
))
return
beam
_param
(
self
.
__lambda
,
self
.
__nr
,
self
.
__q
-
complex
(
a
))
def
__isub__
(
self
,
a
):
def
__isub__
(
self
,
a
):
self
.
__q
-=
complex
(
a
)
self
.
__q
-=
complex
(
a
)
return
self
return
self
def
__rsub__
(
self
,
a
):
def
__rsub__
(
self
,
a
):
return
gauss
_param
(
self
.
__lambda
,
self
.
__nr
,
complex
(
a
)
-
self
.
__q
)
return
beam
_param
(
self
.
__lambda
,
self
.
__nr
,
complex
(
a
)
-
self
.
__q
)
def
__div__
(
self
,
a
):
def
__div__
(
self
,
a
):
return
gauss
_param
(
self
.
__lambda
,
self
.
__nr
,
self
.
__q
/
complex
(
a
))
return
beam
_param
(
self
.
__lambda
,
self
.
__nr
,
self
.
__q
/
complex
(
a
))
def
__idiv__
(
self
,
a
):
def
__idiv__
(
self
,
a
):
self
.
__q
/=
complex
(
a
)
self
.
__q
/=
complex
(
a
)
return
self
return
self
def
__pow__
(
self
,
q
):
def
__pow__
(
self
,
q
):
return
gauss
_param
(
self
.
__lambda
,
self
.
__nr
,
self
.
__q
**
q
)
return
beam
_param
(
self
.
__lambda
,
self
.
__nr
,
self
.
__q
**
q
)
def
__neg__
(
self
,
q
):
def
__neg__
(
self
,
q
):
return
gauss
_param
(
self
.
__lambda
,
self
.
__nr
,
-
self
.
__q
)
return
beam
_param
(
self
.
__lambda
,
self
.
__nr
,
-
self
.
__q
)
def
__eq__
(
self
,
q
):
def
__eq__
(
self
,
q
):
return
complex
(
q
)
==
self
.
__q
return
complex
(
q
)
==
self
.
__q
...
@@ -245,7 +245,7 @@ class HG_beam(object):
...
@@ -245,7 +245,7 @@ class HG_beam(object):
self
.
__ypre_const
=
math
.
pow
(
2.0
/
math
.
pi
,
0.25
)
self
.
__ypre_const
=
math
.
pow
(
2.0
/
math
.
pi
,
0.25
)
self
.
__ypre_const
*=
math
.
sqrt
(
1.0
/
(
2
**
self
.
_m
*
math
.
factorial
(
self
.
_m
)))
self
.
__ypre_const
*=
math
.
sqrt
(
1.0
/
(
2
**
self
.
_m
*
math
.
factorial
(
self
.
_m
)))
self
.
__ypre_const
*=
cmath
.
sqrt
(
1j
*
self
.
_qy
.
imag
/
self
.
_qy
.
q
)
self
.
__ypre_const
*=
cmath
.
sqrt
(
1j
*
self
.
_qy
.
imag
/
self
.
_qy
.
q
)
self
.
__ypre_const
*=
((
1j
*
self
.
_qy
.
imag
*
self
.
_qy
.
conjugate
())
/
(
-
1j
*
self
.
_qy
.
imag
*
self
.
_qy
.
q
))
**
(
self
.
_m
/
2.0
)
self
.
__ypre_const
*=
((
1j
*
self
.
_qy
.
imag
*
self
.
_qy
.
q
.
conjugate
())
/
(
-
1j
*
self
.
_qy
.
imag
*
self
.
_qy
.
q
))
**
(
self
.
_m
/
2.0
)
self
.
__sqrt2_wxz
=
math
.
sqrt
(
2
)
/
self
.
_qx
.
w
self
.
__sqrt2_wxz
=
math
.
sqrt
(
2
)
/
self
.
_qx
.
w
self
.
__sqrt2_wyz
=
math
.
sqrt
(
2
)
/
self
.
_qy
.
w
self
.
__sqrt2_wyz
=
math
.
sqrt
(
2
)
/
self
.
_qy
.
w
...
@@ -256,26 +256,14 @@ class HG_beam(object):
...
@@ -256,26 +256,14 @@ class HG_beam(object):
self
.
__invqx
=
1
/
self
.
_qx
.
q
self
.
__invqx
=
1
/
self
.
_qx
.
q
self
.
__invqy
=
1
/
self
.
_qy
.
q
self
.
__invqy
=
1
/
self
.
_qy
.
q
def
_Un
(
self
,
x
):
return
self
.
__xpre_const
*
self
.
_hn
(
self
.
__sqrt2_wxz
*
x
)
*
np
.
exp
(
-
0.5j
*
self
.
__kx
*
x
*
x
*
self
.
__invqx
)
def
_Um
(
self
,
y
):
return
self
.
__ypre_const
*
self
.
_hm
(
self
.
__sqrt2_wyz
*
y
)
*
np
.
exp
(
-
0.5j
*
self
.
__ky
*
y
*
y
*
self
.
__invqy
)
def
Un
(
self
,
x
):
def
Un
(
self
,
x
):
vec
=
np
.
vectorize
(
self
.
_Un
,
otypes
=
[
np
.
complex64
])
return
self
.
__xpre_const
*
self
.
_hn
(
self
.
__sqrt2_wxz
*
x
)
*
np
.
exp
(
-
0.5j
*
self
.
__kx
*
x
*
x
*
self
.
__invqx
)
return
vec
(
x
=
x
)
def
Um
(
self
,
y
):
def
Um
(
self
,
y
):
vec
=
np
.
vectorize
(
self
.
_Um
,
otypes
=
[
np
.
complex64
])
return
self
.
__ypre_const
*
self
.
_hm
(
self
.
__sqrt2_wyz
*
y
)
*
np
.
exp
(
-
0.5j
*
self
.
__ky
*
y
*
y
*
self
.
__invqy
)
return
vec
(
y
=
y
)
def
_unm
(
self
,
x
,
y
):
return
self
.
_Un
(
x
)
*
self
.
_Um
(
y
)
def
Unm
(
self
,
x
,
y
):
def
Unm
(
self
,
x
,
y
):
vec
=
np
.
vectorize
(
self
.
_unm
,
otypes
=
[
np
.
complex64
])
return
self
.
Un
(
x
)
*
self
.
Um
(
y
)
return
vec
(
x
=
x
,
y
=
y
)
def
plot
(
self
,
ndx
=
100
,
ndy
=
100
,
xscale
=
4
,
yscale
=
4
):
def
plot
(
self
,
ndx
=
100
,
ndy
=
100
,
xscale
=
4
,
yscale
=
4
):
import
pylab
import
pylab
...
...
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