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
Sebastian Steinlechner
pykat
Commits
0abb97cf
Commit
0abb97cf
authored
Apr 10, 2015
by
Daniel Brown
Browse files
fixing weakref updating on deepcopy for NodeGaussSetters
parent
f415451c
Changes
3
Hide whitespace changes
Inline
Side-by-side
pykat/components.py
View file @
0abb97cf
...
...
@@ -15,7 +15,7 @@ from pykat.SIfloat import *
from
pykat.param
import
Param
,
AttrParam
import
weakref
import
pykat.exceptions
as
pkex
from
copy
import
deepcopy
next_component_id
=
1
from
pykat
import
USE_GUI
,
NoGUIException
...
...
@@ -198,7 +198,7 @@ class Component(object):
del
self
.
_params
[:]
self
.
__removed
=
True
class
AbstractMirrorComponent
(
Component
):
__metaclass__
=
abc
.
ABCMeta
...
...
pykat/finesse.py
View file @
0abb97cf
...
...
@@ -424,6 +424,20 @@ class kat(object):
if
kat_file
!=
None
:
self
.
loadKatFile
(
kat_file
)
def
__deepcopy__
(
self
,
memo
):
cls
=
self
.
__class__
result
=
cls
.
__new__
(
cls
)
memo
[
id
(
self
)]
=
result
for
k
,
v
in
self
.
__dict__
.
items
():
setattr
(
result
,
k
,
copy
.
deepcopy
(
v
,
memo
))
# Update any weakrefs
for
c
in
result
.
components
:
result
.
components
[
c
].
_Component__update_node_setters
()
return
result
@
property
def
signals
(
self
):
return
self
.
__signals
...
...
@@ -919,8 +933,9 @@ class kat(object):
r
=
katRun
()
r
.
yaxis
=
self
.
yaxis
r
.
katScript
=
""
.
join
(
self
.
generateKatScript
())
r
.
katScript
=
""
.
join
(
self
.
generateKatScript
())
if
(
plot
==
None
):
# ensure we don't do any plotting. That should be handled
# by user themselves
...
...
pykat/node_network.py
View file @
0abb97cf
...
...
@@ -498,7 +498,7 @@ class Node(object):
def
setGauss
(
self
,
component
,
*
args
):
self
.
__q_comp
=
component
if
len
(
args
)
==
1
:
if
len
(
args
)
==
1
:
self
.
__q_x
=
beam_param
(
self
.
_network
.
kat
.
lambda0
,
q
=
args
[
0
])
self
.
__q_y
=
beam_param
(
self
.
_network
.
kat
.
lambda0
,
q
=
args
[
0
])
elif
len
(
args
)
==
2
:
...
...
@@ -506,7 +506,7 @@ class Node(object):
self
.
__q_y
=
beam_param
(
self
.
_network
.
kat
.
lambda0
,
q
=
args
[
1
])
else
:
raise
pkex
.
BasePyKatException
(
"Must specify either 1 Gaussian beam parameter or 2 for astigmatic beams"
)
def
getFinesseText
(
self
):
if
self
.
__q_x
is
None
or
self
.
__q_y
is
None
or
self
.
__q_comp
is
None
:
return
[]
...
...
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