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
Sebastian Steinlechner
pykat
Commits
04dcdf4f
Commit
04dcdf4f
authored
10 years ago
by
Daniel Brown
Browse files
Options
Downloads
Patches
Plain Diff
fixing fsig removal
parent
7d3f7954
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
bin/test_fsig.py
+2
-2
2 additions, 2 deletions
bin/test_fsig.py
pykat/finesse.py
+21
-16
21 additions, 16 deletions
pykat/finesse.py
with
23 additions
and
18 deletions
bin/test_fsig.py
+
2
−
2
View file @
04dcdf4f
...
...
@@ -31,7 +31,7 @@ yaxis log re:im
kat
=
finesse
.
kat
(
kat_code
=
code
)
kat
.
signals
.
apply
(
kat
.
l1
.
power
,
1
,
0
)
kat
.
signals
.
apply
(
kat
.
l1
.
P
,
1
,
0
)
kat
.
signals
.
apply
(
kat
.
m1
.
phi
,
1
,
90
)
kat
.
add
(
xaxis
(
'
log
'
,
[
1
,
1000
],
kat
.
signals
.
f
,
100
))
...
...
@@ -47,4 +47,4 @@ pl.loglog(out.x, np.abs(a_up + a_lo), out.x, np.abs((a_up - a_lo) / (1j)))
pl
.
xlabel
(
out
.
xlabel
)
pl
.
title
(
"
Reflection quadratures with no relative carrier phase
"
)
pl
.
legend
([
"
Amplitude
"
,
"
Phase
"
])
pl
.
show
()
\ No newline at end of file
#pl.show()
This diff is collapsed.
Click to expand it.
pykat/finesse.py
+
21
−
16
View file @
04dcdf4f
...
...
@@ -237,13 +237,14 @@ class katRun2D(object):
class
Signals
(
object
):
class
fsig
(
object
):
def
__init__
(
self
,
param
,
name
,
amplitude
,
phase
):
def
__init__
(
self
,
param
,
name
,
amplitude
,
phase
,
signal
):
self
.
_params
=
[]
self
.
__target
=
param
self
.
__name
=
name
self
.
__amplitude
=
Param
(
"
amp
"
,
self
,
SIfloat
(
amplitude
))
self
.
__phase
=
Param
(
"
phase
"
,
self
,
SIfloat
(
phase
))
self
.
__removed
=
False
self
.
__signal
=
signal
# unfortunatenly the target names for fsig are not the same as the
# various parameter names of the c omponents, e.g. mirror xbeta is x
...
...
@@ -262,7 +263,8 @@ class Signals(object):
if
self
.
__removed
:
raise
pkex
.
BasePyKatException
(
"
Signal {0} has already been marked as removed
"
.
format
(
self
.
name
))
else
:
self
.
_kat
.
remove
(
self
)
self
.
__signal
.
targets
.
remove
(
self
)
self
.
__remove
=
True
@property
def
name
(
self
):
return
self
.
__name
...
...
@@ -304,23 +306,23 @@ class Signals(object):
return
self
.
targets
[
0
].
name
@property
def
removed
(
self
):
return
False
# we can never remove the Signal object altogethr just the
# individual fsig targets
def
removed
(
self
):
return
False
# we can never remove the Signal object altogethr just the individual fsig targets
def
remove
(
self
):
for
t
in
self
.
targets
:
self
.
_ka
t
.
remove
(
self
)
t
.
remove
()
@property
def
f
(
self
):
return
self
.
__f
@f.setter
def
f
(
self
,
value
):
self
.
__f
.
value
=
SIfloat
(
value
)
def
__init__
(
self
):
def
__init__
(
self
,
kat
):
if
kat
==
None
:
raise
pkex
.
BasePyKatException
(
"
kat object must be specified
"
)
self
.
targets
=
[]
self
.
_params
=
[]
self
.
__kat
=
kat
self
.
__f
=
Param
(
"
f
"
,
self
,
1
)
def
_register_param
(
self
,
param
):
...
...
@@ -334,7 +336,7 @@ class Signals(object):
if
name
==
None
:
name
=
"
sig_
"
+
target
.
_owner
().
name
+
"
_
"
+
target
.
name
self
.
targets
.
append
(
Signals
.
fsig
(
target
,
name
,
amplitude
,
phase
))
self
.
targets
.
append
(
Signals
.
fsig
(
target
,
name
,
amplitude
,
phase
,
self
))
def
getFinesseText
(
self
):
rtn
=
[]
...
...
@@ -348,7 +350,6 @@ class Signals(object):
return
rtn
class
Block
:
def
__init__
(
self
,
name
):
self
.
__name
=
name
...
...
@@ -380,7 +381,7 @@ class kat(object):
self
.
__tempdir
=
tempdir
self
.
__tempname
=
tempname
self
.
pykatgui
=
None
self
.
__signals
=
Signals
()
self
.
__signals
=
Signals
(
self
)
self
.
constants
=
{}
self
.
vacuum
=
[]
self
.
__prevrunfilename
=
None
...
...
@@ -1047,7 +1048,7 @@ class kat(object):
if
self
.
verbose
:
print
"
Finished in
"
+
str
(
datetime
.
datetime
.
now
()
-
start
)
def
remove
(
self
,
obj
):
if
not
(
obj
.
name
in
self
.
__components
or
obj
.
name
in
self
.
__detectors
or
obj
.
name
in
self
.
__commands
):
if
not
isinstance
(
obj
,
pykat
.
finesse
.
Signals
)
and
not
(
obj
.
name
in
self
.
__components
or
obj
.
name
in
self
.
__detectors
or
obj
.
name
in
self
.
__commands
or
obj
in
self
.
signals
.
targets
):
raise
pkex
.
BasePyKatException
(
"
{0} is not currently in the simulation
"
.
format
(
obj
.
name
))
if
obj
.
removed
:
...
...
@@ -1069,6 +1070,10 @@ class kat(object):
elif
isinstance
(
obj
,
Detector
):
del
self
.
__detectors
[
obj
.
name
]
self
.
__del_detector
(
obj
)
elif
isinstance
(
obj
,
pykat
.
finesse
.
Signals
):
obj
.
remove
()
elif
isinstance
(
obj
,
pykat
.
finesse
.
Signals
.
fsig
):
obj
.
remove
()
for
b
in
self
.
__blocks
:
if
obj
in
self
.
__blocks
[
b
].
contents
:
...
...
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