Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
finesse
pykat
Commits
2fecc0f6
Commit
2fecc0f6
authored
Dec 09, 2013
by
Daniel Brown
Browse files
can now do kat.m1.n1.q = 1+100j and it converts it correctly into a gaussian beam parameter object
parent
de03e236
Changes
3
Hide whitespace changes
Inline
Side-by-side
pykat/components.py
View file @
2fecc0f6
...
...
@@ -32,21 +32,21 @@ class NodeGaussSetter(object):
@
q
.
setter
def
q
(
self
,
value
):
self
.
__node
.
setGauss
(
self
.
__comp
,
value
)
self
.
__node
.
setGauss
(
self
.
__comp
,
complex
(
value
)
)
@
property
def
qx
(
self
):
return
self
.
__node
.
qx
@
qx
.
setter
def
qx
(
self
,
value
):
self
.
__node
.
setGauss
(
self
.
__comp
,
value
)
self
.
__node
.
setGauss
(
self
.
__comp
,
complex
(
value
)
)
@
property
def
qy
(
self
):
return
self
.
__node
.
qy
@
qy
.
setter
def
qy
(
self
,
value
):
self
.
__node
.
setGauss
(
self
.
__comp
,
self
.
qx
,
value
)
self
.
__node
.
setGauss
(
self
.
__comp
,
self
.
qx
,
complex
(
value
)
)
class
Component
(
object
)
:
def
__init__
(
self
,
name
):
...
...
pykat/node_network.py
View file @
2fecc0f6
...
...
@@ -9,6 +9,7 @@ import pykat.gui.graphics
import
pykat.exceptions
as
pkex
from
pykat.components
import
Component
from
pykat.detectors
import
Detector
from
pykat.utilities.optics.gaussian_beams
import
gauss_param
class
NodeNetwork
(
object
):
def
__init__
(
self
,
kat
):
...
...
@@ -241,11 +242,11 @@ class Node(object):
self
.
__q_comp
=
component
if
len
(
args
)
==
1
:
self
.
__q_x
=
args
[
0
]
self
.
__q_y
=
args
[
0
]
self
.
__q_x
=
gauss_param
(
q
=
args
[
0
]
)
self
.
__q_y
=
gauss_param
(
q
=
args
[
0
]
)
elif
len
(
args
)
==
2
:
self
.
__q_x
=
args
[
0
]
self
.
__q_y
=
args
[
1
]
self
.
__q_x
=
gauss_param
(
q
=
args
[
0
]
)
self
.
__q_y
=
gauss_param
(
q
=
args
[
1
]
)
else
:
raise
pkex
.
BasePyKatException
(
"Must specify either 1 Gaussian beam parameter or 2 for astigmatic beams"
)
...
...
pykat/utilities/optics/gaussian_beams.py
View file @
2fecc0f6
...
...
@@ -14,6 +14,7 @@ class gauss_param(object):
q = gauss_param(w0=w0, z=z)
q = gauss_param(z=z, zr=zr)
q = gauss_param(wz=wz, rc=rc)
q = gauss_param(q=a) # where a is a complex number
or change default wavelength and refractive index with:
...
...
@@ -27,6 +28,13 @@ class gauss_param(object):
if
len
(
args
)
==
1
:
self
.
__q
=
args
[
0
]
elif
len
(
kwargs
)
==
1
:
if
"q"
in
kwargs
:
self
.
__q
=
complex
(
kwargs
[
"q"
])
else
:
raise
pkex
.
BasePyKatException
(
"Must specify: z and w0 or z and zr or rc and wz, to define the beam parameter"
)
elif
len
(
kwargs
)
==
2
:
if
"w0"
in
kwargs
and
"z"
in
kwargs
:
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment