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
15991349
Commit
15991349
authored
Apr 26, 2015
by
Daniel Brown
Browse files
adding in undumpNodes method to rename dump nodes for qnoise calculations
parent
33a3c83d
Changes
1
Hide whitespace changes
Inline
Side-by-side
pykat/finesse.py
View file @
15991349
...
...
@@ -1396,7 +1396,31 @@ class kat(object):
except
pkex
.
BasePyKatException
as
ex
:
pkex
.
PrintError
(
"Error on removing object:"
,
ex
)
def
undumpNodes
(
self
):
"""
Loops through and removes all dump nodes. Required when running quantum noise
calculations using qnoised as noise must be injected in where losses occur, such as power
dumped.
The nodes will be renamed 'dump0', 'dump1', ... If by change a kat file already has a
node called dump0, dump1, etc. then it will skip that name and move on to the next until
it finds one that doesn't exist.
"""
i
=
0
node_name
=
"dump%i"
%
i
for
c
in
self
.
components
.
values
():
for
n
in
c
.
nodes
:
if
n
.
isDump
:
while
hasattr
(
kat
.
nodes
,
node_name
):
node_name
=
"dump%i"
%
i
i
+=
1
self
.
nodes
.
replaceNode
(
c
,
n
,
self
.
nodes
.
createNode
(
node_name
%
i
))
def
getMatrices
(
self
):
import
scipy
...
...
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