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
finesse
pykat
Commits
edf1bf7b
Commit
edf1bf7b
authored
9 years ago
by
Daniel Brown
Browse files
Options
Downloads
Patches
Plain Diff
adding in beam detector
parent
f0b5c5f1
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_beam_det.py
+22
-0
22 additions, 0 deletions
bin/test_beam_det.py
pykat/detectors.py
+49
-2
49 additions, 2 deletions
pykat/detectors.py
pykat/finesse.py
+2
-0
2 additions, 0 deletions
pykat/finesse.py
with
73 additions
and
2 deletions
bin/test_beam_det.py
0 → 100644
+
22
−
0
View file @
edf1bf7b
import
pykat
kat
=
pykat
.
finesse
.
kat
()
kat
.
parseCommands
(
"""
l l1 1 0 n0
s s1 1 n0 n1
beam b1 0 n1
gauss g1 l1 n0 1 0
xaxis b1 x lin -3 3 100
x2axis b1 y lin -3 3 100
"""
)
out
=
kat
.
run
()
import
pylab
pylab
.
pcolormesh
(
out
.
x
,
out
.
y
,
out
[
"
b1
"
])
pylab
.
show
()
This diff is collapsed.
Click to expand it.
pykat/detectors.py
+
49
−
2
View file @
edf1bf7b
...
...
@@ -220,6 +220,53 @@ class Detector2(BaseDetector):
self
.
_set_node
(
value
,
1
)
class
beam
(
Detector1
):
def
__init__
(
self
,
name
,
node_name
,
frequency
=
None
,
alternate_beam
=
False
):
BaseDetector
.
__init__
(
self
,
name
,
node_name
)
self
.
alternate_beam
=
alternate_beam
self
.
__f
=
Param
(
"
f
"
,
self
,
frequency
)
@property
def
f
(
self
):
return
self
.
__f
@f.setter
def
f
(
self
,
value
):
self
.
__f
.
value
=
value
@staticmethod
def
parseFinesseText
(
text
):
values
=
text
.
split
()
node
=
values
[
-
1
]
alt_beam
=
node
[
-
1
]
==
'
*
'
if
len
(
values
)
==
3
:
return
beam
(
values
[
1
],
node
,
alternate_beam
=
alt_beam
)
elif
len
(
values
)
==
4
:
return
beam
(
values
[
1
],
node
,
alternate_beam
=
alt_beam
,
frequency
=
pykat
.
SIfloat
.
SIfloat
(
values
[
2
]))
else
:
raise
pkex
.
BasePyKatException
(
'
Beam detector code
"
{0}
"
is not a valid FINESSE command
'
.
format
(
text
))
def
getFinesseText
(
self
)
:
rtn
=
[]
if
self
.
alternate_beam
:
alt
=
'
*
'
else
:
alt
=
''
if
self
.
f
.
value
is
None
:
rtn
.
append
(
"
beam {name} {node}{alt}
"
.
format
(
name
=
self
.
name
,
node
=
self
.
node
.
name
,
alt
=
alt
))
else
:
rtn
.
append
(
"
beam {name} {f} {node}{alt}
"
.
format
(
name
=
self
.
name
,
f
=
str
(
self
.
f
.
value
),
node
=
self
.
node
.
name
,
alt
=
alt
))
for
p
in
self
.
_params
:
rtn
.
extend
(
p
.
getFinesseText
())
return
rtn
...
...
This diff is collapsed.
Click to expand it.
pykat/finesse.py
+
2
−
0
View file @
edf1bf7b
...
...
@@ -835,6 +835,8 @@ class kat(object):
obj
=
pykat
.
detectors
.
bp
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
4
]
==
"
gouy
"
):
obj
=
pykat
.
detectors
.
gouy
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
4
]
==
"
beam
"
):
obj
=
pykat
.
detectors
.
beam
.
parseFinesseText
(
line
)
elif
(
first
[
0
:
2
]
==
"
pd
"
and
first
!=
"
pdtype
"
):
obj
=
pykat
.
detectors
.
pd
.
parseFinesseText
(
line
)
elif
(
first
==
"
qshot
"
or
first
==
"
qshotS
"
or
first
==
"
qshotN
"
):
...
...
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