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
Snippets
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
Sean Leavey
pykat
Commits
79579343
Commit
79579343
authored
10 years ago
by
Daniel Brown
Browse files
Options
Downloads
Patches
Plain Diff
adding fsig parsing
parent
9511bc5c
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
bin/test_fsig.py
+1
-1
1 addition, 1 deletion
bin/test_fsig.py
pykat/components.py
+25
-3
25 additions, 3 deletions
pykat/components.py
pykat/finesse.py
+45
-10
45 additions, 10 deletions
pykat/finesse.py
with
71 additions
and
14 deletions
bin/test_fsig.py
+
1
−
1
View file @
79579343
...
...
@@ -28,7 +28,7 @@ put low_refl f $mx1
yaxis log re:im
fsig noise
9
fsig noise
m2 1 0
"""
kat
=
finesse
.
kat
(
kat_code
=
code
)
...
...
This diff is collapsed.
Click to expand it.
pykat/components.py
+
25
−
3
View file @
79579343
...
...
@@ -76,6 +76,7 @@ class Component(object):
self
.
tag
=
None
self
.
_params
=
[]
self
.
__removed
=
False
self
.
_default_fsig_param
=
None
# store a unique ID for this component
global
next_component_id
...
...
@@ -91,6 +92,20 @@ class Component(object):
def
_register_param
(
self
,
param
):
self
.
_params
.
append
(
param
)
def
_default_fsig
(
self
):
"""
Returns what Finesse internally determines as the default
fsig parameter. This is used mainly for parsing fsig command
lines where no target parameter is stated.
"""
if
self
.
_default_fsig_param
!=
None
:
if
not
self
.
_default_fsig_param
.
canFsig
:
raise
pkex
.
BasePyKatException
(
"
Default fsig parameter %s is not possible to fsig
"
%
(
self
.
__default_fsig_param
.
name
))
else
:
return
self
.
_default_fsig_param
else
:
return
None
def
_on_kat_add
(
self
,
kat
):
"""
Called when this component has been added to a kat object.
...
...
@@ -226,6 +241,8 @@ class AbstractMirrorComponent(Component):
self
.
__Frx
=
Param
(
"
Frx
"
,
self
,
0
,
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
.
_default_fsig_param
=
self
.
__phi
@property
def
z
(
self
):
return
self
.
__z
@property
...
...
@@ -499,12 +516,14 @@ class space(Component):
self
.
_requested_node_names
.
append
(
node1
)
self
.
_requested_node_names
.
append
(
node2
)
self
.
_QItem
=
None
self
.
__L
=
Param
(
"
L
"
,
self
,
SIfloat
(
L
))
self
.
__L
=
Param
(
"
L
"
,
self
,
SIfloat
(
L
)
,
canFsig
=
True
,
fsig_name
=
"
phase
"
)
self
.
__n
=
Param
(
"
n
"
,
self
,
SIfloat
(
n
))
self
.
__gx
=
AttrParam
(
"
gx
"
,
self
,
gx
)
self
.
__gy
=
AttrParam
(
"
gy
"
,
self
,
gy
)
self
.
_default_fsig_param
=
self
.
__L
@property
def
L
(
self
):
return
self
.
__L
@L.setter
...
...
@@ -823,10 +842,11 @@ class modulator(Component):
self
.
_svgItem
=
None
self
.
__f
=
Param
(
"
f
"
,
self
,
SIfloat
(
f
))
self
.
__midx
=
Param
(
"
midx
"
,
self
,
SIfloat
(
midx
))
self
.
__phase
=
Param
(
"
phase
"
,
self
,
SIfloat
(
phase
))
self
.
__phase
=
Param
(
"
phase
"
,
self
,
SIfloat
(
phase
)
,
canFsig
=
True
,
fsig_name
=
"
phase
"
)
self
.
__order
=
order
self
.
type
=
modulation_type
self
.
_default_fsig_param
=
self
.
__phase
@property
def
f
(
self
):
return
self
.
__f
...
...
@@ -906,6 +926,8 @@ class laser(Component):
self
.
__noise
=
AttrParam
(
"
noise
"
,
self
,
None
)
self
.
_svgItem
=
None
self
.
_default_fsig_param
=
self
.
__f_offset
@property
def
P
(
self
):
return
self
.
__power
@P.setter
...
...
This diff is collapsed.
Click to expand it.
pykat/finesse.py
+
45
−
10
View file @
79579343
...
...
@@ -347,7 +347,14 @@ class Signals(object):
for
t
in
self
.
targets
:
rtn
.
extend
(
t
.
getFinesseText
())
rtn
.
append
(
"
fsig {name} {comp} {target} {frequency} {phase} {amplitude}
"
.
format
(
name
=
t
.
name
,
comp
=
t
.
owner
,
target
=
t
.
target
,
frequency
=
str
(
self
.
f
),
phase
=
str
(
t
.
phase
),
amplitude
=
str
(
t
.
amplitude
)))
rtn
.
append
(
"
fsig {name} {comp} {target} {frequency} {phase} {amplitude}
"
.
format
(
name
=
t
.
name
,
comp
=
t
.
owner
,
target
=
t
.
target
,
frequency
=
str
(
self
.
f
),
phase
=
str
(
t
.
phase
),
amplitude
=
str
(
t
.
amplitude
if
t
.
amplitude
!=
None
else
""
)))
for
p
in
self
.
_params
:
rtn
.
extend
(
p
.
getFinesseText
())
...
...
@@ -703,8 +710,8 @@ class kat(object):
elif
(
first
==
"
gnuterm
"
or
first
==
"
pyterm
"
):
if
self
.
verbose
:
print
"
Ignoring Gnuplot/Python terminal command
'
{0}
'"
.
format
(
line
)
#
elif(first == "fsig"):
#
after_process.append(line)
elif
(
first
==
"
fsig
"
):
after_process
.
append
(
line
)
elif
(
first
==
"
noplot
"
):
obj
=
line
self
.
__blocks
[
self
.
__currentTag
].
contents
.
append
(
line
)
...
...
@@ -797,13 +804,41 @@ class kat(object):
v
=
line
.
split
()
if
v
[
2
]
in
self
.
__components
:
comp
=
self
.
__components
[
v
[
1
]]
else
:
raise
pkex
.
BasePyKatException
(
"
Could not find the component
'
{0}
'
for attr command in line
'
{1}
'"
.
format
(
v
[
1
],
line
))
name
=
str
(
v
[
1
])
if
v
[
2
]
not
in
self
.
__components
:
raise
pkex
.
BasePyKatException
(
"
Could not find the component
'
{0}
'
. Line:
'
{1}
'"
.
format
(
v
[
2
],
line
))
comp
=
self
.
__components
[
v
[
2
]]
if
comp
.
_default_fsig
()
==
None
:
raise
pkex
.
BasePyKatException
(
"
Component
'
{0}
'
cannot be fsig
'
d. Line:
'
{1}
'"
.
format
(
comp
.
name
,
line
))
param
=
None
amp
=
None
if
len
(
v
)
==
5
:
param
==
None
freq
=
float
(
v
[
3
])
phase
=
float
(
v
[
4
])
elif
len
(
v
)
==
6
:
if
v
[
3
].
isdigit
():
freq
=
float
(
v
[
3
])
phase
=
float
(
v
[
4
])
amp
=
float
(
v
[
5
])
else
:
param
=
v
[
3
]
freq
=
float
(
v
[
4
])
phase
=
float
(
v
[
5
])
elif
len
(
v
)
==
7
:
param
=
v
[
3
]
freq
=
float
(
v
[
4
])
phase
=
float
(
v
[
5
])
amp
=
float
(
v
[
6
])
else
:
raise
pkex
.
BasePyKatException
(
"'
{0}
'
isnot a valid fsig command
"
.
format
(
line
))
#kat
.sig
a
nls.apply()
self
.
sign
a
ls
.
apply
(
comp
.
_default_fsig
(),
amp
,
phase
,
name
)
else
:
raise
pkex
.
BasePyKatException
(
"
Haven
'
t handled parsing of
'
{0}
'"
.
format
(
line
))
...
...
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