Skip to content
GitLab
Menu
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
7d635b06
Commit
7d635b06
authored
Sep 15, 2016
by
Daniel Brown
Browse files
Fixing x2axis variables, adding new isolator
parent
36b80188
Pipeline
#1585
passed with stage
in 18 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
pykat/commands.py
View file @
7d635b06
...
...
@@ -466,12 +466,8 @@ class xaxis(Command):
Command
.
__init__
(
self
,
axis_type
,
True
)
self
.
_axis_type
=
axis_type
self
.
x
=
putter
(
"x1"
,
self
)
self
.
mx
=
putter
(
"mx1"
,
self
)
self
.
_putters
.
append
(
self
.
x
)
self
.
_putters
.
append
(
self
.
mx
)
self
.
_set_variables
()
if
scale
==
"lin"
:
scale
=
Scale
.
linear
...
...
@@ -508,6 +504,13 @@ class xaxis(Command):
self
.
__param
=
param
self
.
__comp
=
param
.
_owner
()
def
_set_variables
(
self
):
self
.
x
=
putter
(
"x1"
,
self
)
self
.
mx
=
putter
(
"mx1"
,
self
)
self
.
_putters
.
append
(
self
.
x
)
self
.
_putters
.
append
(
self
.
mx
)
@
property
def
param
(
self
):
return
self
.
__param
@
param
.
setter
...
...
@@ -549,12 +552,14 @@ class xaxis(Command):
class
x2axis
(
xaxis
):
def
__init__
(
self
,
scale
,
limits
,
param
,
steps
,
comp
=
None
,
axis_type
=
"x2axis"
):
xaxis
.
__init__
(
self
,
scale
,
limits
,
param
,
steps
,
comp
=
comp
,
axis_type
=
axis_type
)
def
_set_variables
(
self
):
self
.
x
=
putter
(
"x2"
,
self
)
self
.
mx
=
putter
(
"mx2"
,
self
)
self
.
_putters
.
append
(
self
.
x
)
self
.
_putters
.
append
(
self
.
mx
)
@
staticmethod
def
parseFinesseText
(
text
):
values
=
text
.
split
()
...
...
pykat/components.py
View file @
7d635b06
...
...
@@ -1022,6 +1022,49 @@ class isolator(Component):
self
.
_svgItem
=
pykat
.
gui
.
graphics
.
ComponentQGraphicsItem
(
":/resources/isolator.svg"
,
self
,[(
-
4
,
15
,
self
.
nodes
[
0
]),
(
14
,
15
,
self
.
nodes
[
1
]),
(
14
,
24
,
self
.
nodes
[
2
])])
return
self
.
_svgItem
class
isolator1
(
Component
):
def
__init__
(
self
,
name
,
node1
,
node2
,
node3
,
node4
):
"""
Creates a 4-port isolator component.
"""
Component
.
__init__
(
self
,
name
)
self
.
_requested_node_names
.
append
(
node1
)
self
.
_requested_node_names
.
append
(
node2
)
self
.
_requested_node_names
.
append
(
node3
)
self
.
_requested_node_names
.
append
(
node4
)
self
.
_svgItem
=
None
@
staticmethod
def
parseFinesseText
(
text
):
values
=
text
.
split
()
if
values
[
0
]
!=
"isol1"
:
raise
pkex
.
BasePyKatException
(
"'{0}' not a valid Finesse isolator command"
.
format
(
text
))
values
.
pop
(
0
)
# remove initial value
if
len
(
values
)
==
5
:
return
isolator1
(
values
[
0
],
values
[
1
],
values
[
2
],
values
[
3
],
values
[
4
])
else
:
raise
pkex
.
BasePyKatException
(
"Isolator1 Finesse code format incorrect '{0}'"
.
format
(
text
))
def
getFinesseText
(
self
):
rtn
=
[
'isol1 {0} {1} {2} {3} {4}'
.
format
(
self
.
name
,
self
.
nodes
[
0
].
name
,
self
.
nodes
[
1
].
name
,
self
.
nodes
[
2
].
name
,
self
.
nodes
[
3
].
name
)]
for
p
in
self
.
_params
:
rtn
.
extend
(
p
.
getFinesseText
())
return
rtn
class
lens
(
Component
):
def
__init__
(
self
,
name
,
node1
,
node2
,
f
=
1
,
p
=
None
):
...
...
pykat/finesse.py
View file @
7d635b06
...
...
@@ -471,6 +471,7 @@ class katRun(object):
if
ylim
is
not
None
:
pyplot
.
ylim
(
ylim
[
0
],
ylim
[
1
])
pyplot
.
margins
(
0
,
0.05
)
pyplot
.
tight_layout
()
if
legend
:
...
...
@@ -1112,6 +1113,8 @@ class kat(object):
obj
=
pykat
.
components
.
beamSplitter
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
2
]
==
"gr"
):
obj
=
pykat
.
components
.
grating
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
5
]
==
"isol1"
):
obj
=
pykat
.
components
.
isolator1
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
4
]
==
"isol"
):
obj
=
pykat
.
components
.
isolator
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
4
]
==
"lens"
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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