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
Sebastian Steinlechner
pykat
Commits
dc470f85
Commit
dc470f85
authored
Apr 14, 2015
by
Andreas Freise
Browse files
trying to fix wrong commit from some time ago, still needs fixing.
parent
864005dd
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
pykat/__init__.py
View file @
dc470f85
from
__future__
import
absolute_import
from
__future__
import
division
from
__future__
import
print_function
from
__future__
import
unicode_literals
__version__
=
"0.6.2"
__version__
=
"0.6.2"
# This flag is used to switch on the gui features in pkat at import time
# This flag is used to switch on the gui features in pkat at import time
USE_GUI
=
False
USE_GUI
=
False
HAS_OPTIVIS
=
False
import
imp
try
:
imp
.
find_module
(
'optivis'
)
HAS_OPTIVIS
=
True
except
ImportError
:
HAS_OPTIVIS
=
False
import
pykat.exceptions
as
pkex
import
pykat.exceptions
as
pkex
...
...
pykat/components.py
View file @
dc470f85
...
@@ -9,7 +9,7 @@ from __future__ import division
...
@@ -9,7 +9,7 @@ from __future__ import division
from
__future__
import
print_function
from
__future__
import
print_function
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
from
pykat
import
USE_GUI
,
NoGUIException
from
pykat
import
USE_GUI
,
HAS_OPTIVIS
,
NoGUIException
import
pykat.external.six
as
six
import
pykat.external.six
as
six
...
@@ -21,15 +21,22 @@ import pykat
...
@@ -21,15 +21,22 @@ import pykat
from
pykat.node_network
import
*
from
pykat.node_network
import
*
from
pykat.exceptions
import
*
from
pykat.exceptions
import
*
import
abc
import
abc
import
copy
from
collections
import
OrderedDict
if
HAS_OPTIVIS
:
import
optivis.bench.components
as
optivis_components
from
optivis.view.canvas
import
OptivisCanvasItemDataType
from
optivis.bench.labels
import
Label
as
optivis_label
from
optivis.geometry
import
Coordinates
as
optivis_coord
import
PyQt4
from
pykat.SIfloat
import
*
from
pykat.SIfloat
import
*
from
pykat.param
import
Param
,
AttrParam
from
pykat.param
import
Param
,
AttrParam
import
weakref
import
weakref
import
pykat.exceptions
as
pkex
import
pykat.exceptions
as
pkex
from
copy
import
deepcopy
next_component_id
=
1
from
pykat
import
USE_GUI
,
NoGUIException
next_component_id
=
1
if
USE_GUI
:
if
USE_GUI
:
import
pykat.gui.resources
import
pykat.gui.resources
...
@@ -79,7 +86,15 @@ class NodeGaussSetter(object):
...
@@ -79,7 +86,15 @@ class NodeGaussSetter(object):
class
Component
(
object
):
class
Component
(
object
):
__metaclass__
=
abc
.
ABCMeta
__metaclass__
=
abc
.
ABCMeta
def
__init__
(
self
,
name
):
def
__new__
(
cls
,
*
args
,
**
kwargs
):
# This creates an instance specific class for the component
# this enables us to add properties to instances rather than
# all classes
return
object
.
__new__
(
type
(
cls
.
__name__
,
(
cls
,),
{}),
*
args
,
**
kwargs
)
def
__init__
(
self
,
name
=
None
):
self
.
_optivis_component
=
None
self
.
__name
=
name
self
.
__name
=
name
self
.
_svgItem
=
None
self
.
_svgItem
=
None
self
.
_requested_node_names
=
[]
self
.
_requested_node_names
=
[]
...
@@ -88,17 +103,25 @@ class Component(object):
...
@@ -88,17 +103,25 @@ class Component(object):
self
.
_params
=
[]
self
.
_params
=
[]
self
.
__removed
=
False
self
.
__removed
=
False
self
.
_default_fsig_param
=
None
self
.
_default_fsig_param
=
None
self
.
optivisLabelContent
=
None
# store a unique ID for this component
# store a unique ID for this component
global
next_component_id
global
next_component_id
self
.
__id
=
next_component_id
self
.
__id
=
next_component_id
next_component_id
+=
1
next_component_id
+=
1
# This creates an instance specific class for the component
# this enables us to add properties to instances rather than
def
__deepcopy__
(
self
,
memo
):
# all classes
"""
cls
=
type
(
self
)
When deep copying a kat object we need to take into account
self
.
__class__
=
type
(
cls
.
__name__
,
(
cls
,),
{})
the instance specific properties.
"""
result
=
self
.
__class__
.
__new__
(
self
.
__class__
)
result
.
__dict__
=
copy
.
deepcopy
(
self
.
__dict__
,
memo
)
result
.
__update_node_setters
return
result
def
_register_param
(
self
,
param
):
def
_register_param
(
self
,
param
):
self
.
_params
.
append
(
param
)
self
.
_params
.
append
(
param
)
...
@@ -210,18 +233,36 @@ class Component(object):
...
@@ -210,18 +233,36 @@ class Component(object):
self
.
__removed
=
True
self
.
__removed
=
True
def
__deepcopy__
(
self
,
memo
):
def
getOptivisParameterDict
(
self
):
cls
=
self
.
__class__
if
len
(
self
.
_params
)
==
0
:
result
=
cls
.
__new__
(
cls
)
return
None
memo
[
id
(
self
)]
=
result
for
k
,
v
in
self
.
__dict__
.
items
():
d
=
OrderedDict
()
setattr
(
result
,
k
,
deepcopy
(
v
,
memo
))
for
p
in
result
.
_params
:
for
p
in
self
.
_params
:
p
.
_updateOwner
(
result
)
d
[
p
.
name
]
=
OptivisCanvasItemDataType
.
TEXTBOX
return
d
def
getOptivisTooltip
(
self
):
tooltip
=
"Name: %s"
%
self
.
name
for
p
in
self
.
_params
:
if
p
.
value
is
not
None
:
tooltip
+=
"
\n
%s = %s"
%
(
p
.
name
,
str
(
p
.
value
))
return
tooltip
def
setOptivisLabelContent
(
self
):
"""
Sets default Optivis label contents
"""
if
self
.
optivisLabelContent
is
None
:
self
.
optivisLabelContent
=
{}
self
.
optivisLabelContent
[
"Name"
]
=
self
.
name
return
result
class
AbstractMirrorComponent
(
Component
):
class
AbstractMirrorComponent
(
Component
):
__metaclass__
=
abc
.
ABCMeta
__metaclass__
=
abc
.
ABCMeta
...
@@ -258,12 +299,12 @@ class AbstractMirrorComponent(Component):
...
@@ -258,12 +299,12 @@ class AbstractMirrorComponent(Component):
self
.
__rxmech
=
AttrParam
(
"rxmech"
,
self
,
rxmech
)
self
.
__rxmech
=
AttrParam
(
"rxmech"
,
self
,
rxmech
)
self
.
__rymech
=
AttrParam
(
"rymech"
,
self
,
rymech
)
self
.
__rymech
=
AttrParam
(
"rymech"
,
self
,
rymech
)
self
.
__z
=
Param
(
"z"
,
self
,
0
,
canFsig
=
True
,
isPutable
=
False
,
isPutter
=
False
,
isTunable
=
False
,
fsig_name
=
"z"
)
self
.
__z
=
Param
(
"z"
,
self
,
None
,
canFsig
=
True
,
isPutable
=
False
,
isPutter
=
False
,
isTunable
=
False
,
fsig_name
=
"z"
)
self
.
__rx
=
Param
(
"rx"
,
self
,
0
,
canFsig
=
True
,
isPutable
=
False
,
isPutter
=
False
,
isTunable
=
False
,
fsig_name
=
"rx"
)
self
.
__rx
=
Param
(
"rx"
,
self
,
None
,
canFsig
=
True
,
isPutable
=
False
,
isPutter
=
False
,
isTunable
=
False
,
fsig_name
=
"rx"
)
self
.
__ry
=
Param
(
"ry"
,
self
,
0
,
canFsig
=
True
,
isPutable
=
False
,
isPutter
=
False
,
isTunable
=
False
,
fsig_name
=
"ry"
)
self
.
__ry
=
Param
(
"ry"
,
self
,
None
,
canFsig
=
True
,
isPutable
=
False
,
isPutter
=
False
,
isTunable
=
False
,
fsig_name
=
"ry"
)
self
.
__Fz
=
Param
(
"Fz"
,
self
,
0
,
canFsig
=
True
,
isPutable
=
False
,
isPutter
=
False
,
isTunable
=
False
,
fsig_name
=
"Fz"
)
self
.
__Fz
=
Param
(
"Fz"
,
self
,
None
,
canFsig
=
True
,
isPutable
=
False
,
isPutter
=
False
,
isTunable
=
False
,
fsig_name
=
"Fz"
)
self
.
__Frx
=
Param
(
"Frx"
,
self
,
0
,
canFsig
=
True
,
isPutable
=
False
,
isPutter
=
False
,
isTunable
=
False
,
fsig_name
=
"Frx"
)
self
.
__Frx
=
Param
(
"Frx"
,
self
,
None
,
canFsig
=
True
,
isPutable
=
False
,
isPutter
=
False
,
isTunable
=
False
,
fsig_name
=
"Frx"
)
self
.
__Fry
=
Param
(
"Fry"
,
self
,
0
,
canFsig
=
True
,
isPutable
=
False
,
isPutter
=
False
,
isTunable
=
False
,
fsig_name
=
"Fry"
)
self
.
__Fry
=
Param
(
"Fry"
,
self
,
None
,
canFsig
=
True
,
isPutable
=
False
,
isPutter
=
False
,
isTunable
=
False
,
fsig_name
=
"Fry"
)
self
.
_default_fsig_param
=
self
.
__phi
self
.
_default_fsig_param
=
self
.
__phi
...
@@ -450,6 +491,37 @@ class mirror(AbstractMirrorComponent):
...
@@ -450,6 +491,37 @@ class mirror(AbstractMirrorComponent):
return
rtn
return
rtn
def
getOptivisComponent
(
self
):
self
.
setOptivisLabelContent
()
if
self
.
_optivis_component
is
None
:
self
.
_optivis_component
=
optivis_components
.
CavityMirror
(
name
=
self
.
name
,
aoi
=
0
,
tooltip
=
self
.
getOptivisTooltip
,
paramList
=
self
.
getOptivisParameterDict
(),
pykatObject
=
weakref
.
ref
(
self
))
lbl
=
optivis_label
(
text
=
""
,
position
=
optivis_coord
(
0
,
-
1
),
item
=
self
.
_optivis_component
)
lbl
.
content
[
"Name"
]
=
self
.
name
self
.
_optivis_component
.
labels
.
append
(
lbl
)
return
self
.
_optivis_component
def
getOptivisNode
(
self
,
mode
,
kat_node
):
mode
=
mode
.
lower
()
if
mode
!=
"input"
and
mode
.
lower
()
!=
"output"
:
raise
pkex
.
BasePyKatException
(
"Mode must be either input or output not %s"
%
mode
)
if
mode
==
"input"
:
if
kat_node
is
self
.
nodes
[
0
]:
return
self
.
_optivis_component
.
getInputNode
(
"fr"
)
else
:
return
self
.
_optivis_component
.
getInputNode
(
"bk"
)
elif
mode
==
"output"
:
if
kat_node
is
self
.
nodes
[
0
]:
return
self
.
_optivis_component
.
getOutputNode
(
"fr"
)
else
:
return
self
.
_optivis_component
.
getOutputNode
(
"bk"
)
def
getQGraphicsItem
(
self
):
def
getQGraphicsItem
(
self
):
if
not
USE_GUI
:
if
not
USE_GUI
:
raise
NoGUIException
raise
NoGUIException
...
@@ -483,6 +555,39 @@ class beamSplitter(AbstractMirrorComponent):
...
@@ -483,6 +555,39 @@ class beamSplitter(AbstractMirrorComponent):
else
:
else
:
raise
pkex
.
BasePyKatException
(
"No attribute {0} for mirrors"
.
format
(
key
))
raise
pkex
.
BasePyKatException
(
"No attribute {0} for mirrors"
.
format
(
key
))
def
getOptivisComponent
(
self
):
self
.
setOptivisLabelContent
()
if
self
.
_optivis_component
is
None
:
self
.
_optivis_component
=
optivis_components
.
BeamSplitter
(
name
=
self
.
name
,
aoi
=-
self
.
alpha
,
tooltip
=
self
.
getOptivisTooltip
,
paramList
=
self
.
getOptivisParameterDict
(),
pykatObject
=
weakref
.
ref
(
self
))
return
self
.
_optivis_component
def
getOptivisNode
(
self
,
mode
,
kat_node
):
mode
=
mode
.
lower
()
if
mode
!=
"input"
and
mode
.
lower
()
!=
"output"
:
raise
pkex
.
BasePyKatException
(
"Mode must be either input or output"
)
if
mode
==
"input"
:
if
kat_node
is
self
.
nodes
[
0
]:
return
self
.
_optivis_component
.
getInputNode
(
"frA"
)
elif
kat_node
is
self
.
nodes
[
1
]:
return
self
.
_optivis_component
.
getInputNode
(
"frB"
)
elif
kat_node
is
self
.
nodes
[
2
]:
return
self
.
_optivis_component
.
getInputNode
(
"bkB"
)
elif
kat_node
is
self
.
nodes
[
3
]:
return
self
.
_optivis_component
.
getInputNode
(
"bkA"
)
elif
mode
==
"output"
:
if
kat_node
is
self
.
nodes
[
0
]:
return
self
.
_optivis_component
.
getOutputNode
(
"frB"
)
elif
kat_node
is
self
.
nodes
[
1
]:
return
self
.
_optivis_component
.
getOutputNode
(
"frA"
)
elif
kat_node
is
self
.
nodes
[
2
]:
return
self
.
_optivis_component
.
getOutputNode
(
"bkA"
)
elif
kat_node
is
self
.
nodes
[
3
]:
return
self
.
_optivis_component
.
getOutputNode
(
"bkB"
)
@
staticmethod
@
staticmethod
def
parseFinesseText
(
text
):
def
parseFinesseText
(
text
):
values
=
text
.
split
()
values
=
text
.
split
()
...
@@ -579,6 +684,18 @@ class space(Component):
...
@@ -579,6 +684,18 @@ class space(Component):
@
gy
.
setter
@
gy
.
setter
def
gy
(
self
,
value
):
self
.
__gy
.
value
=
SIfloat
(
value
)
def
gy
(
self
,
value
):
self
.
__gy
.
value
=
SIfloat
(
value
)
def
connectingComponents
(
self
):
"""
Returns the two components that this space connects.
"""
a
=
list
(
self
.
nodes
[
0
].
components
+
self
.
nodes
[
1
].
components
)
a
=
[
value
for
value
in
a
if
value
!=
self
]
if
len
(
a
)
!=
2
:
raise
pkex
.
BasePyKatException
(
"Space should only connect 2 components"
)
return
a
def
parseAttributes
(
self
,
values
):
def
parseAttributes
(
self
,
values
):
for
key
in
values
.
keys
():
for
key
in
values
.
keys
():
...
@@ -803,6 +920,32 @@ class isolator(Component):
...
@@ -803,6 +920,32 @@ class isolator(Component):
return
rtn
return
rtn
def
getOptivisComponent
(
self
):
self
.
setOptivisLabelContent
()
if
self
.
_optivis_component
is
None
:
self
.
_optivis_component
=
optivis_components
.
FaradayIsolator
(
name
=
self
.
name
,
tooltip
=
self
.
getOptivisTooltip
,
paramList
=
self
.
getOptivisParameterDict
(),
pykatObject
=
weakref
.
ref
(
self
))
return
self
.
_optivis_component
def
getOptivisNode
(
self
,
mode
,
kat_node
):
mode
=
mode
.
lower
()
if
mode
!=
"input"
and
mode
.
lower
()
!=
"output"
:
raise
pkex
.
BasePyKatException
(
"Mode must be either input or output"
)
if
mode
==
"input"
:
if
kat_node
is
self
.
nodes
[
0
]:
return
self
.
_optivis_component
.
getInputNode
(
"fr"
)
elif
kat_node
is
self
.
nodes
[
1
]:
return
self
.
_optivis_component
.
getInputNode
(
"bk"
)
elif
mode
==
"output"
:
if
kat_node
is
self
.
nodes
[
0
]:
return
self
.
_optivis_component
.
getnOutputNode
(
"fr"
)
elif
kat_node
is
self
.
nodes
[
1
]:
return
self
.
_optivis_component
.
getOutputNode
(
"bk"
)
def
getQGraphicsItem
(
self
):
def
getQGraphicsItem
(
self
):
if
not
USE_GUI
:
if
not
USE_GUI
:
raise
NoGUIException
raise
NoGUIException
...
@@ -848,6 +991,31 @@ class lens(Component):
...
@@ -848,6 +991,31 @@ class lens(Component):
return
rtn
return
rtn
def
getOptivisComponent
(
self
):
self
.
setOptivisLabelContent
()
if
self
.
_optivis_component
is
None
:
self
.
_optivis_component
=
optivis_components
.
ConvexLens
(
name
=
self
.
name
,
tooltip
=
self
.
getOptivisTooltip
,
paramList
=
self
.
getOptivisParameterDict
(),
pykatObject
=
weakref
.
ref
(
self
))
return
self
.
_optivis_component
def
getOptivisNode
(
self
,
mode
,
kat_node
):
mode
=
mode
.
lower
()
if
mode
!=
"input"
and
mode
.
lower
()
!=
"output"
:
raise
pkex
.
BasePyKatException
(
"Mode must be either input or output"
)
if
mode
==
"input"
:
if
kat_node
is
self
.
nodes
[
0
]:
return
self
.
_optivis_component
.
getInputNode
(
"fr"
)
elif
kat_node
is
self
.
nodes
[
1
]:
return
self
.
_optivis_component
.
getInputNode
(
"bk"
)
elif
mode
==
"output"
:
if
kat_node
is
self
.
nodes
[
0
]:
return
self
.
_optivis_component
.
getnOutputNode
(
"fr"
)
elif
kat_node
is
self
.
nodes
[
1
]:
return
self
.
_optivis_component
.
getOutputNode
(
"bk"
)
def
getQGraphicsItem
(
self
):
def
getQGraphicsItem
(
self
):
if
not
USE_GUI
:
if
not
USE_GUI
:
raise
NoGUIException
raise
NoGUIException
...
@@ -929,6 +1097,31 @@ class modulator(Component):
...
@@ -929,6 +1097,31 @@ class modulator(Component):
return
rtn
return
rtn
def
getOptivisComponent
(
self
):
self
.
setOptivisLabelContent
()
if
self
.
_optivis_component
is
None
:
self
.
_optivis_component
=
optivis_components
.
ElectroopticModulator
(
name
=
self
.
name
,
tooltip
=
self
.
getOptivisTooltip
,
paramList
=
self
.
getOptivisParameterDict
(),
pykatObject
=
weakref
.
ref
(
self
))
return
self
.
_optivis_component
def
getOptivisNode
(
self
,
mode
,
kat_node
):
mode
=
mode
.
lower
()
if
mode
!=
"input"
and
mode
.
lower
()
!=
"output"
:
raise
pkex
.
BasePyKatException
(
"Mode must be either input or output"
)
if
mode
==
"input"
:
if
kat_node
is
self
.
nodes
[
0
]:
return
self
.
_optivis_component
.
getInputNode
(
"fr"
)
elif
kat_node
is
self
.
nodes
[
1
]:
return
self
.
_optivis_component
.
getInputNode
(
"bk"
)
elif
mode
==
"output"
:
if
kat_node
is
self
.
nodes
[
0
]:
return
self
.
_optivis_component
.
getnOutputNode
(
"fr"
)
elif
kat_node
is
self
.
nodes
[
1
]:
return
self
.
_optivis_component
.
getOutputNode
(
"bk"
)
def
getQGraphicsItem
(
self
):
def
getQGraphicsItem
(
self
):
if
not
USE_GUI
:
if
not
USE_GUI
:
raise
NoGUIException
raise
NoGUIException
...
@@ -999,6 +1192,28 @@ class laser(Component):
...
@@ -999,6 +1192,28 @@ class laser(Component):
return
rtn
return
rtn
def
getOptivisComponent
(
self
):
self
.
setOptivisLabelContent
()
if
self
.
_optivis_component
is
None
:
self
.
_optivis_component
=
optivis_components
.
Laser
(
name
=
self
.
name
,
tooltip
=
self
.
getOptivisTooltip
,
paramList
=
self
.
getOptivisParameterDict
(),
pykatObject
=
weakref
.
ref
(
self
))
lbl
=
optivis_label
(
text
=
""
,
position
=
optivis_coord
(
0
,
-
1
),
item
=
self
.
_optivis_component
)
lbl
.
content
[
"Name"
]
=
self
.
name
self
.
_optivis_component
.
labels
.
append
(
lbl
)
return
self
.
_optivis_component
def
getOptivisNode
(
self
,
mode
,
kat_node
):
mode
=
mode
.
lower
()
if
mode
!=
"input"
and
mode
.
lower
()
!=
"output"
:
raise
pkex
.
BasePyKatException
(
"Mode must be either input or output"
)
if
mode
==
"input"
:
return
None
elif
mode
==
"output"
:
return
self
.
_optivis_component
.
getOutputNode
(
"out"
)
def
getQGraphicsItem
(
self
):
def
getQGraphicsItem
(
self
):
if
not
USE_GUI
:
if
not
USE_GUI
:
raise
NoGUIException
raise
NoGUIException
...
...
pykat/detectors.py
View file @
dc470f85
...
@@ -15,7 +15,7 @@ if six.PY2:
...
@@ -15,7 +15,7 @@ if six.PY2:
import
abc
import
abc
from
pykat.node_network
import
*
from
pykat.node_network
import
*
from
pykat.param
import
Param
from
pykat.param
import
Param
,
AttrParam
from
pykat.SIfloat
import
SIfloat
from
pykat.SIfloat
import
SIfloat
import
pykat.external.six
as
six
import
pykat.external.six
as
six
...
@@ -356,7 +356,13 @@ class bp(Detector1):
...
@@ -356,7 +356,13 @@ class bp(Detector1):
class
pd
(
Detector1
):
class
pd
(
Detector1
):
def
__init__
(
self
,
name
,
num_demods
,
node_name
,
senstype
=
None
,
alternate_beam
=
False
,
pdtype
=
None
,
**
kwargs
):
def
__new__
(
cls
,
*
args
,
**
kwargs
):
# This creates an instance specific class for the component
# this enables us to add properties to instances rather than
# all classes
return
object
.
__new__
(
type
(
cls
.
__name__
,
(
cls
,),
{}),
*
args
,
**
kwargs
)
def
__init__
(
self
,
name
=
None
,
num_demods
=
1
,
node_name
=
None
,
senstype
=
None
,
alternate_beam
=
False
,
pdtype
=
None
,
**
kwargs
):
BaseDetector
.
__init__
(
self
,
name
,
node_name
)
BaseDetector
.
__init__
(
self
,
name
,
node_name
)
self
.
__num_demods
=
num_demods
self
.
__num_demods
=
num_demods
...
@@ -402,12 +408,25 @@ class pd(Detector1):
...
@@ -402,12 +408,25 @@ class pd(Detector1):
elif
i
<
num_demods
-
1
:
elif
i
<
num_demods
-
1
:
raise
pkex
.
BasePyKatException
(
"Missing demodulation phase {0} (phi{0})"
.
format
(
i
+
1
))
raise
pkex
.
BasePyKatException
(
"Missing demodulation phase {0} (phi{0})"
.
format
(
i
+
1
))
# define new class for assigning new attributes
cls
=
type
(
self
)
self
.
__class__
=
type
(
cls
.
__name__
,
(
cls
,),
{})
self
.
__set_demod_attrs
()
self
.
__set_demod_attrs
()
def
__deepcopy__
(
self
,
memo
):
"""
When deep copying a kat object we need to take into account
the instance specific properties.
"""
result
=
pd
(
self
.
name
,
self
.
num_demods
,
self
.
node
.
name
)
memo
[
id
(
self
)]
=
result
result
.
__dict__
=
copy
.
deepcopy
(
self
.
__dict__
,
memo
)
# Find all properties in class we are copying
# and deep copy these to the new class instance
for
x
in
self
.
__class__
.
__dict__
.
items
():
if
isinstance
(
x
[
1
],
property
):
setattr
(
result
.
__class__
,
x
[
0
],
x
[
1
])
return
result
@
property
@
property
def
senstype
(
self
):
return
self
.
__senstype
def
senstype
(
self
):
return
self
.
__senstype
@
senstype
.
setter
@
senstype
.
setter
...
@@ -666,7 +685,7 @@ class qnoised(pd):
...
@@ -666,7 +685,7 @@ class qnoised(pd):
class
qshot
(
pd
):
class
qshot
(
pd
):
def
__init__
(
self
,
name
,
num_demods
,
node_name
,
alternate_beam
=
False
,
**
kwargs
):
def
__init__
(
self
,
name
,
num_demods
,
node_name
,
alternate_beam
=
False
,
**
kwargs
):
super
(
q
noised
,
self
).
__init__
(
name
,
num_demods
,
node_name
,
alternate_beam
=
alternate_beam
,
pdtype
=
None
,
senstype
=
None
,
**
kwargs
)
super
(
q
shot
,
self
).
__init__
(
name
,
num_demods
,
node_name
,
alternate_beam
=
alternate_beam
,
pdtype
=
None
,
senstype
=
None
,
**
kwargs
)
@
pd
.
pdtype
.
setter
@
pd
.
pdtype
.
setter
def
pdtype
(
self
,
value
):
def
pdtype
(
self
,
value
):
...
...
pykat/finesse.py
View file @
dc470f85
This diff is collapsed.
Click to expand it.
pykat/node_network.py
View file @
dc470f85
...
@@ -23,6 +23,13 @@ from pykat.optics.gaussian_beams import beam_param
...
@@ -23,6 +23,13 @@ from pykat.optics.gaussian_beams import beam_param
from
copy
import
deepcopy
from
copy
import
deepcopy
class
NodeNetwork
(
object
):
class
NodeNetwork
(
object
):
def
__new__
(
cls
,
*
args
,
**
kwargs
):
# This creates an instance specific class for the component
# this enables us to add properties to instances rather than
# all classes
return
object
.
__new__
(
type
(
cls
.
__name__
,
(
cls
,),
{}),
*
args
,
**
kwargs
)
def
__init__
(
self
,
kat
):
def
__init__
(
self
,
kat
):
self
.
__nodes
=
{}
self
.
__nodes
=
{}
self
.
__kat
=
kat
self
.
__kat
=
kat
...
@@ -31,9 +38,6 @@ class NodeNetwork(object):
...
@@ -31,9 +38,6 @@ class NodeNetwork(object):
self
.
__componentCallback
=
{}
self
.
__componentCallback
=
{}
self
.
__node_id
=
1
self
.
__node_id
=
1
cls
=
type
(
self
)
self
.
__class__
=
type
(
cls
.
__name__
,
(
cls
,),
{})
@
property
@
property
def
kat
(
self
):
return
self
.
__kat
def
kat
(
self
):
return
self
.
__kat
...
...
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