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
1428c245
Commit
1428c245
authored
11 years ago
by
Sean Leavey
Browse files
Options
Downloads
Patches
Plain Diff
Added grating, but not tested very thoroughly
parent
7af711e5
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pykat/components.py
+115
-3
115 additions, 3 deletions
pykat/components.py
pykat/finesse.py
+2
-0
2 additions, 0 deletions
pykat/finesse.py
with
117 additions
and
3 deletions
pykat/components.py
+
115
−
3
View file @
1428c245
...
...
@@ -341,14 +341,13 @@ class beamSplitter(AbstractMirrorComponent):
class
space
(
Component
):
def
__init__
(
self
,
name
,
node1
,
node2
,
L
=
0
,
n
=
1
):
Component
.
__init__
(
self
,
name
,
)
Component
.
__init__
(
self
,
name
)
self
.
_requested_node_names
.
append
(
node1
)
self
.
_requested_node_names
.
append
(
node2
)
self
.
__L
=
SIfloat
(
L
)
self
.
__n
=
SIfloat
(
n
)
self
.
_QItem
=
None
@property
def
L
(
self
):
return
Param
(
'
L
'
,
self
.
__L
)
...
...
@@ -387,6 +386,119 @@ class space(Component):
return
self
.
_QItem
class
grating
(
Component
):
def
__init__
(
self
,
name
,
node1
,
node2
,
node3
=
None
,
node4
=
None
,
n
=
2
,
d
=
0
,
eta_0
=
0
,
eta_1
=
0
,
eta_2
=
0
,
eta_3
=
0
,
rho_0
=
0
,
alpha
=
0
):
# TODO: implement Rcx, Rcy and Rc
Component
.
__init__
(
self
,
name
)
self
.
_requested_node_names
.
append
(
node1
)
self
.
_requested_node_names
.
append
(
node2
)
if
n
>
2
:
if
node3
!=
None
:
self
.
_requested_node_names
.
append
(
node3
)
else
:
raise
exceptions
.
RuntimeError
(
"
Grating node 3 not specified
"
)
if
n
>
3
:
if
node4
!=
None
:
self
.
_requested_node_names
.
append
(
node4
)
else
:
raise
exceptions
.
RuntimeError
(
"
Grating node 4 not specified
"
)
if
n
>
4
or
n
<
2
:
raise
exceptions
.
RuntimeError
(
"
Grating must have between 2 and 4 ports
"
)
self
.
__n
=
n
self
.
__d
=
SIfloat
(
d
)
self
.
__eta_0
=
SIfloat
(
eta_0
)
self
.
__eta_1
=
SIfloat
(
eta_1
)
self
.
__eta_2
=
SIfloat
(
eta_2
)
self
.
__eta_3
=
SIfloat
(
eta_3
)
self
.
__rho_0
=
SIfloat
(
rho_0
)
self
.
__alpha
=
SIfloat
(
alpha
)
@property
def
n
(
self
):
return
Param
(
'
n
'
,
self
.
__n
)
@n.setter
def
n
(
self
,
value
):
if
value
<
2
or
value
>
4
:
raise
exceptions
.
RuntimeError
(
"
Grating must have between 2 and 4 ports
"
)
else
:
self
.
__n
=
value
@property
def
d
(
self
):
return
Param
(
'
d
'
,
self
.
__d
)
@d.setter
def
d
(
self
,
value
):
self
.
__d
=
SIfloat
(
value
)
@property
def
eta_0
(
self
):
return
Param
(
'
eta_0
'
,
self
.
__eta_0
)
@eta_0.setter
def
eta_0
(
self
,
value
):
self
.
__eta_0
=
SIfloat
(
value
)
@property
def
eta_1
(
self
):
return
Param
(
'
eta_1
'
,
self
.
__eta_1
)
@eta_1.setter
def
eta_1
(
self
,
value
):
self
.
__eta_1
=
SIfloat
(
value
)
@property
def
eta_2
(
self
):
return
Param
(
'
eta_2
'
,
self
.
__eta_2
)
@eta_2.setter
def
eta_2
(
self
,
value
):
self
.
__eta_2
=
SIfloat
(
value
)
@property
def
eta_3
(
self
):
return
Param
(
'
eta_3
'
,
self
.
__eta_3
)
@eta_3.setter
def
eta_3
(
self
,
value
):
self
.
__eta_3
=
SIfloat
(
value
)
@property
def
rho_0
(
self
):
return
Param
(
'
rho_0
'
,
self
.
__rho_0
)
@rho_0.setter
def
rho_0
(
self
,
value
):
self
.
__rho_0
=
SIfloat
(
value
)
@property
def
alpha
(
self
):
return
Param
(
'
alpha
'
,
self
.
__alpha
)
@alpha.setter
def
alpha
(
self
,
value
):
self
.
__alpha
=
SIfloat
(
value
)
@staticmethod
def
parseFinesseText
(
text
):
values
=
text
.
split
(
"
"
)
if
values
[
0
][
0
:
2
]
!=
"
gr
"
:
raise
exceptions
.
RuntimeError
(
"'
{0}
'
not a valid Finesse grating command
"
.
format
(
text
))
if
len
(
values
[
0
])
>
2
:
if
int
(
values
[
0
][
2
])
>
4
or
int
(
values
[
0
][
2
])
<
2
:
raise
exceptions
.
RuntimeError
(
"
Grating must have between 2 and 4 ports
"
)
else
:
n
=
int
(
values
[
0
][
2
])
else
:
n
=
2
values
.
pop
(
0
)
# remove initial value
if
n
==
2
:
return
grating
(
values
[
0
],
values
[
2
],
values
[
3
],
None
,
None
,
n
,
values
[
1
])
elif
n
==
3
:
return
grating
(
values
[
0
],
values
[
2
],
values
[
3
],
values
[
4
],
None
,
n
,
values
[
1
])
else
:
return
grating
(
values
[
0
],
values
[
2
],
values
[
3
],
values
[
4
],
values
[
5
],
n
,
values
[
1
])
def
getFinesseText
(
self
):
if
self
.
__n
==
2
:
return
'
gr{0} {1} {2} {3} {4}
'
.
format
(
self
.
__n
,
self
.
name
,
self
.
__d
,
self
.
nodes
[
0
].
name
,
self
.
nodes
[
1
].
name
)
elif
self
.
__n
==
3
:
return
'
gr{0} {1} {2} {3} {4} {5}
'
.
format
(
self
.
__n
,
self
.
name
,
self
.
__d
,
self
.
nodes
[
0
].
name
,
self
.
nodes
[
1
].
name
,
self
.
nodes
[
2
].
name
)
else
:
return
'
gr{0} {1} {2} {3} {4}
'
.
format
(
self
.
__n
,
self
.
name
,
self
.
__d
,
self
.
nodes
[
0
].
name
,
self
.
nodes
[
1
].
name
,
self
.
nodes
[
2
].
name
,
self
.
nodes
[
3
].
name
)
def
getQGraphicsItem
(
self
):
if
self
.
_QItem
==
None
:
self
.
_QItem
=
pykat
.
gui
.
graphics
.
SpaceQGraphicsItem
(
self
)
# TODO: make SVG graphic for grating
return
self
.
_QItem
class
laser
(
Component
):
def
__init__
(
self
,
name
,
node
,
P
=
1
,
f_offset
=
0
,
phase
=
0
):
Component
.
__init__
(
self
,
name
)
...
...
This diff is collapsed.
Click to expand it.
pykat/finesse.py
+
2
−
0
View file @
1428c245
...
...
@@ -205,6 +205,8 @@ class kat(object):
obj
=
pykat
.
components
.
laser
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
2
]
==
"
bs
"
):
obj
=
pykat
.
components
.
beamSplitter
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
2
]
==
"
gr
"
):
obj
=
pykat
.
components
.
grating
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
2
]
==
"
pd
"
):
obj
=
pykat
.
detectors
.
photodiode
.
parseFinesseText
(
line
)
elif
(
first
==
"
xaxis
"
or
first
==
"
x2axis
"
or
first
==
"
xaxis*
"
or
first
==
"
x2axis*
"
):
...
...
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